OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
11 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
12 #include "remoting/proto/video.pb.h" | 12 #include "remoting/proto/video.pb.h" |
13 #include "remoting/protocol/fake_session.h" | 13 #include "remoting/protocol/fake_session.h" |
14 #include "remoting/protocol/rtp_utils.h" | 14 #include "remoting/protocol/rtp_utils.h" |
15 #include "remoting/protocol/rtp_video_reader.h" | 15 #include "remoting/protocol/rtp_video_reader.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 using net::IOBuffer; | 18 using net::IOBuffer; |
19 using std::vector; | 19 using std::vector; |
20 | 20 |
21 namespace remoting { | 21 namespace remoting { |
22 namespace protocol { | 22 namespace protocol { |
23 | 23 |
24 class RtpVideoReaderTest : public testing::Test, | 24 class RtpVideoReaderTest : public testing::Test, |
25 public VideoStub { | 25 public VideoStub { |
26 public: | 26 public: |
27 // VideoStub interface. | 27 // VideoStub interface. |
28 virtual void ProcessVideoPacket(const VideoPacket* video_packet, | 28 virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet, |
29 const base::Closure& done) { | 29 const base::Closure& done) { |
30 received_packets_.push_back(VideoPacket()); | 30 received_packets_.push_back(VideoPacket()); |
31 received_packets_.back() = *video_packet; | 31 received_packets_.back() = *video_packet; |
32 done.Run(); | 32 if (!done.is_null()) |
| 33 done.Run(); |
33 } | 34 } |
34 | 35 |
35 virtual int GetPendingPackets() { | 36 virtual int GetPendingPackets() { |
36 return 0; | 37 return 0; |
37 } | 38 } |
38 | 39 |
39 protected: | 40 protected: |
40 struct FragmentInfo { | 41 struct FragmentInfo { |
41 int sequence_number; | 42 int sequence_number; |
42 int timestamp; | 43 int timestamp; |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 370 |
370 ExpectedPacket expected[] = { | 371 ExpectedPacket expected[] = { |
371 { 123, VideoPacket::FIRST_PACKET | VideoPacket::LAST_PACKET, 0, 30 }, | 372 { 123, VideoPacket::FIRST_PACKET | VideoPacket::LAST_PACKET, 0, 30 }, |
372 { 223, VideoPacket::FIRST_PACKET | VideoPacket::LAST_PACKET, 40, 50 }, | 373 { 223, VideoPacket::FIRST_PACKET | VideoPacket::LAST_PACKET, 40, 50 }, |
373 }; | 374 }; |
374 CheckResults(expected, arraysize(expected)); | 375 CheckResults(expected, arraysize(expected)); |
375 } | 376 } |
376 | 377 |
377 } // namespace protocol | 378 } // namespace protocol |
378 } // namespace remoting | 379 } // namespace remoting |
OLD | NEW |