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

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

Issue 1394803004: Don't use base::MessageLoop::{Quit,QuitClosure} in remoting/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/ssl_hmac_channel_authenticator.h" 5 #include "remoting/protocol/ssl_hmac_channel_authenticator.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 26 matching lines...) Expand all
37 37
38 class MockChannelDoneCallback { 38 class MockChannelDoneCallback {
39 public: 39 public:
40 MOCK_METHOD2(OnDone, void(int error, P2PStreamSocket* socket)); 40 MOCK_METHOD2(OnDone, void(int error, P2PStreamSocket* socket));
41 }; 41 };
42 42
43 ACTION_P(QuitThreadOnCounter, counter) { 43 ACTION_P(QuitThreadOnCounter, counter) {
44 --(*counter); 44 --(*counter);
45 EXPECT_GE(*counter, 0); 45 EXPECT_GE(*counter, 0);
46 if (*counter == 0) 46 if (*counter == 0)
47 base::MessageLoop::current()->Quit(); 47 base::MessageLoop::current()->QuitWhenIdle();
48 } 48 }
49 49
50 } // namespace 50 } // namespace
51 51
52 class SslHmacChannelAuthenticatorTest : public testing::Test { 52 class SslHmacChannelAuthenticatorTest : public testing::Test {
53 public: 53 public:
54 SslHmacChannelAuthenticatorTest() {} 54 SslHmacChannelAuthenticatorTest() {}
55 ~SslHmacChannelAuthenticatorTest() override {} 55 ~SslHmacChannelAuthenticatorTest() override {}
56 56
57 protected: 57 protected:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 EXPECT_CALL(host_callback_, OnDone(expected_host_error, nullptr)) 101 EXPECT_CALL(host_callback_, OnDone(expected_host_error, nullptr))
102 .WillOnce(QuitThreadOnCounter(&callback_counter)); 102 .WillOnce(QuitThreadOnCounter(&callback_counter));
103 } else { 103 } else {
104 EXPECT_CALL(host_callback_, OnDone(net::OK, NotNull())) 104 EXPECT_CALL(host_callback_, OnDone(net::OK, NotNull()))
105 .WillOnce(QuitThreadOnCounter(&callback_counter)); 105 .WillOnce(QuitThreadOnCounter(&callback_counter));
106 } 106 }
107 107
108 // Ensure that .Run() does not run unbounded if the callbacks are never 108 // Ensure that .Run() does not run unbounded if the callbacks are never
109 // called. 109 // called.
110 base::Timer shutdown_timer(false, false); 110 base::Timer shutdown_timer(false, false);
111 shutdown_timer.Start(FROM_HERE, 111 shutdown_timer.Start(FROM_HERE, TestTimeouts::action_timeout(),
112 TestTimeouts::action_timeout(), 112 base::MessageLoop::QuitWhenIdleClosure());
113 base::MessageLoop::QuitClosure());
114 message_loop_.Run(); 113 message_loop_.Run();
115 } 114 }
116 115
117 void OnHostConnected(const std::string& ref_argument, 116 void OnHostConnected(const std::string& ref_argument,
118 int error, 117 int error,
119 scoped_ptr<P2PStreamSocket> socket) { 118 scoped_ptr<P2PStreamSocket> socket) {
120 // Try deleting the authenticator and verify that this doesn't destroy 119 // Try deleting the authenticator and verify that this doesn't destroy
121 // reference parameters. 120 // reference parameters.
122 host_auth_.reset(); 121 host_auth_.reset();
123 DCHECK_EQ(ref_argument, "ref argument value"); 122 DCHECK_EQ(ref_argument, "ref argument value");
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 host_auth_ = SslHmacChannelAuthenticator::CreateForHost( 193 host_auth_ = SslHmacChannelAuthenticator::CreateForHost(
195 host_cert_, key_pair_, kTestSharedSecret); 194 host_cert_, key_pair_, kTestSharedSecret);
196 195
197 RunChannelAuth(net::ERR_CERT_INVALID, net::ERR_CONNECTION_CLOSED); 196 RunChannelAuth(net::ERR_CERT_INVALID, net::ERR_CONNECTION_CLOSED);
198 197
199 ASSERT_TRUE(host_socket_.get() == nullptr); 198 ASSERT_TRUE(host_socket_.get() == nullptr);
200 } 199 }
201 200
202 } // namespace protocol 201 } // namespace protocol
203 } // namespace remoting 202 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/pseudotcp_adapter_unittest.cc ('k') | remoting/signaling/iq_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698