Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: chrome/browser/extensions/extension_service_unittest.cc

Issue 2512563003: Convert enable_plugins to a buildflag header. (Closed)
Patch Set: Merge Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 #include "extensions/common/permissions/permission_set.h" 125 #include "extensions/common/permissions/permission_set.h"
126 #include "extensions/common/permissions/permissions_data.h" 126 #include "extensions/common/permissions/permissions_data.h"
127 #include "extensions/common/switches.h" 127 #include "extensions/common/switches.h"
128 #include "extensions/common/url_pattern.h" 128 #include "extensions/common/url_pattern.h"
129 #include "extensions/common/value_builder.h" 129 #include "extensions/common/value_builder.h"
130 #include "gpu/config/gpu_info.h" 130 #include "gpu/config/gpu_info.h"
131 #include "net/cookies/cookie_options.h" 131 #include "net/cookies/cookie_options.h"
132 #include "net/cookies/cookie_store.h" 132 #include "net/cookies/cookie_store.h"
133 #include "net/url_request/url_request_context.h" 133 #include "net/url_request/url_request_context.h"
134 #include "net/url_request/url_request_context_getter.h" 134 #include "net/url_request/url_request_context_getter.h"
135 #include "ppapi/features/features.h"
135 #include "storage/browser/database/database_tracker.h" 136 #include "storage/browser/database/database_tracker.h"
136 #include "storage/browser/quota/quota_manager.h" 137 #include "storage/browser/quota/quota_manager.h"
137 #include "storage/common/database/database_identifier.h" 138 #include "storage/common/database/database_identifier.h"
138 #include "testing/gmock/include/gmock/gmock.h" 139 #include "testing/gmock/include/gmock/gmock.h"
139 #include "testing/gtest/include/gtest/gtest.h" 140 #include "testing/gtest/include/gtest/gtest.h"
140 #include "testing/platform_test.h" 141 #include "testing/platform_test.h"
141 #include "ui/base/l10n/l10n_util.h" 142 #include "ui/base/l10n/l10n_util.h"
142 #include "url/gurl.h" 143 #include "url/gurl.h"
143 144
144 #if defined(OS_CHROMEOS) 145 #if defined(OS_CHROMEOS)
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 753
753 base::ListValue* list_value = new base::ListValue(); 754 base::ListValue* list_value = new base::ListValue();
754 for (std::set<std::string>::const_iterator iter = value.begin(); 755 for (std::set<std::string>::const_iterator iter = value.begin();
755 iter != value.end(); ++iter) 756 iter != value.end(); ++iter)
756 list_value->AppendString(*iter); 757 list_value->AppendString(*iter);
757 758
758 SetPref(extension_id, pref_path, list_value, msg); 759 SetPref(extension_id, pref_path, list_value, msg);
759 } 760 }
760 761
761 void InitPluginService() { 762 void InitPluginService() {
762 #if defined(ENABLE_PLUGINS) 763 #if BUILDFLAG(ENABLE_PLUGINS)
763 PluginService::GetInstance()->Init(); 764 PluginService::GetInstance()->Init();
764 #endif 765 #endif
765 } 766 }
766 767
767 void InitializeEmptyExtensionServiceWithTestingPrefs() { 768 void InitializeEmptyExtensionServiceWithTestingPrefs() {
768 ExtensionServiceTestBase::ExtensionServiceInitParams params = 769 ExtensionServiceTestBase::ExtensionServiceInitParams params =
769 CreateDefaultInitParams(); 770 CreateDefaultInitParams();
770 params.pref_file = base::FilePath(); 771 params.pref_file = base::FilePath();
771 InitializeExtensionService(params); 772 InitializeExtensionService(params);
772 } 773 }
(...skipping 4843 matching lines...) Expand 10 before | Expand all | Expand 10 after
5616 // 5617 //
5617 // Also tests that we always fire EXTENSIONS_READY, no matter whether we are 5618 // Also tests that we always fire EXTENSIONS_READY, no matter whether we are
5618 // enabled or not. 5619 // enabled or not.
5619 class ExtensionServiceTestSimple : public testing::Test { 5620 class ExtensionServiceTestSimple : public testing::Test {
5620 content::TestBrowserThreadBundle thread_bundle_; 5621 content::TestBrowserThreadBundle thread_bundle_;
5621 }; 5622 };
5622 5623
5623 TEST_F(ExtensionServiceTestSimple, Enabledness) { 5624 TEST_F(ExtensionServiceTestSimple, Enabledness) {
5624 // Make sure the PluginService singleton is destroyed at the end of the test. 5625 // Make sure the PluginService singleton is destroyed at the end of the test.
5625 base::ShadowingAtExitManager at_exit_manager; 5626 base::ShadowingAtExitManager at_exit_manager;
5626 #if defined(ENABLE_PLUGINS) 5627 #if BUILDFLAG(ENABLE_PLUGINS)
5627 content::PluginService::GetInstance()->Init(); 5628 content::PluginService::GetInstance()->Init();
5628 #endif 5629 #endif
5629 5630
5630 ExtensionErrorReporter::Init(false); // no noisy errors 5631 ExtensionErrorReporter::Init(false); // no noisy errors
5631 ExtensionsReadyRecorder recorder; 5632 ExtensionsReadyRecorder recorder;
5632 std::unique_ptr<TestingProfile> profile(new TestingProfile()); 5633 std::unique_ptr<TestingProfile> profile(new TestingProfile());
5633 #if defined OS_CHROMEOS 5634 #if defined OS_CHROMEOS
5634 chromeos::ScopedTestDeviceSettingsService device_settings_service; 5635 chromeos::ScopedTestDeviceSettingsService device_settings_service;
5635 chromeos::ScopedTestCrosSettings cros_settings; 5636 chromeos::ScopedTestCrosSettings cros_settings;
5636 std::unique_ptr<chromeos::ScopedTestUserManager> user_manager( 5637 std::unique_ptr<chromeos::ScopedTestUserManager> user_manager(
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after
6947 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); 6948 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile());
6948 EXPECT_TRUE(registry()->disabled_extensions().Contains(id)); 6949 EXPECT_TRUE(registry()->disabled_extensions().Contains(id));
6949 EXPECT_TRUE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); 6950 EXPECT_TRUE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED));
6950 6951
6951 base::FilePath v2_path = data_dir().AppendASCII("good2.crx"); 6952 base::FilePath v2_path = data_dir().AppendASCII("good2.crx");
6952 UpdateExtension(id, v2_path, ENABLED); 6953 UpdateExtension(id, v2_path, ENABLED);
6953 6954
6954 EXPECT_FALSE(registry()->disabled_extensions().Contains(id)); 6955 EXPECT_FALSE(registry()->disabled_extensions().Contains(id));
6955 EXPECT_FALSE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); 6956 EXPECT_FALSE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED));
6956 } 6957 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698