OLD | NEW |
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 void ClearDictionaryValue(PrefService* prefs, const char* key) { | 80 void ClearDictionaryValue(PrefService* prefs, const char* key) { |
81 DictionaryPrefUpdate updater(prefs, key); | 81 DictionaryPrefUpdate updater(prefs, key); |
82 updater->Clear(); | 82 updater->Clear(); |
83 } | 83 } |
84 | 84 |
85 // The path to temporary directory used to contain the test operations. | 85 // The path to temporary directory used to contain the test operations. |
86 base::ScopedTempDir temp_dir_; | 86 base::ScopedTempDir temp_dir_; |
87 // The path to the directory where the test data is stored. | 87 // The path to the directory where the test data is stored. |
88 base::FilePath data_dir_; | 88 base::FilePath data_dir_; |
89 // A message loop that we can use as the file thread message loop. | 89 // A message loop that we can use as the file thread message loop. |
90 MessageLoop message_loop_; | 90 base::MessageLoop message_loop_; |
91 }; | 91 }; |
92 | 92 |
93 // Verifies that ListValue and DictionaryValue pref with non emtpy default | 93 // Verifies that ListValue and DictionaryValue pref with non emtpy default |
94 // preserves its empty value. | 94 // preserves its empty value. |
95 TEST_F(ChromePrefServiceUserFilePrefsTest, PreserveEmptyValue) { | 95 TEST_F(ChromePrefServiceUserFilePrefsTest, PreserveEmptyValue) { |
96 base::FilePath pref_file = temp_dir_.path().AppendASCII("write.json"); | 96 base::FilePath pref_file = temp_dir_.path().AppendASCII("write.json"); |
97 | 97 |
98 ASSERT_TRUE(file_util::CopyFile( | 98 ASSERT_TRUE(file_util::CopyFile( |
99 data_dir_.AppendASCII("read.need_empty_value.json"), | 99 data_dir_.AppendASCII("read.need_empty_value.json"), |
100 pref_file)); | 100 pref_file)); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 const char kDefaultFont[] = "Times"; | 194 const char kDefaultFont[] = "Times"; |
195 #elif defined(OS_CHROMEOS) | 195 #elif defined(OS_CHROMEOS) |
196 const char kDefaultFont[] = "Tinos"; | 196 const char kDefaultFont[] = "Tinos"; |
197 #else | 197 #else |
198 const char kDefaultFont[] = "Times New Roman"; | 198 const char kDefaultFont[] = "Times New Roman"; |
199 #endif | 199 #endif |
200 EXPECT_EQ(ASCIIToUTF16(kDefaultFont), | 200 EXPECT_EQ(ASCIIToUTF16(kDefaultFont), |
201 webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]); | 201 webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]); |
202 EXPECT_TRUE(webkit_prefs.javascript_enabled); | 202 EXPECT_TRUE(webkit_prefs.javascript_enabled); |
203 } | 203 } |
OLD | NEW |