OLD | NEW |
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 key_pair_ = RsaKeyPair::FromString(key_base64); | 68 key_pair_ = RsaKeyPair::FromString(key_base64); |
69 ASSERT_TRUE(key_pair_.get()); | 69 ASSERT_TRUE(key_pair_.get()); |
70 } | 70 } |
71 | 71 |
72 void RunChannelAuth(bool expected_fail) { | 72 void RunChannelAuth(bool expected_fail) { |
73 client_fake_socket_.reset(new FakeStreamSocket()); | 73 client_fake_socket_.reset(new FakeStreamSocket()); |
74 host_fake_socket_.reset(new FakeStreamSocket()); | 74 host_fake_socket_.reset(new FakeStreamSocket()); |
75 client_fake_socket_->PairWith(host_fake_socket_.get()); | 75 client_fake_socket_->PairWith(host_fake_socket_.get()); |
76 | 76 |
77 client_auth_->SecureAndAuthenticate( | 77 client_auth_->SecureAndAuthenticate( |
78 client_fake_socket_.PassAs<net::StreamSocket>(), | 78 client_fake_socket_.Pass(), |
79 base::Bind(&SslHmacChannelAuthenticatorTest::OnClientConnected, | 79 base::Bind(&SslHmacChannelAuthenticatorTest::OnClientConnected, |
80 base::Unretained(this))); | 80 base::Unretained(this))); |
81 | 81 |
82 host_auth_->SecureAndAuthenticate( | 82 host_auth_->SecureAndAuthenticate( |
83 host_fake_socket_.PassAs<net::StreamSocket>(), | 83 host_fake_socket_.Pass(), |
84 base::Bind(&SslHmacChannelAuthenticatorTest::OnHostConnected, | 84 base::Bind(&SslHmacChannelAuthenticatorTest::OnHostConnected, |
85 base::Unretained(this), std::string("ref argument value"))); | 85 base::Unretained(this), std::string("ref argument value"))); |
86 | 86 |
87 // Expect two callbacks to be called - the client callback and the host | 87 // Expect two callbacks to be called - the client callback and the host |
88 // callback. | 88 // callback. |
89 int callback_counter = 2; | 89 int callback_counter = 2; |
90 | 90 |
91 if (expected_fail) { | 91 if (expected_fail) { |
92 EXPECT_CALL(client_callback_, OnDone(net::ERR_FAILED, NULL)) | 92 EXPECT_CALL(client_callback_, OnDone(net::ERR_FAILED, NULL)) |
93 .WillOnce(QuitThreadOnCounter(&callback_counter)); | 93 .WillOnce(QuitThreadOnCounter(&callback_counter)); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 host_auth_ = SslHmacChannelAuthenticator::CreateForHost( | 170 host_auth_ = SslHmacChannelAuthenticator::CreateForHost( |
171 host_cert_, key_pair_, kTestSharedSecret); | 171 host_cert_, key_pair_, kTestSharedSecret); |
172 | 172 |
173 RunChannelAuth(true); | 173 RunChannelAuth(true); |
174 | 174 |
175 ASSERT_TRUE(host_socket_.get() == NULL); | 175 ASSERT_TRUE(host_socket_.get() == NULL); |
176 } | 176 } |
177 | 177 |
178 } // namespace protocol | 178 } // namespace protocol |
179 } // namespace remoting | 179 } // namespace remoting |
OLD | NEW |