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 "chrome/browser/extensions/component_loader.h" | 5 #include "chrome/browser/extensions/component_loader.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "chrome/browser/extensions/test_extension_service.h" | 15 #include "chrome/browser/extensions/test_extension_service.h" |
16 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
19 #include "chrome/test/base/testing_profile.h" | 19 #include "chrome/test/base/testing_profile.h" |
20 #include "components/pref_registry/pref_registry_syncable.h" | 20 #include "components/pref_registry/pref_registry_syncable.h" |
21 #include "components/prefs/pref_registry_simple.h" | 21 #include "components/prefs/pref_registry_simple.h" |
22 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 22 #include "components/sync_preferences/testing_pref_service_syncable.h" |
23 #include "content/public/test/test_browser_thread_bundle.h" | 23 #include "content/public/test/test_browser_thread_bundle.h" |
24 #include "extensions/browser/extension_registry.h" | 24 #include "extensions/browser/extension_registry.h" |
25 #include "extensions/common/constants.h" | 25 #include "extensions/common/constants.h" |
26 #include "extensions/common/extension.h" | 26 #include "extensions/common/extension.h" |
27 #include "extensions/common/extension_set.h" | 27 #include "extensions/common/extension_set.h" |
28 #include "extensions/common/manifest_handlers/background_info.h" | 28 #include "extensions/common/manifest_handlers/background_info.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
30 | 30 |
31 namespace extensions { | 31 namespace extensions { |
32 | 32 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 #if defined(OS_CHROMEOS) | 106 #if defined(OS_CHROMEOS) |
107 local_state_.registry()->RegisterBooleanPref( | 107 local_state_.registry()->RegisterBooleanPref( |
108 prefs::kAccessibilitySpokenFeedbackEnabled, false); | 108 prefs::kAccessibilitySpokenFeedbackEnabled, false); |
109 #endif | 109 #endif |
110 } | 110 } |
111 | 111 |
112 protected: | 112 protected: |
113 content::TestBrowserThreadBundle thread_bundle_; | 113 content::TestBrowserThreadBundle thread_bundle_; |
114 TestingProfile profile_; | 114 TestingProfile profile_; |
115 MockExtensionService extension_service_; | 115 MockExtensionService extension_service_; |
116 syncable_prefs::TestingPrefServiceSyncable prefs_; | 116 sync_preferences::TestingPrefServiceSyncable prefs_; |
117 TestingPrefServiceSimple local_state_; | 117 TestingPrefServiceSimple local_state_; |
118 ComponentLoader component_loader_; | 118 ComponentLoader component_loader_; |
119 | 119 |
120 // The root directory of the text extension. | 120 // The root directory of the text extension. |
121 base::FilePath extension_path_; | 121 base::FilePath extension_path_; |
122 | 122 |
123 // The contents of the text extension's manifest file. | 123 // The contents of the text extension's manifest file. |
124 std::string manifest_contents_; | 124 std::string manifest_contents_; |
125 | 125 |
126 base::FilePath GetBasePath() { | 126 base::FilePath GetBasePath() { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 component_loader_.AddOrReplace(known_extension); | 279 component_loader_.AddOrReplace(known_extension); |
280 EXPECT_EQ(default_count + 1, registry->enabled_extensions().size()); | 280 EXPECT_EQ(default_count + 1, registry->enabled_extensions().size()); |
281 EXPECT_EQ(1u, extension_service_.unloaded_count()); | 281 EXPECT_EQ(1u, extension_service_.unloaded_count()); |
282 | 282 |
283 // Add an invalid component extension. | 283 // Add an invalid component extension. |
284 std::string extension_id = component_loader_.AddOrReplace(invalid_extension); | 284 std::string extension_id = component_loader_.AddOrReplace(invalid_extension); |
285 EXPECT_TRUE(extension_id.empty()); | 285 EXPECT_TRUE(extension_id.empty()); |
286 } | 286 } |
287 | 287 |
288 } // namespace extensions | 288 } // namespace extensions |
OLD | NEW |