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/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/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/test/test_timeouts.h" | 11 #include "base/test/test_timeouts.h" |
12 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
14 #include "net/base/test_data_directory.h" | 14 #include "net/base/test_data_directory.h" |
15 #include "remoting/base/rsa_key_pair.h" | 15 #include "remoting/base/rsa_key_pair.h" |
16 #include "remoting/protocol/authenticator.h" | 16 #include "remoting/protocol/authenticator.h" |
17 #include "remoting/protocol/channel_authenticator.h" | 17 #include "remoting/protocol/channel_authenticator.h" |
18 #include "remoting/protocol/fake_session.h" | 18 #include "remoting/protocol/fake_stream_socket.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" | 20 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
21 | 21 |
22 using testing::_; | 22 using testing::_; |
23 using testing::SaveArg; | 23 using testing::SaveArg; |
24 | 24 |
25 namespace remoting { | 25 namespace remoting { |
26 namespace protocol { | 26 namespace protocol { |
27 | 27 |
28 namespace { | 28 namespace { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 ASSERT_NE(Authenticator::MESSAGE_READY, sender->state()); | 104 ASSERT_NE(Authenticator::MESSAGE_READY, sender->state()); |
105 | 105 |
106 ASSERT_EQ(Authenticator::WAITING_MESSAGE, receiver->state()); | 106 ASSERT_EQ(Authenticator::WAITING_MESSAGE, receiver->state()); |
107 receiver->ProcessMessage(message.get(), base::Bind( | 107 receiver->ProcessMessage(message.get(), base::Bind( |
108 &AuthenticatorTestBase::ContinueAuthExchangeWith, | 108 &AuthenticatorTestBase::ContinueAuthExchangeWith, |
109 base::Unretained(receiver), base::Unretained(sender), | 109 base::Unretained(receiver), base::Unretained(sender), |
110 receiver->started(), sender->started())); | 110 receiver->started(), sender->started())); |
111 } | 111 } |
112 | 112 |
113 void AuthenticatorTestBase::RunChannelAuth(bool expected_fail) { | 113 void AuthenticatorTestBase::RunChannelAuth(bool expected_fail) { |
114 client_fake_socket_.reset(new FakeSocket()); | 114 client_fake_socket_.reset(new FakeStreamSocket()); |
115 host_fake_socket_.reset(new FakeSocket()); | 115 host_fake_socket_.reset(new FakeStreamSocket()); |
116 client_fake_socket_->PairWith(host_fake_socket_.get()); | 116 client_fake_socket_->PairWith(host_fake_socket_.get()); |
117 | 117 |
118 client_auth_->SecureAndAuthenticate( | 118 client_auth_->SecureAndAuthenticate( |
119 client_fake_socket_.PassAs<net::StreamSocket>(), | 119 client_fake_socket_.PassAs<net::StreamSocket>(), |
120 base::Bind(&AuthenticatorTestBase::OnClientConnected, | 120 base::Bind(&AuthenticatorTestBase::OnClientConnected, |
121 base::Unretained(this))); | 121 base::Unretained(this))); |
122 | 122 |
123 host_auth_->SecureAndAuthenticate( | 123 host_auth_->SecureAndAuthenticate( |
124 host_fake_socket_.PassAs<net::StreamSocket>(), | 124 host_fake_socket_.PassAs<net::StreamSocket>(), |
125 base::Bind(&AuthenticatorTestBase::OnHostConnected, | 125 base::Bind(&AuthenticatorTestBase::OnHostConnected, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 void AuthenticatorTestBase::OnClientConnected( | 167 void AuthenticatorTestBase::OnClientConnected( |
168 int error, | 168 int error, |
169 scoped_ptr<net::StreamSocket> socket) { | 169 scoped_ptr<net::StreamSocket> socket) { |
170 client_callback_.OnDone(error); | 170 client_callback_.OnDone(error); |
171 client_socket_ = socket.Pass(); | 171 client_socket_ = socket.Pass(); |
172 } | 172 } |
173 | 173 |
174 } // namespace protocol | 174 } // namespace protocol |
175 } // namespace remoting | 175 } // namespace remoting |
OLD | NEW |