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

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

Issue 14314026: remoting: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 | Annotate | Revision Log
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 "base/base64.h" 7 #include "base/base64.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 12 matching lines...) Expand all
23 23
24 namespace remoting { 24 namespace remoting {
25 namespace protocol { 25 namespace protocol {
26 26
27 namespace { 27 namespace {
28 28
29 ACTION_P(QuitThreadOnCounter, counter) { 29 ACTION_P(QuitThreadOnCounter, counter) {
30 --(*counter); 30 --(*counter);
31 EXPECT_GE(*counter, 0); 31 EXPECT_GE(*counter, 0);
32 if (*counter == 0) 32 if (*counter == 0)
33 MessageLoop::current()->Quit(); 33 base::MessageLoop::current()->Quit();
34 } 34 }
35 35
36 } // namespace 36 } // namespace
37 37
38 AuthenticatorTestBase::MockChannelDoneCallback::MockChannelDoneCallback() {} 38 AuthenticatorTestBase::MockChannelDoneCallback::MockChannelDoneCallback() {}
39 39
40 AuthenticatorTestBase::MockChannelDoneCallback::~MockChannelDoneCallback() {} 40 AuthenticatorTestBase::MockChannelDoneCallback::~MockChannelDoneCallback() {}
41 41
42 AuthenticatorTestBase::AuthenticatorTestBase() {} 42 AuthenticatorTestBase::AuthenticatorTestBase() {}
43 43
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 EXPECT_CALL(host_callback_, OnDone(net::ERR_FAILED)) 112 EXPECT_CALL(host_callback_, OnDone(net::ERR_FAILED))
113 .WillOnce(QuitThreadOnCounter(&callback_counter)); 113 .WillOnce(QuitThreadOnCounter(&callback_counter));
114 } else { 114 } else {
115 EXPECT_CALL(host_callback_, OnDone(net::OK)) 115 EXPECT_CALL(host_callback_, OnDone(net::OK))
116 .WillOnce(QuitThreadOnCounter(&callback_counter)); 116 .WillOnce(QuitThreadOnCounter(&callback_counter));
117 } 117 }
118 118
119 // Ensure that .Run() does not run unbounded if the callbacks are never 119 // Ensure that .Run() does not run unbounded if the callbacks are never
120 // called. 120 // called.
121 base::Timer shutdown_timer(false, false); 121 base::Timer shutdown_timer(false, false);
122 shutdown_timer.Start(FROM_HERE, TestTimeouts::action_timeout(), 122 shutdown_timer.Start(FROM_HERE,
123 MessageLoop::QuitClosure()); 123 TestTimeouts::action_timeout(),
124 base::MessageLoop::QuitClosure());
124 message_loop_.Run(); 125 message_loop_.Run();
125 shutdown_timer.Stop(); 126 shutdown_timer.Stop();
126 127
127 testing::Mock::VerifyAndClearExpectations(&client_callback_); 128 testing::Mock::VerifyAndClearExpectations(&client_callback_);
128 testing::Mock::VerifyAndClearExpectations(&host_callback_); 129 testing::Mock::VerifyAndClearExpectations(&host_callback_);
129 130
130 if (!expected_fail) { 131 if (!expected_fail) {
131 ASSERT_TRUE(client_socket_.get() != NULL); 132 ASSERT_TRUE(client_socket_.get() != NULL);
132 ASSERT_TRUE(host_socket_.get() != NULL); 133 ASSERT_TRUE(host_socket_.get() != NULL);
133 } 134 }
134 } 135 }
135 136
136 void AuthenticatorTestBase::OnHostConnected( 137 void AuthenticatorTestBase::OnHostConnected(
137 net::Error error, 138 net::Error error,
138 scoped_ptr<net::StreamSocket> socket) { 139 scoped_ptr<net::StreamSocket> socket) {
139 host_callback_.OnDone(error); 140 host_callback_.OnDone(error);
140 host_socket_ = socket.Pass(); 141 host_socket_ = socket.Pass();
141 } 142 }
142 143
143 void AuthenticatorTestBase::OnClientConnected( 144 void AuthenticatorTestBase::OnClientConnected(
144 net::Error error, 145 net::Error error,
145 scoped_ptr<net::StreamSocket> socket) { 146 scoped_ptr<net::StreamSocket> socket) {
146 client_callback_.OnDone(error); 147 client_callback_.OnDone(error);
147 client_socket_ = socket.Pass(); 148 client_socket_ = socket.Pass();
148 } 149 }
149 150
150 } // namespace protocol 151 } // namespace protocol
151 } // namespace remoting 152 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/authenticator_test_base.h ('k') | remoting/protocol/buffered_socket_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698