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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
11 #include "remoting/host/json_host_config.h" | 11 #include "remoting/host/json_host_config.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace remoting { | 14 namespace remoting { |
15 | 15 |
16 namespace { | 16 namespace { |
17 const char* kTestConfig = | 17 const char* kTestConfig = |
18 "{\n" | 18 "{\n" |
19 " \"xmpp_login\" : \"test@gmail.com\",\n" | 19 " \"xmpp_login\" : \"test@gmail.com\",\n" |
20 " \"xmpp_auth_token\" : \"TEST_AUTH_TOKEN\",\n" | 20 " \"xmpp_auth_token\" : \"TEST_AUTH_TOKEN\",\n" |
21 " \"host_id\" : \"TEST_HOST_ID\",\n" | 21 " \"host_id\" : \"TEST_HOST_ID\",\n" |
22 " \"host_name\" : \"TEST_MACHINE_NAME\",\n" | 22 " \"host_name\" : \"TEST_MACHINE_NAME\",\n" |
23 " \"private_key\" : \"TEST_PRIVATE_KEY\"\n" | 23 " \"private_key\" : \"TEST_PRIVATE_KEY\"\n" |
24 "}\n"; | 24 "}\n"; |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 class JsonHostConfigTest : public testing::Test { | 27 class JsonHostConfigTest : public testing::Test { |
28 protected: | 28 protected: |
29 virtual void SetUp() { | 29 virtual void SetUp() { |
30 message_loop_proxy_ = base::MessageLoopProxy::CreateForCurrentThread(); | 30 message_loop_proxy_ = base::MessageLoopProxy::current(); |
31 } | 31 } |
32 | 32 |
33 static void WriteTestFile(const FilePath& filename) { | 33 static void WriteTestFile(const FilePath& filename) { |
34 file_util::WriteFile(filename, kTestConfig, std::strlen(kTestConfig)); | 34 file_util::WriteFile(filename, kTestConfig, std::strlen(kTestConfig)); |
35 } | 35 } |
36 | 36 |
37 // The temporary directory used to contain the test operations. | 37 // The temporary directory used to contain the test operations. |
38 ScopedTempDir test_dir_; | 38 ScopedTempDir test_dir_; |
39 // A message loop that we can use as the file thread message loop. | 39 // A message loop that we can use as the file thread message loop. |
40 MessageLoop message_loop_; | 40 MessageLoop message_loop_; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 EXPECT_EQ(new_auth_token_value, value); | 101 EXPECT_EQ(new_auth_token_value, value); |
102 EXPECT_TRUE(reader->GetString(kHostIdConfigPath, &value)); | 102 EXPECT_TRUE(reader->GetString(kHostIdConfigPath, &value)); |
103 EXPECT_EQ("TEST_HOST_ID", value); | 103 EXPECT_EQ("TEST_HOST_ID", value); |
104 EXPECT_TRUE(reader->GetString(kHostNameConfigPath, &value)); | 104 EXPECT_TRUE(reader->GetString(kHostNameConfigPath, &value)); |
105 EXPECT_EQ("TEST_MACHINE_NAME", value); | 105 EXPECT_EQ("TEST_MACHINE_NAME", value); |
106 EXPECT_TRUE(reader->GetString(kPrivateKeyConfigPath, &value)); | 106 EXPECT_TRUE(reader->GetString(kPrivateKeyConfigPath, &value)); |
107 EXPECT_EQ("TEST_PRIVATE_KEY", value); | 107 EXPECT_EQ("TEST_PRIVATE_KEY", value); |
108 } | 108 } |
109 | 109 |
110 } | 110 } |
OLD | NEW |