OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 "BPgvK7rI5Y0ERtVm+yNmH7vCivfyAnDUYA=="; | 29 "BPgvK7rI5Y0ERtVm+yNmH7vCivfyAnDUYA=="; |
30 } | 30 } |
31 | 31 |
32 | 32 |
33 class HostKeyPairTest : public testing::Test { | 33 class HostKeyPairTest : public testing::Test { |
34 protected: | 34 protected: |
35 virtual void SetUp() { | 35 virtual void SetUp() { |
36 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); | 36 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); |
37 FilePath config_path = test_dir_.path().AppendASCII("test_config.json"); | 37 FilePath config_path = test_dir_.path().AppendASCII("test_config.json"); |
38 config_ = new JsonHostConfig( | 38 config_ = new JsonHostConfig( |
39 config_path, base::MessageLoopProxy::CreateForCurrentThread()); | 39 config_path, base::MessageLoopProxy::current()); |
40 } | 40 } |
41 | 41 |
42 MessageLoop message_loop_; | 42 MessageLoop message_loop_; |
43 ScopedTempDir test_dir_; | 43 ScopedTempDir test_dir_; |
44 scoped_refptr<JsonHostConfig> config_; | 44 scoped_refptr<JsonHostConfig> config_; |
45 }; | 45 }; |
46 | 46 |
47 TEST_F(HostKeyPairTest, SaveLoad) { | 47 TEST_F(HostKeyPairTest, SaveLoad) { |
48 // Save a key to a config, then load it back, and verify that we | 48 // Save a key to a config, then load it back, and verify that we |
49 // generate the same signature with both keys. | 49 // generate the same signature with both keys. |
(...skipping 13 matching lines...) Expand all Loading... |
63 TEST_F(HostKeyPairTest, Signatures) { | 63 TEST_F(HostKeyPairTest, Signatures) { |
64 // Sign a message and check that we get expected signature. | 64 // Sign a message and check that we get expected signature. |
65 HostKeyPair key_pair; | 65 HostKeyPair key_pair; |
66 key_pair.LoadFromString(kTestHostKeyPair); | 66 key_pair.LoadFromString(kTestHostKeyPair); |
67 | 67 |
68 std::string signature_base64 = key_pair.GetSignature(kTestMessage); | 68 std::string signature_base64 = key_pair.GetSignature(kTestMessage); |
69 ASSERT_EQ(signature_base64, std::string(kExpectedSignature)); | 69 ASSERT_EQ(signature_base64, std::string(kExpectedSignature)); |
70 } | 70 } |
71 | 71 |
72 } // namespace remoting | 72 } // namespace remoting |
OLD | NEW |