Enable _api_features.json to block APIs from service worker contexts.
[chromium-blink-merge.git] / remoting / protocol / authenticator_test_base.h
blob9b299db776c7864441f1774180c8b160b9c0b897
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
3 // found in the LICENSE file.
5 #ifndef REMOTING_PROTOCOL_AUTHENTICATOR_TEST_BASE_H_
6 #define REMOTING_PROTOCOL_AUTHENTICATOR_TEST_BASE_H_
8 #include <string>
10 #include "base/memory/ref_counted.h"
11 #include "base/message_loop/message_loop.h"
12 #include "net/base/net_errors.h"
13 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h"
16 namespace net {
17 class StreamSocket;
18 } // namespace net
20 namespace remoting {
22 class RsaKeyPair;
24 namespace protocol {
26 class Authenticator;
27 class ChannelAuthenticator;
28 class FakeSocket;
30 class AuthenticatorTestBase : public testing::Test {
31 public:
32 AuthenticatorTestBase();
33 virtual ~AuthenticatorTestBase();
35 protected:
36 class MockChannelDoneCallback {
37 public:
38 MockChannelDoneCallback();
39 ~MockChannelDoneCallback();
40 MOCK_METHOD1(OnDone, void(net::Error error));
43 static void ContinueAuthExchangeWith(Authenticator* sender,
44 Authenticator* receiver);
45 virtual void SetUp() OVERRIDE;
46 void RunAuthExchange();
47 void RunHostInitiatedAuthExchange();
48 void RunChannelAuth(bool expected_fail);
50 void OnHostConnected(net::Error error,
51 scoped_ptr<net::StreamSocket> socket);
52 void OnClientConnected(net::Error error,
53 scoped_ptr<net::StreamSocket> socket);
55 base::MessageLoop message_loop_;
57 scoped_refptr<RsaKeyPair> key_pair_;
58 std::string host_public_key_;
59 std::string host_cert_;
60 scoped_ptr<Authenticator> host_;
61 scoped_ptr<Authenticator> client_;
62 scoped_ptr<FakeSocket> client_fake_socket_;
63 scoped_ptr<FakeSocket> host_fake_socket_;
64 scoped_ptr<ChannelAuthenticator> client_auth_;
65 scoped_ptr<ChannelAuthenticator> host_auth_;
66 MockChannelDoneCallback client_callback_;
67 MockChannelDoneCallback host_callback_;
68 scoped_ptr<net::StreamSocket> client_socket_;
69 scoped_ptr<net::StreamSocket> host_socket_;
71 DISALLOW_COPY_AND_ASSIGN(AuthenticatorTestBase);
74 } // namespace protocol
75 } // namespace remoting
77 #endif // REMOTING_PROTOCOL_AUTHENTICATOR_TEST_BASE_H_