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

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

Issue 2837863004: Use base::OneShotTimer instead of base::Timer(false, false)
Patch Set: rebase Created 3 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/authenticator_test_base.h" 5 #include "remoting/protocol/authenticator_test_base.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 if (expected_fail) { 138 if (expected_fail) {
139 EXPECT_CALL(host_callback_, OnDone(net::ERR_FAILED)) 139 EXPECT_CALL(host_callback_, OnDone(net::ERR_FAILED))
140 .WillOnce(QuitThreadOnCounter(&callback_counter)); 140 .WillOnce(QuitThreadOnCounter(&callback_counter));
141 } else { 141 } else {
142 EXPECT_CALL(host_callback_, OnDone(net::OK)) 142 EXPECT_CALL(host_callback_, OnDone(net::OK))
143 .WillOnce(QuitThreadOnCounter(&callback_counter)); 143 .WillOnce(QuitThreadOnCounter(&callback_counter));
144 } 144 }
145 145
146 // Ensure that .Run() does not run unbounded if the callbacks are never 146 // Ensure that .Run() does not run unbounded if the callbacks are never
147 // called. 147 // called.
148 base::Timer shutdown_timer(false, false); 148 base::OneShotTimer shutdown_timer;
149 shutdown_timer.Start(FROM_HERE, TestTimeouts::action_timeout(), 149 shutdown_timer.Start(FROM_HERE, TestTimeouts::action_timeout(),
150 base::MessageLoop::QuitWhenIdleClosure()); 150 base::MessageLoop::QuitWhenIdleClosure());
151 base::RunLoop().Run(); 151 base::RunLoop().Run();
152 shutdown_timer.Stop(); 152 shutdown_timer.Stop();
153 153
154 testing::Mock::VerifyAndClearExpectations(&client_callback_); 154 testing::Mock::VerifyAndClearExpectations(&client_callback_);
155 testing::Mock::VerifyAndClearExpectations(&host_callback_); 155 testing::Mock::VerifyAndClearExpectations(&host_callback_);
156 156
157 if (!expected_fail) { 157 if (!expected_fail) {
158 ASSERT_TRUE(client_socket_.get() != nullptr); 158 ASSERT_TRUE(client_socket_.get() != nullptr);
(...skipping 10 matching lines...) Expand all
169 169
170 void AuthenticatorTestBase::OnClientConnected( 170 void AuthenticatorTestBase::OnClientConnected(
171 int error, 171 int error,
172 std::unique_ptr<P2PStreamSocket> socket) { 172 std::unique_ptr<P2PStreamSocket> socket) {
173 client_callback_.OnDone(error); 173 client_callback_.OnDone(error);
174 client_socket_ = std::move(socket); 174 client_socket_ = std::move(socket);
175 } 175 }
176 176
177 } // namespace protocol 177 } // namespace protocol
178 } // namespace remoting 178 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/security_key/security_key_socket.cc ('k') | remoting/protocol/capture_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698