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

Side by Side Diff: chrome/browser/prefs/chrome_pref_service_unittest.cc

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/prefs/pref_registry_simple.h" 10 #include "base/prefs/pref_registry_simple.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 EXPECT_TRUE(actual_bool_value); 60 EXPECT_TRUE(actual_bool_value);
61 } 61 }
62 62
63 class ChromePrefServiceUserFilePrefsTest : public testing::Test { 63 class ChromePrefServiceUserFilePrefsTest : public testing::Test {
64 protected: 64 protected:
65 virtual void SetUp() { 65 virtual void SetUp() {
66 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 66 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
67 67
68 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_)); 68 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_));
69 data_dir_ = data_dir_.AppendASCII("pref_service"); 69 data_dir_ = data_dir_.AppendASCII("pref_service");
70 ASSERT_TRUE(file_util::PathExists(data_dir_)); 70 ASSERT_TRUE(base::PathExists(data_dir_));
71 } 71 }
72 72
73 void ClearListValue(PrefService* prefs, const char* key) { 73 void ClearListValue(PrefService* prefs, const char* key) {
74 ListPrefUpdate updater(prefs, key); 74 ListPrefUpdate updater(prefs, key);
75 updater->Clear(); 75 updater->Clear();
76 } 76 }
77 77
78 void ClearDictionaryValue(PrefService* prefs, const char* key) { 78 void ClearDictionaryValue(PrefService* prefs, const char* key) {
79 DictionaryPrefUpdate updater(prefs, key); 79 DictionaryPrefUpdate updater(prefs, key);
80 updater->Clear(); 80 updater->Clear();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 ClearDictionaryValue(prefs.get(), "dict"); 130 ClearDictionaryValue(prefs.get(), "dict");
131 ClearDictionaryValue(prefs.get(), "dict_needs_empty_value"); 131 ClearDictionaryValue(prefs.get(), "dict_needs_empty_value");
132 132
133 // Write to file. 133 // Write to file.
134 prefs->CommitPendingWrite(); 134 prefs->CommitPendingWrite();
135 message_loop_.RunUntilIdle(); 135 message_loop_.RunUntilIdle();
136 136
137 // Compare to expected output. 137 // Compare to expected output.
138 base::FilePath golden_output_file = 138 base::FilePath golden_output_file =
139 data_dir_.AppendASCII("write.golden.need_empty_value.json"); 139 data_dir_.AppendASCII("write.golden.need_empty_value.json");
140 ASSERT_TRUE(file_util::PathExists(golden_output_file)); 140 ASSERT_TRUE(base::PathExists(golden_output_file));
141 EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, pref_file)); 141 EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, pref_file));
142 } 142 }
143 143
144 class ChromePrefServiceWebKitPrefs : public ChromeRenderViewHostTestHarness { 144 class ChromePrefServiceWebKitPrefs : public ChromeRenderViewHostTestHarness {
145 protected: 145 protected:
146 virtual void SetUp() { 146 virtual void SetUp() {
147 ChromeRenderViewHostTestHarness::SetUp(); 147 ChromeRenderViewHostTestHarness::SetUp();
148 148
149 // Supply our own profile so we use the correct profile data. The test 149 // Supply our own profile so we use the correct profile data. The test
150 // harness is not supposed to overwrite a profile if it's already created. 150 // harness is not supposed to overwrite a profile if it's already created.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 const char kDefaultFont[] = "Times"; 186 const char kDefaultFont[] = "Times";
187 #elif defined(OS_CHROMEOS) 187 #elif defined(OS_CHROMEOS)
188 const char kDefaultFont[] = "Tinos"; 188 const char kDefaultFont[] = "Tinos";
189 #else 189 #else
190 const char kDefaultFont[] = "Times New Roman"; 190 const char kDefaultFont[] = "Times New Roman";
191 #endif 191 #endif
192 EXPECT_EQ(ASCIIToUTF16(kDefaultFont), 192 EXPECT_EQ(ASCIIToUTF16(kDefaultFont),
193 webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]); 193 webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]);
194 EXPECT_TRUE(webkit_prefs.javascript_enabled); 194 EXPECT_TRUE(webkit_prefs.javascript_enabled);
195 } 195 }
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_loader_win.cc ('k') | chrome/browser/prefs/pref_service_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698