| 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 "chrome/browser/extensions/component_loader.h" | 7 #include "chrome/browser/extensions/component_loader.h" |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "chrome/browser/extensions/test_extension_service.h" | 11 #include "chrome/browser/extensions/test_extension_service.h" |
| 12 #include "chrome/browser/prefs/pref_registry_simple.h" | 12 #include "chrome/browser/prefs/pref_registry_simple.h" |
| 13 #include "chrome/browser/prefs/pref_registry_syncable.h" |
| 13 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
| 14 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
| 15 #include "chrome/common/extensions/extension_set.h" | 16 #include "chrome/common/extensions/extension_set.h" |
| 16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 17 #include "chrome/test/base/testing_pref_service.h" | 18 #include "chrome/test/base/testing_pref_service.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 20 |
| 20 using extensions::Extension; | 21 using extensions::Extension; |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 .AppendASCII("Extensions") | 86 .AppendASCII("Extensions") |
| 86 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") | 87 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") |
| 87 .AppendASCII("1.0.0.0"); | 88 .AppendASCII("1.0.0.0"); |
| 88 | 89 |
| 89 // Read in the extension manifest. | 90 // Read in the extension manifest. |
| 90 ASSERT_TRUE(file_util::ReadFileToString( | 91 ASSERT_TRUE(file_util::ReadFileToString( |
| 91 extension_path_.Append(Extension::kManifestFilename), | 92 extension_path_.Append(Extension::kManifestFilename), |
| 92 &manifest_contents_)); | 93 &manifest_contents_)); |
| 93 | 94 |
| 94 // Register the user prefs that ComponentLoader will read. | 95 // Register the user prefs that ComponentLoader will read. |
| 95 prefs_.RegisterStringPref(prefs::kEnterpriseWebStoreURL, | 96 prefs_.registry()->RegisterStringPref( |
| 96 std::string(), | 97 prefs::kEnterpriseWebStoreURL, |
| 97 PrefServiceSyncable::UNSYNCABLE_PREF); | 98 std::string(), |
| 98 prefs_.RegisterStringPref(prefs::kEnterpriseWebStoreName, | 99 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 99 std::string(), | 100 prefs_.registry()->RegisterStringPref( |
| 100 PrefServiceSyncable::UNSYNCABLE_PREF); | 101 prefs::kEnterpriseWebStoreName, |
| 102 std::string(), |
| 103 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 101 | 104 |
| 102 // Register the local state prefs. | 105 // Register the local state prefs. |
| 103 #if defined(OS_CHROMEOS) | 106 #if defined(OS_CHROMEOS) |
| 104 local_state_.registry()->RegisterBooleanPref( | 107 local_state_.registry()->RegisterBooleanPref( |
| 105 prefs::kSpokenFeedbackEnabled, false); | 108 prefs::kSpokenFeedbackEnabled, false); |
| 106 #endif | 109 #endif |
| 107 } | 110 } |
| 108 | 111 |
| 109 protected: | 112 protected: |
| 110 MockExtensionService extension_service_; | 113 MockExtensionService extension_service_; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 EXPECT_EQ(default_count + 1, extension_service_.extensions()->size()); | 309 EXPECT_EQ(default_count + 1, extension_service_.extensions()->size()); |
| 307 EXPECT_EQ(0u, extension_service_.unloaded_count()); | 310 EXPECT_EQ(0u, extension_service_.unloaded_count()); |
| 308 | 311 |
| 309 // replace loaded component extension. | 312 // replace loaded component extension. |
| 310 component_loader_.AddOrReplace(known_extension); | 313 component_loader_.AddOrReplace(known_extension); |
| 311 EXPECT_EQ(default_count + 1, extension_service_.extensions()->size()); | 314 EXPECT_EQ(default_count + 1, extension_service_.extensions()->size()); |
| 312 EXPECT_EQ(1u, extension_service_.unloaded_count()); | 315 EXPECT_EQ(1u, extension_service_.unloaded_count()); |
| 313 } | 316 } |
| 314 | 317 |
| 315 } // namespace extensions | 318 } // namespace extensions |
| OLD | NEW |