| 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 "extension_prefs_unittest.h" | 5 #include "chrome/browser/extensions/extension_prefs_unittest.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/prefs/mock_pref_change_callback.h" | 10 #include "base/prefs/mock_pref_change_callback.h" |
| 11 #include "base/prefs/pref_change_registrar.h" | 11 #include "base/prefs/pref_change_registrar.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 } | 53 } |
| 54 | 54 |
| 55 ExtensionPrefsTest::ExtensionPrefsTest() | 55 ExtensionPrefsTest::ExtensionPrefsTest() |
| 56 : ui_thread_(BrowserThread::UI, &message_loop_), | 56 : ui_thread_(BrowserThread::UI, &message_loop_), |
| 57 prefs_(message_loop_.message_loop_proxy()) { | 57 prefs_(message_loop_.message_loop_proxy()) { |
| 58 } | 58 } |
| 59 | 59 |
| 60 ExtensionPrefsTest::~ExtensionPrefsTest() { | 60 ExtensionPrefsTest::~ExtensionPrefsTest() { |
| 61 } | 61 } |
| 62 | 62 |
| 63 void ExtensionPrefsTest::RegisterPreferences(PrefRegistrySyncable* registry) {} | 63 void ExtensionPrefsTest::RegisterPreferences( |
| 64 user_prefs::PrefRegistrySyncable* registry) {} |
| 64 | 65 |
| 65 void ExtensionPrefsTest::SetUp() { | 66 void ExtensionPrefsTest::SetUp() { |
| 66 ExtensionTest::SetUp(); | 67 ExtensionTest::SetUp(); |
| 67 RegisterPreferences(prefs_.pref_registry()); | 68 RegisterPreferences(prefs_.pref_registry()); |
| 68 Initialize(); | 69 Initialize(); |
| 69 } | 70 } |
| 70 | 71 |
| 71 void ExtensionPrefsTest::TearDown() { | 72 void ExtensionPrefsTest::TearDown() { |
| 72 Verify(); | 73 Verify(); |
| 73 | 74 |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 ext3_ = ext3_scoped_.get(); | 723 ext3_ = ext3_scoped_.get(); |
| 723 ext4_ = ext4_scoped_.get(); | 724 ext4_ = ext4_scoped_.get(); |
| 724 | 725 |
| 725 for (size_t i = 0; i < arraysize(installed); ++i) | 726 for (size_t i = 0; i < arraysize(installed); ++i) |
| 726 installed[i] = false; | 727 installed[i] = false; |
| 727 } | 728 } |
| 728 | 729 |
| 729 ExtensionPrefsPrepopulatedTest::~ExtensionPrefsPrepopulatedTest() {} | 730 ExtensionPrefsPrepopulatedTest::~ExtensionPrefsPrepopulatedTest() {} |
| 730 | 731 |
| 731 void ExtensionPrefsPrepopulatedTest::RegisterPreferences( | 732 void ExtensionPrefsPrepopulatedTest::RegisterPreferences( |
| 732 PrefRegistrySyncable* registry) { | 733 user_prefs::PrefRegistrySyncable* registry) { |
| 733 registry->RegisterStringPref( | 734 registry->RegisterStringPref( |
| 734 kPref1, kDefaultPref1, PrefRegistrySyncable::UNSYNCABLE_PREF); | 735 kPref1, kDefaultPref1, user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 735 registry->RegisterStringPref( | 736 registry->RegisterStringPref( |
| 736 kPref2, kDefaultPref2, PrefRegistrySyncable::UNSYNCABLE_PREF); | 737 kPref2, kDefaultPref2, user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 737 registry->RegisterStringPref( | 738 registry->RegisterStringPref( |
| 738 kPref3, kDefaultPref3, PrefRegistrySyncable::UNSYNCABLE_PREF); | 739 kPref3, kDefaultPref3, user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 739 registry->RegisterStringPref( | 740 registry->RegisterStringPref( |
| 740 kPref4, kDefaultPref4, PrefRegistrySyncable::UNSYNCABLE_PREF); | 741 kPref4, kDefaultPref4, user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 741 } | 742 } |
| 742 | 743 |
| 743 void ExtensionPrefsPrepopulatedTest::InstallExtControlledPref( | 744 void ExtensionPrefsPrepopulatedTest::InstallExtControlledPref( |
| 744 Extension *ext, | 745 Extension *ext, |
| 745 const std::string& key, | 746 const std::string& key, |
| 746 Value* val) { | 747 Value* val) { |
| 747 EnsureExtensionInstalled(ext); | 748 EnsureExtensionInstalled(ext); |
| 748 prefs()->SetExtensionControlledPref( | 749 prefs()->SetExtensionControlledPref( |
| 749 ext->id(), key, kExtensionPrefsScopeRegular, val); | 750 ext->id(), key, kExtensionPrefsScopeRegular, val); |
| 750 } | 751 } |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 | 1155 |
| 1155 private: | 1156 private: |
| 1156 scoped_refptr<const Extension> extension_a_; | 1157 scoped_refptr<const Extension> extension_a_; |
| 1157 scoped_refptr<const Extension> extension_b_; | 1158 scoped_refptr<const Extension> extension_b_; |
| 1158 scoped_refptr<const Extension> extension_c_; | 1159 scoped_refptr<const Extension> extension_c_; |
| 1159 }; | 1160 }; |
| 1160 TEST_F(ExtensionPrefsBlacklistedExtensions, | 1161 TEST_F(ExtensionPrefsBlacklistedExtensions, |
| 1161 ExtensionPrefsBlacklistedExtensions) {} | 1162 ExtensionPrefsBlacklistedExtensions) {} |
| 1162 | 1163 |
| 1163 } // namespace extensions | 1164 } // namespace extensions |
| OLD | NEW |