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

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

Issue 4192012: Convert implicit scoped_refptr constructor calls to explicit ones, part 1 (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: fix presubmit Created 10 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/heartbeat_sender_unittest.cc ('k') | remoting/host/simple_host_process.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/message_loop_proxy.h" 7 #include "base/message_loop_proxy.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 ScopedTempDir test_dir_; 47 ScopedTempDir test_dir_;
48 // A message loop that we can use as the file thread message loop. 48 // A message loop that we can use as the file thread message loop.
49 MessageLoop message_loop_; 49 MessageLoop message_loop_;
50 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; 50 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
51 }; 51 };
52 52
53 TEST_F(JsonHostConfigTest, InvalidFile) { 53 TEST_F(JsonHostConfigTest, InvalidFile) {
54 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); 54 ASSERT_TRUE(test_dir_.CreateUniqueTempDir());
55 FilePath non_existent_file = 55 FilePath non_existent_file =
56 test_dir_.path().AppendASCII("non_existent.json"); 56 test_dir_.path().AppendASCII("non_existent.json");
57 scoped_refptr<JsonHostConfig> target = 57 scoped_refptr<JsonHostConfig> target(
58 new JsonHostConfig(non_existent_file, message_loop_proxy_.get()); 58 new JsonHostConfig(non_existent_file, message_loop_proxy_.get()));
59 EXPECT_FALSE(target->Read()); 59 EXPECT_FALSE(target->Read());
60 } 60 }
61 61
62 TEST_F(JsonHostConfigTest, Read) { 62 TEST_F(JsonHostConfigTest, Read) {
63 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); 63 ASSERT_TRUE(test_dir_.CreateUniqueTempDir());
64 FilePath test_file = test_dir_.path().AppendASCII("read.json"); 64 FilePath test_file = test_dir_.path().AppendASCII("read.json");
65 WriteTestFile(test_file); 65 WriteTestFile(test_file);
66 scoped_refptr<JsonHostConfig> target = 66 scoped_refptr<JsonHostConfig> target(
67 new JsonHostConfig(test_file, message_loop_proxy_.get()); 67 new JsonHostConfig(test_file, message_loop_proxy_.get()));
68 ASSERT_TRUE(target->Read()); 68 ASSERT_TRUE(target->Read());
69 69
70 std::string value; 70 std::string value;
71 EXPECT_TRUE(target->GetString(kXmppLoginConfigPath, &value)); 71 EXPECT_TRUE(target->GetString(kXmppLoginConfigPath, &value));
72 EXPECT_EQ("test@gmail.com", value); 72 EXPECT_EQ("test@gmail.com", value);
73 EXPECT_TRUE(target->GetString(kXmppAuthTokenConfigPath, &value)); 73 EXPECT_TRUE(target->GetString(kXmppAuthTokenConfigPath, &value));
74 EXPECT_EQ("TEST_AUTH_TOKEN", value); 74 EXPECT_EQ("TEST_AUTH_TOKEN", value);
75 EXPECT_TRUE(target->GetString(kHostIdConfigPath, &value)); 75 EXPECT_TRUE(target->GetString(kHostIdConfigPath, &value));
76 EXPECT_EQ("TEST_HOST_ID", value); 76 EXPECT_EQ("TEST_HOST_ID", value);
77 EXPECT_TRUE(target->GetString(kHostNameConfigPath, &value)); 77 EXPECT_TRUE(target->GetString(kHostNameConfigPath, &value));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 EXPECT_EQ(new_auth_token_value, value); 112 EXPECT_EQ(new_auth_token_value, value);
113 EXPECT_TRUE(reader->GetString(kHostIdConfigPath, &value)); 113 EXPECT_TRUE(reader->GetString(kHostIdConfigPath, &value));
114 EXPECT_EQ("TEST_HOST_ID", value); 114 EXPECT_EQ("TEST_HOST_ID", value);
115 EXPECT_TRUE(reader->GetString(kHostNameConfigPath, &value)); 115 EXPECT_TRUE(reader->GetString(kHostNameConfigPath, &value));
116 EXPECT_EQ("TEST_MACHINE_NAME", value); 116 EXPECT_EQ("TEST_MACHINE_NAME", value);
117 EXPECT_TRUE(reader->GetString(kPrivateKeyConfigPath, &value)); 117 EXPECT_TRUE(reader->GetString(kPrivateKeyConfigPath, &value));
118 EXPECT_EQ("TEST_PRIVATE_KEY", value); 118 EXPECT_EQ("TEST_PRIVATE_KEY", value);
119 } 119 }
120 120
121 } 121 }
OLDNEW
« no previous file with comments | « remoting/host/heartbeat_sender_unittest.cc ('k') | remoting/host/simple_host_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698