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

Unified Diff: chrome/browser/extensions/extension_startup_browsertest.cc

Issue 8822021: Revert 113071 - Revert 113047 - Make ExtensionService use ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_startup_browsertest.cc
===================================================================
--- chrome/browser/extensions/extension_startup_browsertest.cc (revision 113231)
+++ chrome/browser/extensions/extension_startup_browsertest.cc (working copy)
@@ -83,8 +83,9 @@
// Count the number of non-component extensions.
int found_extensions = 0;
- for (size_t i = 0; i < service->extensions()->size(); i++)
- if (service->extensions()->at(i)->location() != Extension::COMPONENT)
+ for (ExtensionSet::const_iterator it = service->extensions()->begin();
+ it != service->extensions()->end(); ++it)
+ if ((*it)->location() != Extension::COMPONENT)
found_extensions++;
ASSERT_EQ(static_cast<uint32>(num_expected_extensions),
@@ -163,19 +164,27 @@
IN_PROC_BROWSER_TEST_F(ExtensionsStartupTest, MAYBE_NoFileAccess) {
WaitForServicesToStart(num_expected_extensions_, true);
+ // Keep a separate list of extensions for which to disable file access, since
+ // doing so reloads them.
+ std::vector<const Extension*> extension_list;
+
ExtensionService* service = browser()->profile()->GetExtensionService();
- for (size_t i = 0; i < service->extensions()->size(); ++i) {
- if (service->extensions()->at(i)->location() == Extension::COMPONENT)
+ for (ExtensionSet::const_iterator it = service->extensions()->begin();
+ it != service->extensions()->end(); ++it) {
+ if ((*it)->location() == Extension::COMPONENT)
continue;
- if (service->AllowFileAccess(service->extensions()->at(i))) {
- ui_test_utils::WindowedNotificationObserver user_scripts_observer(
- chrome::NOTIFICATION_USER_SCRIPTS_UPDATED,
- content::NotificationService::AllSources());
- service->SetAllowFileAccess(service->extensions()->at(i), false);
- user_scripts_observer.Wait();
- }
+ if (service->AllowFileAccess(*it))
+ extension_list.push_back(*it);
}
+ for (size_t i = 0; i < extension_list.size(); ++i) {
+ ui_test_utils::WindowedNotificationObserver user_scripts_observer(
+ chrome::NOTIFICATION_USER_SCRIPTS_UPDATED,
+ content::NotificationService::AllSources());
+ service->SetAllowFileAccess(extension_list[i], false);
+ user_scripts_observer.Wait();
+ }
+
TestInjection(false, false);
}
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | chrome/browser/extensions/extension_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698