Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: remoting/host/json_host_config_unittest.cc

Issue 11359217: Move scoped_temp_dir from base to base/files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/host_key_pair_unittest.cc ('k') | rlz/test/rlz_test_helpers.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/files/scoped_temp_dir.h"
6 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
7 #include "base/path_service.h" 8 #include "base/path_service.h"
8 #include "base/scoped_temp_dir.h"
9 #include "remoting/host/json_host_config.h" 9 #include "remoting/host/json_host_config.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace remoting { 12 namespace remoting {
13 13
14 namespace { 14 namespace {
15 const char* kTestConfig = 15 const char* kTestConfig =
16 "{\n" 16 "{\n"
17 " \"xmpp_login\" : \"test@gmail.com\",\n" 17 " \"xmpp_login\" : \"test@gmail.com\",\n"
18 " \"xmpp_auth_token\" : \"TEST_AUTH_TOKEN\",\n" 18 " \"xmpp_auth_token\" : \"TEST_AUTH_TOKEN\",\n"
19 " \"host_id\" : \"TEST_HOST_ID\",\n" 19 " \"host_id\" : \"TEST_HOST_ID\",\n"
20 " \"host_name\" : \"TEST_MACHINE_NAME\",\n" 20 " \"host_name\" : \"TEST_MACHINE_NAME\",\n"
21 " \"private_key\" : \"TEST_PRIVATE_KEY\"\n" 21 " \"private_key\" : \"TEST_PRIVATE_KEY\"\n"
22 "}\n"; 22 "}\n";
23 } // namespace 23 } // namespace
24 24
25 class JsonHostConfigTest : public testing::Test { 25 class JsonHostConfigTest : public testing::Test {
26 protected: 26 protected:
27 static void WriteTestFile(const FilePath& filename) { 27 static void WriteTestFile(const FilePath& filename) {
28 file_util::WriteFile(filename, kTestConfig, std::strlen(kTestConfig)); 28 file_util::WriteFile(filename, kTestConfig, std::strlen(kTestConfig));
29 } 29 }
30 30
31 // The temporary directory used to contain the test operations. 31 // The temporary directory used to contain the test operations.
32 ScopedTempDir test_dir_; 32 base::ScopedTempDir test_dir_;
33 }; 33 };
34 34
35 TEST_F(JsonHostConfigTest, InvalidFile) { 35 TEST_F(JsonHostConfigTest, InvalidFile) {
36 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); 36 ASSERT_TRUE(test_dir_.CreateUniqueTempDir());
37 FilePath non_existent_file = 37 FilePath non_existent_file =
38 test_dir_.path().AppendASCII("non_existent.json"); 38 test_dir_.path().AppendASCII("non_existent.json");
39 JsonHostConfig target(non_existent_file); 39 JsonHostConfig target(non_existent_file);
40 EXPECT_FALSE(target.Read()); 40 EXPECT_FALSE(target.Read());
41 } 41 }
42 42
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 EXPECT_EQ(new_auth_token_value, value); 85 EXPECT_EQ(new_auth_token_value, value);
86 EXPECT_TRUE(reader.GetString(kHostIdConfigPath, &value)); 86 EXPECT_TRUE(reader.GetString(kHostIdConfigPath, &value));
87 EXPECT_EQ("TEST_HOST_ID", value); 87 EXPECT_EQ("TEST_HOST_ID", value);
88 EXPECT_TRUE(reader.GetString(kHostNameConfigPath, &value)); 88 EXPECT_TRUE(reader.GetString(kHostNameConfigPath, &value));
89 EXPECT_EQ("TEST_MACHINE_NAME", value); 89 EXPECT_EQ("TEST_MACHINE_NAME", value);
90 EXPECT_TRUE(reader.GetString(kPrivateKeyConfigPath, &value)); 90 EXPECT_TRUE(reader.GetString(kPrivateKeyConfigPath, &value));
91 EXPECT_EQ("TEST_PRIVATE_KEY", value); 91 EXPECT_EQ("TEST_PRIVATE_KEY", value);
92 } 92 }
93 93
94 } 94 }
OLDNEW
« no previous file with comments | « remoting/host/host_key_pair_unittest.cc ('k') | rlz/test/rlz_test_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698