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

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

Issue 8733004: 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
diff --git a/chrome/browser/extensions/extension_startup_browsertest.cc b/chrome/browser/extensions/extension_startup_browsertest.cc
index 835d274b4a622622f3273b12d8f9e15b15f9a881..20234e6bc51a6ece54173c388b84ed5b83d7253a 100644
--- a/chrome/browser/extensions/extension_startup_browsertest.cc
+++ b/chrome/browser/extensions/extension_startup_browsertest.cc
@@ -83,8 +83,9 @@ class ExtensionStartupTestBase : public InProcessBrowserTest {
// 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,17 +164,25 @@ IN_PROC_BROWSER_TEST_F(ExtensionsStartupTest, Test) {
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