OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "base/message_loop/message_loop.h" |
| 6 #include "base/test/simple_test_tick_clock.h" |
| 7 #include "chrome/common/cast_messages.h" |
| 8 #include "chrome/renderer/media/cast_ipc_dispatcher.h" |
| 9 #include "ipc/ipc_message_macros.h" |
| 10 #include "media/cast/logging/logging_defines.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 |
| 13 namespace { |
| 14 |
| 15 class CastIPCDispatcherTest : public testing::Test { |
| 16 public: |
| 17 CastIPCDispatcherTest() { |
| 18 dispatcher_ = new CastIPCDispatcher(base::MessageLoopProxy::current()); |
| 19 } |
| 20 |
| 21 protected: |
| 22 void FakeSend(const IPC::Message& message) { |
| 23 EXPECT_TRUE(dispatcher_->OnMessageReceived(message)); |
| 24 } |
| 25 |
| 26 scoped_refptr<CastIPCDispatcher> dispatcher_; |
| 27 base::MessageLoopForIO message_loop_; |
| 28 }; |
| 29 |
| 30 TEST_F(CastIPCDispatcherTest, RawEvents) { |
| 31 const int kChannelId = 17; |
| 32 std::vector<media::cast::PacketEvent> packet_events; |
| 33 media::cast::PacketEvent packet_event; |
| 34 packet_event.rtp_timestamp = 100; |
| 35 packet_event.max_packet_id = 10; |
| 36 packet_event.packet_id = 5; |
| 37 packet_event.size = 512; |
| 38 packet_event.timestamp = base::SimpleTestTickClock().NowTicks(); |
| 39 packet_event.type = media::cast::PACKET_SENT_TO_NETWORK; |
| 40 packet_event.media_type = media::cast::VIDEO_EVENT; |
| 41 |
| 42 packet_events.push_back(packet_event); |
| 43 CastMsg_RawEvents raw_events_msg(kChannelId, packet_events); |
| 44 |
| 45 FakeSend(raw_events_msg); |
| 46 } |
| 47 |
| 48 } // namespace |
| 49 |
OLD | NEW |