| 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 "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/test_extension_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 Loading... |
| 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 TestExtensionRegistryObserver observer(ExtensionRegistry::Get(profile()), |
| 200 chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, | 202 last_loaded_extension_id()); |
| 201 content::NotificationService::AllSources()); | |
| 202 UninstallExtension(last_loaded_extension_id()); | 203 UninstallExtension(last_loaded_extension_id()); |
| 203 observer.Wait(); | 204 observer.WaitForExtensionUninstalled(); |
| 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 Loading... |
| 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 |
| OLD | NEW |