OLD | NEW |
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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" |
9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "base/path_service.h" | 11 #include "base/path_service.h" |
11 #include "base/prefs/json_pref_store.h" | 12 #include "base/prefs/json_pref_store.h" |
12 #include "base/prefs/public/pref_change_registrar.h" | 13 #include "base/prefs/public/pref_change_registrar.h" |
13 #include "base/prefs/testing_pref_store.h" | 14 #include "base/prefs/testing_pref_store.h" |
14 #include "base/scoped_temp_dir.h" | |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 17 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
18 #include "chrome/browser/policy/mock_configuration_policy_provider.h" | 18 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
19 #include "chrome/browser/prefs/browser_prefs.h" | 19 #include "chrome/browser/prefs/browser_prefs.h" |
20 #include "chrome/browser/prefs/command_line_pref_store.h" | 20 #include "chrome/browser/prefs/command_line_pref_store.h" |
21 #include "chrome/browser/prefs/pref_observer_mock.h" | 21 #include "chrome/browser/prefs/pref_observer_mock.h" |
22 #include "chrome/browser/prefs/pref_service_mock_builder.h" | 22 #include "chrome/browser/prefs/pref_service_mock_builder.h" |
23 #include "chrome/browser/prefs/pref_value_store.h" | 23 #include "chrome/browser/prefs/pref_value_store.h" |
24 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 24 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 ListPrefUpdate updater(prefs, key); | 294 ListPrefUpdate updater(prefs, key); |
295 updater->Clear(); | 295 updater->Clear(); |
296 } | 296 } |
297 | 297 |
298 void ClearDictionaryValue(PrefService* prefs, const char* key) { | 298 void ClearDictionaryValue(PrefService* prefs, const char* key) { |
299 DictionaryPrefUpdate updater(prefs, key); | 299 DictionaryPrefUpdate updater(prefs, key); |
300 updater->Clear(); | 300 updater->Clear(); |
301 } | 301 } |
302 | 302 |
303 // The path to temporary directory used to contain the test operations. | 303 // The path to temporary directory used to contain the test operations. |
304 ScopedTempDir temp_dir_; | 304 base::ScopedTempDir temp_dir_; |
305 // The path to the directory where the test data is stored. | 305 // The path to the directory where the test data is stored. |
306 FilePath data_dir_; | 306 FilePath data_dir_; |
307 // A message loop that we can use as the file thread message loop. | 307 // A message loop that we can use as the file thread message loop. |
308 MessageLoop message_loop_; | 308 MessageLoop message_loop_; |
309 }; | 309 }; |
310 | 310 |
311 // Verifies that ListValue and DictionaryValue pref with non emtpy default | 311 // Verifies that ListValue and DictionaryValue pref with non emtpy default |
312 // preserves its empty value. | 312 // preserves its empty value. |
313 TEST_F(PrefServiceUserFilePrefsTest, PreserveEmptyValue) { | 313 TEST_F(PrefServiceUserFilePrefsTest, PreserveEmptyValue) { |
314 FilePath pref_file = temp_dir_.path().AppendASCII("write.json"); | 314 FilePath pref_file = temp_dir_.path().AppendASCII("write.json"); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 const char kDefaultFont[] = "Times"; | 494 const char kDefaultFont[] = "Times"; |
495 #elif defined(OS_CHROMEOS) | 495 #elif defined(OS_CHROMEOS) |
496 const char kDefaultFont[] = "Tinos"; | 496 const char kDefaultFont[] = "Tinos"; |
497 #else | 497 #else |
498 const char kDefaultFont[] = "Times New Roman"; | 498 const char kDefaultFont[] = "Times New Roman"; |
499 #endif | 499 #endif |
500 EXPECT_EQ(ASCIIToUTF16(kDefaultFont), | 500 EXPECT_EQ(ASCIIToUTF16(kDefaultFont), |
501 webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]); | 501 webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]); |
502 EXPECT_TRUE(webkit_prefs.javascript_enabled); | 502 EXPECT_TRUE(webkit_prefs.javascript_enabled); |
503 } | 503 } |
OLD | NEW |