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

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

Issue 2104363004: Remove remaining calls to deprecated MessageLoop methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR gab Created 4 years, 5 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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/single_thread_task_runner.h"
13 #include "base/test/test_timeouts.h" 14 #include "base/test/test_timeouts.h"
14 #include "remoting/protocol/protocol_mock_objects.h" 15 #include "remoting/protocol/protocol_mock_objects.h"
15 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 using ::testing::_; 19 using ::testing::_;
19 using ::testing::AnyNumber; 20 using ::testing::AnyNumber;
20 using ::testing::AtMost; 21 using ::testing::AtMost;
21 using ::testing::InvokeWithoutArgs; 22 using ::testing::InvokeWithoutArgs;
22 23
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 base::RunLoop().RunUntilIdle(); 59 base::RunLoop().RunUntilIdle();
59 } 60 }
60 61
61 TEST_F(MonitoredVideoStubTest, OnChannelDisconnected) { 62 TEST_F(MonitoredVideoStubTest, OnChannelDisconnected) {
62 EXPECT_CALL(*this, OnVideoChannelStatus(true)); 63 EXPECT_CALL(*this, OnVideoChannelStatus(true));
63 monitor_->ProcessVideoPacket(std::move(packet_), base::Closure()); 64 monitor_->ProcessVideoPacket(std::move(packet_), base::Closure());
64 65
65 EXPECT_CALL(*this, OnVideoChannelStatus(false)) 66 EXPECT_CALL(*this, OnVideoChannelStatus(false))
66 .WillOnce( 67 .WillOnce(
67 InvokeWithoutArgs(&message_loop_, &base::MessageLoop::QuitWhenIdle)); 68 InvokeWithoutArgs(&message_loop_, &base::MessageLoop::QuitWhenIdle));
68 message_loop_.Run(); 69 base::RunLoop().Run();
69 } 70 }
70 71
71 TEST_F(MonitoredVideoStubTest, OnChannelStayConnected) { 72 TEST_F(MonitoredVideoStubTest, OnChannelStayConnected) {
72 // Verify no extra connected events are fired when packets are received 73 // Verify no extra connected events are fired when packets are received
73 // frequently 74 // frequently
74 EXPECT_CALL(*this, OnVideoChannelStatus(true)); 75 EXPECT_CALL(*this, OnVideoChannelStatus(true));
75 // On slow machines, the connectivity check timer may fire before the test 76 // On slow machines, the connectivity check timer may fire before the test
76 // finishes, so we expect to see at most one transition to not ready. 77 // finishes, so we expect to see at most one transition to not ready.
77 EXPECT_CALL(*this, OnVideoChannelStatus(false)).Times(AtMost(1)); 78 EXPECT_CALL(*this, OnVideoChannelStatus(false)).Times(AtMost(1));
78 79
79 monitor_->ProcessVideoPacket(std::move(packet_), base::Closure()); 80 monitor_->ProcessVideoPacket(std::move(packet_), base::Closure());
80 monitor_->ProcessVideoPacket(std::move(packet_), base::Closure()); 81 monitor_->ProcessVideoPacket(std::move(packet_), base::Closure());
81 base::RunLoop().RunUntilIdle(); 82 base::RunLoop().RunUntilIdle();
82 } 83 }
83 84
84 TEST_F(MonitoredVideoStubTest, OnChannelStayDisconnected) { 85 TEST_F(MonitoredVideoStubTest, OnChannelStayDisconnected) {
85 // Verify no extra disconnected events are fired. 86 // Verify no extra disconnected events are fired.
86 EXPECT_CALL(*this, OnVideoChannelStatus(true)).Times(1); 87 EXPECT_CALL(*this, OnVideoChannelStatus(true)).Times(1);
87 EXPECT_CALL(*this, OnVideoChannelStatus(false)).Times(1); 88 EXPECT_CALL(*this, OnVideoChannelStatus(false)).Times(1);
88 89
89 monitor_->ProcessVideoPacket(std::move(packet_), base::Closure()); 90 monitor_->ProcessVideoPacket(std::move(packet_), base::Closure());
90 91
91 message_loop_.PostDelayedTask( 92 message_loop_.task_runner()->PostDelayedTask(
92 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), 93 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
93 // The delay should be much greater than |kTestOverrideDelayMilliseconds|. 94 // The delay should be much greater than |kTestOverrideDelayMilliseconds|.
94 TestTimeouts::tiny_timeout()); 95 TestTimeouts::tiny_timeout());
95 message_loop_.Run(); 96 base::RunLoop().Run();
96 } 97 }
97 98
98 } // namespace protocol 99 } // namespace protocol
99 } // namespace remoting 100 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/connection_tester.cc ('k') | remoting/protocol/negotiating_authenticator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698