| 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/ssl_hmac_channel_authenticator.h" | 5 #include "remoting/protocol/ssl_hmac_channel_authenticator.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 EXPECT_GE(*counter, 0); | 44 EXPECT_GE(*counter, 0); |
| 45 if (*counter == 0) | 45 if (*counter == 0) |
| 46 base::MessageLoop::current()->Quit(); | 46 base::MessageLoop::current()->Quit(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace | 49 } // namespace |
| 50 | 50 |
| 51 class SslHmacChannelAuthenticatorTest : public testing::Test { | 51 class SslHmacChannelAuthenticatorTest : public testing::Test { |
| 52 public: | 52 public: |
| 53 SslHmacChannelAuthenticatorTest() {} | 53 SslHmacChannelAuthenticatorTest() {} |
| 54 virtual ~SslHmacChannelAuthenticatorTest() {} | 54 ~SslHmacChannelAuthenticatorTest() override {} |
| 55 | 55 |
| 56 protected: | 56 protected: |
| 57 virtual void SetUp() override { | 57 void SetUp() override { |
| 58 base::FilePath certs_dir(net::GetTestCertsDirectory()); | 58 base::FilePath certs_dir(net::GetTestCertsDirectory()); |
| 59 | 59 |
| 60 base::FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der"); | 60 base::FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der"); |
| 61 ASSERT_TRUE(base::ReadFileToString(cert_path, &host_cert_)); | 61 ASSERT_TRUE(base::ReadFileToString(cert_path, &host_cert_)); |
| 62 | 62 |
| 63 base::FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); | 63 base::FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); |
| 64 std::string key_string; | 64 std::string key_string; |
| 65 ASSERT_TRUE(base::ReadFileToString(key_path, &key_string)); | 65 ASSERT_TRUE(base::ReadFileToString(key_path, &key_string)); |
| 66 std::string key_base64; | 66 std::string key_base64; |
| 67 base::Base64Encode(key_string, &key_base64); | 67 base::Base64Encode(key_string, &key_base64); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 host_auth_ = SslHmacChannelAuthenticator::CreateForHost( | 170 host_auth_ = SslHmacChannelAuthenticator::CreateForHost( |
| 171 host_cert_, key_pair_, kTestSharedSecret); | 171 host_cert_, key_pair_, kTestSharedSecret); |
| 172 | 172 |
| 173 RunChannelAuth(true); | 173 RunChannelAuth(true); |
| 174 | 174 |
| 175 ASSERT_TRUE(host_socket_.get() == NULL); | 175 ASSERT_TRUE(host_socket_.get() == NULL); |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace protocol | 178 } // namespace protocol |
| 179 } // namespace remoting | 179 } // namespace remoting |
| OLD | NEW |