| 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/protocol/authenticator_test_base.h" | 9 #include "remoting/protocol/authenticator_test_base.h" |
| 10 #include "remoting/protocol/channel_authenticator.h" | 10 #include "remoting/protocol/channel_authenticator.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 InitAuthenticators(kTestSharedSecret, kTestSharedSecret)); | 54 InitAuthenticators(kTestSharedSecret, kTestSharedSecret)); |
| 55 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); | 55 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); |
| 56 | 56 |
| 57 ASSERT_EQ(Authenticator::ACCEPTED, host_->state()); | 57 ASSERT_EQ(Authenticator::ACCEPTED, host_->state()); |
| 58 ASSERT_EQ(Authenticator::ACCEPTED, client_->state()); | 58 ASSERT_EQ(Authenticator::ACCEPTED, client_->state()); |
| 59 | 59 |
| 60 client_auth_ = client_->CreateChannelAuthenticator(); | 60 client_auth_ = client_->CreateChannelAuthenticator(); |
| 61 host_auth_ = host_->CreateChannelAuthenticator(); | 61 host_auth_ = host_->CreateChannelAuthenticator(); |
| 62 RunChannelAuth(false); | 62 RunChannelAuth(false); |
| 63 | 63 |
| 64 EXPECT_TRUE(client_socket_.get() != NULL); | |
| 65 EXPECT_TRUE(host_socket_.get() != NULL); | |
| 66 | |
| 67 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), | 64 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), |
| 68 kMessageSize, kMessages); | 65 kMessageSize, kMessages); |
| 69 | 66 |
| 70 tester.Start(); | 67 tester.Start(); |
| 71 message_loop_.Run(); | 68 message_loop_.Run(); |
| 72 tester.CheckResults(); | 69 tester.CheckResults(); |
| 73 } | 70 } |
| 74 | 71 |
| 75 // Verify that connection is rejected when secrets don't match. | 72 // Verify that connection is rejected when secrets don't match. |
| 76 TEST_F(V2AuthenticatorTest, InvalidSecret) { | 73 TEST_F(V2AuthenticatorTest, InvalidSecret) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 87 scoped_ptr<buzz::XmlElement> message(client_->GetNextMessage()); | 84 scoped_ptr<buzz::XmlElement> message(client_->GetNextMessage()); |
| 88 ASSERT_TRUE(message.get()); | 85 ASSERT_TRUE(message.get()); |
| 89 | 86 |
| 90 ASSERT_EQ(Authenticator::WAITING_MESSAGE, client_->state()); | 87 ASSERT_EQ(Authenticator::WAITING_MESSAGE, client_->state()); |
| 91 host_->ProcessMessage(message.get()); | 88 host_->ProcessMessage(message.get()); |
| 92 ASSERT_EQ(Authenticator::REJECTED, host_->state()); | 89 ASSERT_EQ(Authenticator::REJECTED, host_->state()); |
| 93 } | 90 } |
| 94 | 91 |
| 95 } // namespace protocol | 92 } // namespace protocol |
| 96 } // namespace remoting | 93 } // namespace remoting |
| OLD | NEW |