Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: remoting/protocol/monitored_video_stub_unittest.cc

Issue 850983002: Implement video frame acknowledgements in the chromoting protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
11 #include "remoting/protocol/protocol_mock_objects.h" 11 #include "remoting/protocol/protocol_mock_objects.h"
12 #include "testing/gmock/include/gmock/gmock.h" 12 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 using ::testing::_; 15 using ::testing::_;
16 using ::testing::AnyNumber; 16 using ::testing::AnyNumber;
17 using ::testing::AtMost; 17 using ::testing::AtMost;
18 using ::testing::InvokeWithoutArgs; 18 using ::testing::InvokeWithoutArgs;
19 19
20 namespace remoting { 20 namespace remoting {
21 namespace protocol { 21 namespace protocol {
22 22
23 static const int64 kTestOverrideDelayMilliseconds = 1; 23 static const int64 kTestOverrideDelayMilliseconds = 1;
24 24
25 class MonitoredVideoStubTest : public testing::Test { 25 class MonitoredVideoStubTest : public testing::Test {
26 protected: 26 protected:
27 virtual void SetUp() override { 27 virtual void SetUp() override {
28 packet_.reset(new VideoPacket()); 28 packet_.reset(new VideoPacket());
29 monitor_.reset(new MonitoredVideoStub( 29 monitor_.reset(new MonitoredVideoStub(
30 &video_stub_, 30 &video_sender_,
31 base::TimeDelta::FromMilliseconds(kTestOverrideDelayMilliseconds), 31 base::TimeDelta::FromMilliseconds(kTestOverrideDelayMilliseconds),
32 base::Bind( 32 base::Bind(
33 &MonitoredVideoStubTest::OnVideoChannelStatus, 33 &MonitoredVideoStubTest::OnVideoChannelStatus,
34 base::Unretained(this)))); 34 base::Unretained(this))));
35 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _)).Times(AnyNumber()); 35 EXPECT_CALL(video_sender_, ProcessVideoPacketPtr(_, _)).Times(AnyNumber());
36 } 36 }
37 37
38 MOCK_METHOD1(OnVideoChannelStatus, void(bool connected)); 38 MOCK_METHOD1(OnVideoChannelStatus, void(bool connected));
39 39
40 base::MessageLoop message_loop_; 40 base::MessageLoop message_loop_;
41 MockVideoStub video_stub_; 41 MockVideoSender video_sender_;
42 42
43 scoped_ptr<MonitoredVideoStub> monitor_; 43 scoped_ptr<MonitoredVideoStub> monitor_;
44 scoped_ptr<VideoPacket> packet_; 44 scoped_ptr<VideoPacket> packet_;
45 base::OneShotTimer<MonitoredVideoStubTest> timer_end_test_; 45 base::OneShotTimer<MonitoredVideoStubTest> timer_end_test_;
46 }; 46 };
47 47
48 TEST_F(MonitoredVideoStubTest, OnChannelConnected) { 48 TEST_F(MonitoredVideoStubTest, OnChannelConnected) {
49 EXPECT_CALL(*this, OnVideoChannelStatus(true)); 49 EXPECT_CALL(*this, OnVideoChannelStatus(true));
50 // On slow machines, the connectivity check timer may fire before the test 50 // On slow machines, the connectivity check timer may fire before the test
51 // finishes, so we expect to see at most one transition to not ready. 51 // finishes, so we expect to see at most one transition to not ready.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 message_loop_.PostDelayedTask( 89 message_loop_.PostDelayedTask(
90 FROM_HERE, 90 FROM_HERE,
91 base::MessageLoop::QuitClosure(), 91 base::MessageLoop::QuitClosure(),
92 // The delay should be much greater than |kTestOverrideDelayMilliseconds|. 92 // The delay should be much greater than |kTestOverrideDelayMilliseconds|.
93 TestTimeouts::tiny_timeout()); 93 TestTimeouts::tiny_timeout());
94 message_loop_.Run(); 94 message_loop_.Run();
95 } 95 }
96 96
97 } // namespace protocol 97 } // namespace protocol
98 } // namespace remoting 98 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698