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 "chrome/browser/extensions/extension_service_unittest.h" | 5 #include "chrome/browser/extensions/extension_service_unittest.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 #include "chrome/common/chrome_paths.h" | 63 #include "chrome/common/chrome_paths.h" |
64 #include "chrome/common/chrome_switches.h" | 64 #include "chrome/common/chrome_switches.h" |
65 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" | 65 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" |
66 #include "chrome/common/extensions/api/plugins/plugins_handler.h" | 66 #include "chrome/common/extensions/api/plugins/plugins_handler.h" |
67 #include "chrome/common/extensions/background_info.h" | 67 #include "chrome/common/extensions/background_info.h" |
68 #include "chrome/common/extensions/extension.h" | 68 #include "chrome/common/extensions/extension.h" |
69 #include "chrome/common/extensions/extension_l10n_util.h" | 69 #include "chrome/common/extensions/extension_l10n_util.h" |
70 #include "chrome/common/extensions/extension_manifest_constants.h" | 70 #include "chrome/common/extensions/extension_manifest_constants.h" |
71 #include "chrome/common/extensions/manifest_handler.h" | 71 #include "chrome/common/extensions/manifest_handler.h" |
72 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" | 72 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" |
| 73 #include "chrome/common/extensions/manifest_handlers/requirements_handler.h" |
73 #include "chrome/common/extensions/manifest_url_handler.h" | 74 #include "chrome/common/extensions/manifest_url_handler.h" |
74 #include "chrome/common/extensions/permissions/permission_set.h" | 75 #include "chrome/common/extensions/permissions/permission_set.h" |
75 #include "chrome/common/pref_names.h" | 76 #include "chrome/common/pref_names.h" |
76 #include "chrome/common/url_constants.h" | 77 #include "chrome/common/url_constants.h" |
77 #include "chrome/test/base/testing_profile.h" | 78 #include "chrome/test/base/testing_profile.h" |
78 #include "components/user_prefs/pref_registry_syncable.h" | 79 #include "components/user_prefs/pref_registry_syncable.h" |
79 #include "content/public/browser/dom_storage_context.h" | 80 #include "content/public/browser/dom_storage_context.h" |
80 #include "content/public/browser/gpu_data_manager.h" | 81 #include "content/public/browser/gpu_data_manager.h" |
81 #include "content/public/browser/indexed_db_context.h" | 82 #include "content/public/browser/indexed_db_context.h" |
82 #include "content/public/browser/notification_registrar.h" | 83 #include "content/public/browser/notification_registrar.h" |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 ExtensionErrorReporter::Init(false); // no noisy errors | 547 ExtensionErrorReporter::Init(false); // no noisy errors |
547 } | 548 } |
548 | 549 |
549 void ExtensionServiceTestBase::SetUp() { | 550 void ExtensionServiceTestBase::SetUp() { |
550 testing::Test::SetUp(); | 551 testing::Test::SetUp(); |
551 ExtensionErrorReporter::GetInstance()->ClearErrors(); | 552 ExtensionErrorReporter::GetInstance()->ClearErrors(); |
552 (new extensions::BackgroundManifestHandler)->Register(); | 553 (new extensions::BackgroundManifestHandler)->Register(); |
553 (new extensions::ContentScriptsHandler)->Register(); | 554 (new extensions::ContentScriptsHandler)->Register(); |
554 (new extensions::DefaultLocaleHandler)->Register(); | 555 (new extensions::DefaultLocaleHandler)->Register(); |
555 (new extensions::PluginsHandler)->Register(); | 556 (new extensions::PluginsHandler)->Register(); |
| 557 (new extensions::RequirementsHandler)->Register(); |
556 } | 558 } |
557 | 559 |
558 void ExtensionServiceTestBase::TearDown() { | 560 void ExtensionServiceTestBase::TearDown() { |
559 extensions::ManifestHandler::ClearRegistryForTesting(); | 561 extensions::ManifestHandler::ClearRegistryForTesting(); |
560 } | 562 } |
561 | 563 |
562 class ExtensionServiceTest | 564 class ExtensionServiceTest |
563 : public ExtensionServiceTestBase, public content::NotificationObserver { | 565 : public ExtensionServiceTestBase, public content::NotificationObserver { |
564 public: | 566 public: |
565 ExtensionServiceTest() | 567 ExtensionServiceTest() |
(...skipping 5338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5904 EXPECT_FALSE(extensions::HasExternalInstallError(service_)); | 5906 EXPECT_FALSE(extensions::HasExternalInstallError(service_)); |
5905 EXPECT_FALSE(service_->IsExtensionEnabled(good_crx)); | 5907 EXPECT_FALSE(service_->IsExtensionEnabled(good_crx)); |
5906 EXPECT_TRUE(service_->IsExtensionEnabled(page_action)); | 5908 EXPECT_TRUE(service_->IsExtensionEnabled(page_action)); |
5907 | 5909 |
5908 ExtensionPrefs* prefs = service_->extension_prefs(); | 5910 ExtensionPrefs* prefs = service_->extension_prefs(); |
5909 EXPECT_NE(0, prefs->GetDisableReasons(good_crx) & | 5911 EXPECT_NE(0, prefs->GetDisableReasons(good_crx) & |
5910 Extension::DISABLE_SIDELOAD_WIPEOUT); | 5912 Extension::DISABLE_SIDELOAD_WIPEOUT); |
5911 EXPECT_EQ(0, prefs->GetDisableReasons(page_action) & | 5913 EXPECT_EQ(0, prefs->GetDisableReasons(page_action) & |
5912 Extension::DISABLE_SIDELOAD_WIPEOUT); | 5914 Extension::DISABLE_SIDELOAD_WIPEOUT); |
5913 } | 5915 } |
OLD | NEW |