Return Windows error code when create-process fails.
[chromium-blink-merge.git] / chrome / renderer / media / cast_ipc_dispatcher_unittest.cc
bloba07f8dfa6d42e822415ac4cfb0453bc741515601
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/message_loop/message_loop.h"
6 #include "base/test/simple_test_tick_clock.h"
7 #include "base/thread_task_runner_handle.h"
8 #include "chrome/common/cast_messages.h"
9 #include "chrome/renderer/media/cast_ipc_dispatcher.h"
10 #include "ipc/ipc_message_macros.h"
11 #include "media/cast/logging/logging_defines.h"
12 #include "testing/gtest/include/gtest/gtest.h"
14 namespace {
16 class CastIPCDispatcherTest : public testing::Test {
17 public:
18 CastIPCDispatcherTest() {
19 dispatcher_ = new CastIPCDispatcher(base::ThreadTaskRunnerHandle::Get());
22 protected:
23 void FakeSend(const IPC::Message& message) {
24 EXPECT_TRUE(dispatcher_->OnMessageReceived(message));
27 scoped_refptr<CastIPCDispatcher> dispatcher_;
28 base::MessageLoopForIO message_loop_;
31 TEST_F(CastIPCDispatcherTest, RawEvents) {
32 const int kChannelId = 17;
34 media::cast::PacketEvent packet_event;
35 packet_event.rtp_timestamp = 100;
36 packet_event.max_packet_id = 10;
37 packet_event.packet_id = 5;
38 packet_event.size = 512;
39 packet_event.timestamp = base::SimpleTestTickClock().NowTicks();
40 packet_event.type = media::cast::PACKET_SENT_TO_NETWORK;
41 packet_event.media_type = media::cast::VIDEO_EVENT;
42 std::vector<media::cast::PacketEvent> packet_events;
43 packet_events.push_back(packet_event);
45 media::cast::FrameEvent frame_event;
46 frame_event.rtp_timestamp = 100;
47 frame_event.frame_id = 5;
48 frame_event.size = 512;
49 frame_event.timestamp = base::SimpleTestTickClock().NowTicks();
50 frame_event.media_type = media::cast::VIDEO_EVENT;
51 std::vector<media::cast::FrameEvent> frame_events;
52 frame_events.push_back(frame_event);
54 packet_events.push_back(packet_event);
55 CastMsg_RawEvents raw_events_msg(kChannelId, packet_events,
56 frame_events);
58 FakeSend(raw_events_msg);
61 } // namespace