Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(589)

Side by Side Diff: remoting/protocol/v2_authenticator_unittest.cc

Issue 12316083: Move HostKeyPair into protocol::KeyPair. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/protocol/v2_authenticator.cc ('k') | remoting/remoting.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/protocol/authenticator_test_base.h" 10 #include "remoting/protocol/authenticator_test_base.h"
10 #include "remoting/protocol/channel_authenticator.h" 11 #include "remoting/protocol/channel_authenticator.h"
11 #include "remoting/protocol/connection_tester.h" 12 #include "remoting/protocol/connection_tester.h"
12 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" 15 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
15 16
16 using testing::_; 17 using testing::_;
17 using testing::DeleteArg; 18 using testing::DeleteArg;
18 using testing::SaveArg; 19 using testing::SaveArg;
(...skipping 15 matching lines...) Expand all
34 public: 35 public:
35 V2AuthenticatorTest() { 36 V2AuthenticatorTest() {
36 } 37 }
37 virtual ~V2AuthenticatorTest() { 38 virtual ~V2AuthenticatorTest() {
38 } 39 }
39 40
40 protected: 41 protected:
41 void InitAuthenticators(const std::string& client_secret, 42 void InitAuthenticators(const std::string& client_secret,
42 const std::string& host_secret) { 43 const std::string& host_secret) {
43 host_ = V2Authenticator::CreateForHost( 44 host_ = V2Authenticator::CreateForHost(
44 host_cert_, *private_key_, host_secret, Authenticator::WAITING_MESSAGE); 45 host_cert_, key_pair_, host_secret,
46 Authenticator::WAITING_MESSAGE);
45 client_ = V2Authenticator::CreateForClient( 47 client_ = V2Authenticator::CreateForClient(
46 client_secret, Authenticator::MESSAGE_READY); 48 client_secret, Authenticator::MESSAGE_READY);
47 } 49 }
48 50
49 DISALLOW_COPY_AND_ASSIGN(V2AuthenticatorTest); 51 DISALLOW_COPY_AND_ASSIGN(V2AuthenticatorTest);
50 }; 52 };
51 53
52 TEST_F(V2AuthenticatorTest, SuccessfulAuth) { 54 TEST_F(V2AuthenticatorTest, SuccessfulAuth) {
53 ASSERT_NO_FATAL_FAILURE( 55 ASSERT_NO_FATAL_FAILURE(
54 InitAuthenticators(kTestSharedSecret, kTestSharedSecret)); 56 InitAuthenticators(kTestSharedSecret, kTestSharedSecret));
(...skipping 30 matching lines...) Expand all
85 ASSERT_TRUE(message.get()); 87 ASSERT_TRUE(message.get());
86 88
87 ASSERT_EQ(Authenticator::WAITING_MESSAGE, client_->state()); 89 ASSERT_EQ(Authenticator::WAITING_MESSAGE, client_->state());
88 host_->ProcessMessage(message.get(), base::Bind(&base::DoNothing)); 90 host_->ProcessMessage(message.get(), base::Bind(&base::DoNothing));
89 // This assumes that V2Authenticator::ProcessMessage runs synchronously. 91 // This assumes that V2Authenticator::ProcessMessage runs synchronously.
90 ASSERT_EQ(Authenticator::REJECTED, host_->state()); 92 ASSERT_EQ(Authenticator::REJECTED, host_->state());
91 } 93 }
92 94
93 } // namespace protocol 95 } // namespace protocol
94 } // namespace remoting 96 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/v2_authenticator.cc ('k') | remoting/remoting.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698