| 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 #ifndef REMOTING_PROTOCOL_AUTHENTICATOR_TEST_BASE_H_ | 5 #ifndef REMOTING_PROTOCOL_AUTHENTICATOR_TEST_BASE_H_ |
| 6 #define REMOTING_PROTOCOL_AUTHENTICATOR_TEST_BASE_H_ | 6 #define REMOTING_PROTOCOL_AUTHENTICATOR_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace crypto { | |
| 16 class RSAPrivateKey; | |
| 17 } // namespace crypto | |
| 18 | |
| 19 namespace net { | 15 namespace net { |
| 20 class StreamSocket; | 16 class StreamSocket; |
| 21 } // namespace net | 17 } // namespace net |
| 22 | 18 |
| 23 namespace remoting { | 19 namespace remoting { |
| 24 namespace protocol { | 20 namespace protocol { |
| 25 | 21 |
| 26 class Authenticator; | 22 class Authenticator; |
| 27 class ChannelAuthenticator; | 23 class ChannelAuthenticator; |
| 28 class FakeSocket; | 24 class FakeSocket; |
| 25 class KeyPair; |
| 29 | 26 |
| 30 class AuthenticatorTestBase : public testing::Test { | 27 class AuthenticatorTestBase : public testing::Test { |
| 31 public: | 28 public: |
| 32 AuthenticatorTestBase(); | 29 AuthenticatorTestBase(); |
| 33 virtual ~AuthenticatorTestBase(); | 30 virtual ~AuthenticatorTestBase(); |
| 34 | 31 |
| 35 protected: | 32 protected: |
| 36 class MockChannelDoneCallback { | 33 class MockChannelDoneCallback { |
| 37 public: | 34 public: |
| 38 MockChannelDoneCallback(); | 35 MockChannelDoneCallback(); |
| 39 ~MockChannelDoneCallback(); | 36 ~MockChannelDoneCallback(); |
| 40 MOCK_METHOD1(OnDone, void(net::Error error)); | 37 MOCK_METHOD1(OnDone, void(net::Error error)); |
| 41 }; | 38 }; |
| 42 | 39 |
| 43 virtual void SetUp() OVERRIDE; | 40 virtual void SetUp() OVERRIDE; |
| 44 void RunAuthExchange(); | 41 void RunAuthExchange(); |
| 45 void RunChannelAuth(bool expected_fail); | 42 void RunChannelAuth(bool expected_fail); |
| 46 | 43 |
| 47 void OnHostConnected(net::Error error, | 44 void OnHostConnected(net::Error error, |
| 48 scoped_ptr<net::StreamSocket> socket); | 45 scoped_ptr<net::StreamSocket> socket); |
| 49 void OnClientConnected(net::Error error, | 46 void OnClientConnected(net::Error error, |
| 50 scoped_ptr<net::StreamSocket> socket); | 47 scoped_ptr<net::StreamSocket> socket); |
| 51 | 48 |
| 52 MessageLoop message_loop_; | 49 MessageLoop message_loop_; |
| 53 | 50 |
| 54 scoped_ptr<crypto::RSAPrivateKey> private_key_; | 51 scoped_ptr<KeyPair> key_pair_; |
| 55 std::string host_cert_; | 52 std::string host_cert_; |
| 56 scoped_ptr<Authenticator> host_; | 53 scoped_ptr<Authenticator> host_; |
| 57 scoped_ptr<Authenticator> client_; | 54 scoped_ptr<Authenticator> client_; |
| 58 scoped_ptr<FakeSocket> client_fake_socket_; | 55 scoped_ptr<FakeSocket> client_fake_socket_; |
| 59 scoped_ptr<FakeSocket> host_fake_socket_; | 56 scoped_ptr<FakeSocket> host_fake_socket_; |
| 60 scoped_ptr<ChannelAuthenticator> client_auth_; | 57 scoped_ptr<ChannelAuthenticator> client_auth_; |
| 61 scoped_ptr<ChannelAuthenticator> host_auth_; | 58 scoped_ptr<ChannelAuthenticator> host_auth_; |
| 62 MockChannelDoneCallback client_callback_; | 59 MockChannelDoneCallback client_callback_; |
| 63 MockChannelDoneCallback host_callback_; | 60 MockChannelDoneCallback host_callback_; |
| 64 scoped_ptr<net::StreamSocket> client_socket_; | 61 scoped_ptr<net::StreamSocket> client_socket_; |
| 65 scoped_ptr<net::StreamSocket> host_socket_; | 62 scoped_ptr<net::StreamSocket> host_socket_; |
| 66 | 63 |
| 67 DISALLOW_COPY_AND_ASSIGN(AuthenticatorTestBase); | 64 DISALLOW_COPY_AND_ASSIGN(AuthenticatorTestBase); |
| 68 }; | 65 }; |
| 69 | 66 |
| 70 } // namespace protocol | 67 } // namespace protocol |
| 71 } // namespace remoting | 68 } // namespace remoting |
| 72 | 69 |
| 73 #endif // REMOTING_PROTOCOL_AUTHENTICATOR_TEST_BASE_H_ | 70 #endif // REMOTING_PROTOCOL_AUTHENTICATOR_TEST_BASE_H_ |
| OLD | NEW |