| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 } // namespace | 47 } // namespace |
| 48 | 48 |
| 49 class SslHmacChannelAuthenticatorTest : public testing::Test { | 49 class SslHmacChannelAuthenticatorTest : public testing::Test { |
| 50 public: | 50 public: |
| 51 SslHmacChannelAuthenticatorTest() {} | 51 SslHmacChannelAuthenticatorTest() {} |
| 52 virtual ~SslHmacChannelAuthenticatorTest() {} | 52 virtual ~SslHmacChannelAuthenticatorTest() {} |
| 53 | 53 |
| 54 protected: | 54 protected: |
| 55 virtual void SetUp() OVERRIDE { | 55 virtual void SetUp() OVERRIDE { |
| 56 FilePath certs_dir(net::GetTestCertsDirectory()); | 56 base::FilePath certs_dir(net::GetTestCertsDirectory()); |
| 57 | 57 |
| 58 FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der"); | 58 base::FilePath cert_path = certs_dir.AppendASCII("unittest.selfsigned.der"); |
| 59 ASSERT_TRUE(file_util::ReadFileToString(cert_path, &host_cert_)); | 59 ASSERT_TRUE(file_util::ReadFileToString(cert_path, &host_cert_)); |
| 60 | 60 |
| 61 FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); | 61 base::FilePath key_path = certs_dir.AppendASCII("unittest.key.bin"); |
| 62 std::string key_string; | 62 std::string key_string; |
| 63 ASSERT_TRUE(file_util::ReadFileToString(key_path, &key_string)); | 63 ASSERT_TRUE(file_util::ReadFileToString(key_path, &key_string)); |
| 64 std::vector<uint8> key_vector( | 64 std::vector<uint8> key_vector( |
| 65 reinterpret_cast<const uint8*>(key_string.data()), | 65 reinterpret_cast<const uint8*>(key_string.data()), |
| 66 reinterpret_cast<const uint8*>(key_string.data() + | 66 reinterpret_cast<const uint8*>(key_string.data() + |
| 67 key_string.length())); | 67 key_string.length())); |
| 68 private_key_.reset( | 68 private_key_.reset( |
| 69 crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_vector)); | 69 crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_vector)); |
| 70 } | 70 } |
| 71 | 71 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 host_auth_ = SslHmacChannelAuthenticator::CreateForHost( | 163 host_auth_ = SslHmacChannelAuthenticator::CreateForHost( |
| 164 host_cert_, private_key_.get(), kTestSharedSecret); | 164 host_cert_, private_key_.get(), kTestSharedSecret); |
| 165 | 165 |
| 166 RunChannelAuth(true); | 166 RunChannelAuth(true); |
| 167 | 167 |
| 168 ASSERT_TRUE(host_socket_.get() == NULL); | 168 ASSERT_TRUE(host_socket_.get() == NULL); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace protocol | 171 } // namespace protocol |
| 172 } // namespace remoting | 172 } // namespace remoting |
| OLD | NEW |