| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 "LuaWBKG1c0R7h+twBgvpExzZneJl+lbGMRx9ba8m/KAFrUWA/NRzOen2NHCuPybOEasgrPgGWBrmf" | 26 "LuaWBKG1c0R7h+twBgvpExzZneJl+lbGMRx9ba8m/KAFrUWA/NRzOen2NHCuPybOEasgrPgGWBrmf" |
| 27 "gDcvyW8QiGuKLopGj/4c5CQT4yE8JjsyU3Qqo2ZPK4neJYQhOmAlg+Q5dAPLpzWMj5HQyOVHJaSXZ" | 27 "gDcvyW8QiGuKLopGj/4c5CQT4yE8JjsyU3Qqo2ZPK4neJYQhOmAlg+Q5dAPLpzWMj5HQyOVHJaSXZ" |
| 28 "Y8vl/LiKvbdofYLeYNVKAE4q5mfpQMrsysPYpbxBV60AhFyrvtC040MFGcflKQRZNiZwMXVb7DclC" | 28 "Y8vl/LiKvbdofYLeYNVKAE4q5mfpQMrsysPYpbxBV60AhFyrvtC040MFGcflKQRZNiZwMXVb7DclC" |
| 29 "BPgvK7rI5Y0ERtVm+yNmH7vCivfyAnDUYA=="; | 29 "BPgvK7rI5Y0ERtVm+yNmH7vCivfyAnDUYA=="; |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 class HostKeyPairTest : public testing::Test { | 32 class HostKeyPairTest : public testing::Test { |
| 33 protected: | 33 protected: |
| 34 virtual void SetUp() { | 34 virtual void SetUp() { |
| 35 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); | 35 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); |
| 36 FilePath config_path = test_dir_.path().AppendASCII("test_config.json"); | 36 base::FilePath config_path = test_dir_.path().AppendASCII("test_config.json"
); |
| 37 config_.reset(new JsonHostConfig(config_path)); | 37 config_.reset(new JsonHostConfig(config_path)); |
| 38 } | 38 } |
| 39 | 39 |
| 40 MessageLoop message_loop_; | 40 MessageLoop message_loop_; |
| 41 base::ScopedTempDir test_dir_; | 41 base::ScopedTempDir test_dir_; |
| 42 scoped_ptr<JsonHostConfig> config_; | 42 scoped_ptr<JsonHostConfig> config_; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 TEST_F(HostKeyPairTest, SaveLoad) { | 45 TEST_F(HostKeyPairTest, SaveLoad) { |
| 46 // Save a key to a config, then load it back, and verify that we | 46 // Save a key to a config, then load it back, and verify that we |
| (...skipping 14 matching lines...) Expand all Loading... |
| 61 TEST_F(HostKeyPairTest, Signatures) { | 61 TEST_F(HostKeyPairTest, Signatures) { |
| 62 // Sign a message and check that we get expected signature. | 62 // Sign a message and check that we get expected signature. |
| 63 HostKeyPair key_pair; | 63 HostKeyPair key_pair; |
| 64 key_pair.LoadFromString(kTestHostKeyPair); | 64 key_pair.LoadFromString(kTestHostKeyPair); |
| 65 | 65 |
| 66 std::string signature_base64 = key_pair.GetSignature(kTestMessage); | 66 std::string signature_base64 = key_pair.GetSignature(kTestMessage); |
| 67 ASSERT_EQ(signature_base64, std::string(kExpectedSignature)); | 67 ASSERT_EQ(signature_base64, std::string(kExpectedSignature)); |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace remoting | 70 } // namespace remoting |
| OLD | NEW |