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

Side by Side Diff: chrome/browser/extensions/api/content_settings/content_settings_apitest.cc

Issue 334083002: Add a test helper class for ExtensionRegistry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ben's comments Created 6 years, 6 months 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) 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 "base/prefs/pref_service.h" 5 #include "base/prefs/pref_service.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/content_settings/cookie_settings.h" 9 #include "chrome/browser/content_settings/cookie_settings.h"
10 #include "chrome/browser/content_settings/host_content_settings_map.h" 10 #include "chrome/browser/content_settings/host_content_settings_map.h"
11 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h" 11 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h"
12 #include "chrome/browser/extensions/extension_apitest.h" 12 #include "chrome/browser/extensions/extension_apitest.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
17 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
18 #include "content/public/browser/plugin_service.h" 18 #include "content/public/browser/plugin_service.h"
19 #include "content/public/common/webplugininfo.h" 19 #include "content/public/common/webplugininfo.h"
20 #include "content/public/test/test_utils.h" 20 #include "content/public/test/test_utils.h"
21 #include "extensions/browser/extension_registry.h"
22 #include "extensions/browser/extension_test_registry_observer.h"
21 23
22 namespace { 24 namespace {
23 25
24 void ReleaseBrowserProcessModule() { 26 void ReleaseBrowserProcessModule() {
25 g_browser_process->ReleaseModule(); 27 g_browser_process->ReleaseModule();
26 } 28 }
27 29
28 } // namespace 30 } // namespace
29 31
30 namespace extensions { 32 namespace extensions {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 191
190 EXPECT_TRUE(RunExtensionSubtest(kExtensionPath, "test.html")) << message_; 192 EXPECT_TRUE(RunExtensionSubtest(kExtensionPath, "test.html")) << message_;
191 CheckContentSettingsSet(); 193 CheckContentSettingsSet();
192 194
193 // The settings should not be reset when the extension is reloaded. 195 // The settings should not be reset when the extension is reloaded.
194 ReloadExtension(last_loaded_extension_id()); 196 ReloadExtension(last_loaded_extension_id());
195 CheckContentSettingsSet(); 197 CheckContentSettingsSet();
196 198
197 // Uninstalling and installing the extension (without running the test that 199 // Uninstalling and installing the extension (without running the test that
198 // calls the extension API) should clear the settings. 200 // calls the extension API) should clear the settings.
199 content::WindowedNotificationObserver observer( 201 extensions::ExtensionTestRegistryObserver observer(
200 chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, 202 extensions::ExtensionRegistry::Get(profile()));
201 content::NotificationService::AllSources());
202 UninstallExtension(last_loaded_extension_id()); 203 UninstallExtension(last_loaded_extension_id());
203 observer.Wait(); 204 observer.WaitForAnyExtensionUninstalled();
204 CheckContentSettingsDefault(); 205 CheckContentSettingsDefault();
205 206
206 LoadExtension(test_data_dir_.AppendASCII(kExtensionPath)); 207 LoadExtension(test_data_dir_.AppendASCII(kExtensionPath));
207 CheckContentSettingsDefault(); 208 CheckContentSettingsDefault();
208 } 209 }
209 210
210 // Flaky on the trybots. See http://crbug.com/96725. 211 // Flaky on the trybots. See http://crbug.com/96725.
211 IN_PROC_BROWSER_TEST_F(ExtensionContentSettingsApiTest, 212 IN_PROC_BROWSER_TEST_F(ExtensionContentSettingsApiTest,
212 DISABLED_GetResourceIdentifiers) { 213 DISABLED_GetResourceIdentifiers) {
213 base::FilePath::CharType kFooPath[] = 214 base::FilePath::CharType kFooPath[] =
(...skipping 14 matching lines...) Expand all
228 base::FilePath(kBarPath), 229 base::FilePath(kBarPath),
229 base::ASCIIToUTF16("2.3.4"), 230 base::ASCIIToUTF16("2.3.4"),
230 base::ASCIIToUTF16("bar")), 231 base::ASCIIToUTF16("bar")),
231 false); 232 false);
232 233
233 EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers")) 234 EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers"))
234 << message_; 235 << message_;
235 } 236 }
236 237
237 } // namespace extensions 238 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698