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

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: Y and B comments. 2014 brazil world cup morning at 6AM korea vs russia 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/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
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::TestExtensionRegistryObserver observer(
200 chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, 202 extensions::ExtensionRegistry::Get(profile()));
201 content::NotificationService::AllSources()); 203 LOG(INFO) << "uninstallid:" + last_loaded_extension_id();
Yoyo Zhou 2014/06/17 18:15:37 Please remove these log lines.
limasdf 2014/06/19 18:06:27 Done.
202 UninstallExtension(last_loaded_extension_id()); 204 UninstallExtension(last_loaded_extension_id());
203 observer.Wait(); 205 observer.WaitForExtensionUninstalled(last_loaded_extension_id());
204 CheckContentSettingsDefault(); 206 CheckContentSettingsDefault();
205 207
206 LoadExtension(test_data_dir_.AppendASCII(kExtensionPath)); 208 LoadExtension(test_data_dir_.AppendASCII(kExtensionPath));
207 CheckContentSettingsDefault(); 209 CheckContentSettingsDefault();
208 } 210 }
209 211
210 // Flaky on the trybots. See http://crbug.com/96725. 212 // Flaky on the trybots. See http://crbug.com/96725.
211 IN_PROC_BROWSER_TEST_F(ExtensionContentSettingsApiTest, 213 IN_PROC_BROWSER_TEST_F(ExtensionContentSettingsApiTest,
212 DISABLED_GetResourceIdentifiers) { 214 DISABLED_GetResourceIdentifiers) {
213 base::FilePath::CharType kFooPath[] = 215 base::FilePath::CharType kFooPath[] =
(...skipping 14 matching lines...) Expand all
228 base::FilePath(kBarPath), 230 base::FilePath(kBarPath),
229 base::ASCIIToUTF16("2.3.4"), 231 base::ASCIIToUTF16("2.3.4"),
230 base::ASCIIToUTF16("bar")), 232 base::ASCIIToUTF16("bar")),
231 false); 233 false);
232 234
233 EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers")) 235 EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers"))
234 << message_; 236 << message_;
235 } 237 }
236 238
237 } // namespace extensions 239 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698