OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "remoting/protocol/monitored_video_stub.h" | 5 #include "remoting/protocol/monitored_video_stub.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/test/test_timeouts.h" | 9 #include "base/test/test_timeouts.h" |
10 #include "remoting/protocol/protocol_mock_objects.h" | 10 #include "remoting/protocol/protocol_mock_objects.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _)).Times(AnyNumber()); | 34 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _)).Times(AnyNumber()); |
35 } | 35 } |
36 | 36 |
37 MOCK_METHOD1(OnVideoChannelStatus, void(bool connected)); | 37 MOCK_METHOD1(OnVideoChannelStatus, void(bool connected)); |
38 | 38 |
39 base::MessageLoop message_loop_; | 39 base::MessageLoop message_loop_; |
40 MockVideoStub video_stub_; | 40 MockVideoStub video_stub_; |
41 | 41 |
42 scoped_ptr<MonitoredVideoStub> monitor_; | 42 scoped_ptr<MonitoredVideoStub> monitor_; |
43 scoped_ptr<VideoPacket> packet_; | 43 scoped_ptr<VideoPacket> packet_; |
44 base::OneShotTimer<MonitoredVideoStubTest> timer_end_test_; | 44 base::OneShotTimer timer_end_test_; |
45 }; | 45 }; |
46 | 46 |
47 TEST_F(MonitoredVideoStubTest, OnChannelConnected) { | 47 TEST_F(MonitoredVideoStubTest, OnChannelConnected) { |
48 EXPECT_CALL(*this, OnVideoChannelStatus(true)); | 48 EXPECT_CALL(*this, OnVideoChannelStatus(true)); |
49 // On slow machines, the connectivity check timer may fire before the test | 49 // On slow machines, the connectivity check timer may fire before the test |
50 // finishes, so we expect to see at most one transition to not ready. | 50 // finishes, so we expect to see at most one transition to not ready. |
51 EXPECT_CALL(*this, OnVideoChannelStatus(false)).Times(AtMost(1)); | 51 EXPECT_CALL(*this, OnVideoChannelStatus(false)).Times(AtMost(1)); |
52 | 52 |
53 monitor_->ProcessVideoPacket(packet_.Pass(), base::Closure()); | 53 monitor_->ProcessVideoPacket(packet_.Pass(), base::Closure()); |
54 base::RunLoop().RunUntilIdle(); | 54 base::RunLoop().RunUntilIdle(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 message_loop_.PostDelayedTask( | 88 message_loop_.PostDelayedTask( |
89 FROM_HERE, | 89 FROM_HERE, |
90 base::MessageLoop::QuitClosure(), | 90 base::MessageLoop::QuitClosure(), |
91 // The delay should be much greater than |kTestOverrideDelayMilliseconds|. | 91 // The delay should be much greater than |kTestOverrideDelayMilliseconds|. |
92 TestTimeouts::tiny_timeout()); | 92 TestTimeouts::tiny_timeout()); |
93 message_loop_.Run(); | 93 message_loop_.Run(); |
94 } | 94 } |
95 | 95 |
96 } // namespace protocol | 96 } // namespace protocol |
97 } // namespace remoting | 97 } // namespace remoting |
OLD | NEW |