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/v2_authenticator.h" | 5 #include "remoting/protocol/v2_authenticator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
9 #include "remoting/base/rsa_key_pair.h" | 9 #include "remoting/base/rsa_key_pair.h" |
10 #include "remoting/protocol/authenticator_test_base.h" | 10 #include "remoting/protocol/authenticator_test_base.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 const char kTestSharedSecret[] = "1234-1234-5678"; | 29 const char kTestSharedSecret[] = "1234-1234-5678"; |
30 const char kTestSharedSecretBad[] = "0000-0000-0001"; | 30 const char kTestSharedSecretBad[] = "0000-0000-0001"; |
31 | 31 |
32 } // namespace | 32 } // namespace |
33 | 33 |
34 class V2AuthenticatorTest : public AuthenticatorTestBase { | 34 class V2AuthenticatorTest : public AuthenticatorTestBase { |
35 public: | 35 public: |
36 V2AuthenticatorTest() { | 36 V2AuthenticatorTest() { |
37 } | 37 } |
38 virtual ~V2AuthenticatorTest() { | 38 ~V2AuthenticatorTest() override {} |
39 } | |
40 | 39 |
41 protected: | 40 protected: |
42 void InitAuthenticators(const std::string& client_secret, | 41 void InitAuthenticators(const std::string& client_secret, |
43 const std::string& host_secret) { | 42 const std::string& host_secret) { |
44 host_ = V2Authenticator::CreateForHost( | 43 host_ = V2Authenticator::CreateForHost( |
45 host_cert_, key_pair_, host_secret, | 44 host_cert_, key_pair_, host_secret, |
46 Authenticator::WAITING_MESSAGE); | 45 Authenticator::WAITING_MESSAGE); |
47 client_ = V2Authenticator::CreateForClient( | 46 client_ = V2Authenticator::CreateForClient( |
48 client_secret, Authenticator::MESSAGE_READY); | 47 client_secret, Authenticator::MESSAGE_READY); |
49 } | 48 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 ASSERT_TRUE(message.get()); | 86 ASSERT_TRUE(message.get()); |
88 | 87 |
89 ASSERT_EQ(Authenticator::WAITING_MESSAGE, client_->state()); | 88 ASSERT_EQ(Authenticator::WAITING_MESSAGE, client_->state()); |
90 host_->ProcessMessage(message.get(), base::Bind(&base::DoNothing)); | 89 host_->ProcessMessage(message.get(), base::Bind(&base::DoNothing)); |
91 // This assumes that V2Authenticator::ProcessMessage runs synchronously. | 90 // This assumes that V2Authenticator::ProcessMessage runs synchronously. |
92 ASSERT_EQ(Authenticator::REJECTED, host_->state()); | 91 ASSERT_EQ(Authenticator::REJECTED, host_->state()); |
93 } | 92 } |
94 | 93 |
95 } // namespace protocol | 94 } // namespace protocol |
96 } // namespace remoting | 95 } // namespace remoting |
OLD | NEW |