| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 void WaitForServicesToStart(int num_expected_extensions, | 92 void WaitForServicesToStart(int num_expected_extensions, |
| 93 bool expect_extensions_enabled) { | 93 bool expect_extensions_enabled) { |
| 94 ExtensionService* service = extensions::ExtensionSystem::Get( | 94 ExtensionService* service = extensions::ExtensionSystem::Get( |
| 95 browser()->profile())->extension_service(); | 95 browser()->profile())->extension_service(); |
| 96 | 96 |
| 97 // Count the number of non-component extensions. | 97 // Count the number of non-component extensions. |
| 98 int found_extensions = 0; | 98 int found_extensions = 0; |
| 99 for (ExtensionSet::const_iterator it = service->extensions()->begin(); | 99 for (ExtensionSet::const_iterator it = service->extensions()->begin(); |
| 100 it != service->extensions()->end(); ++it) | 100 it != service->extensions()->end(); ++it) |
| 101 if ((*it)->location() != extensions::Extension::COMPONENT) | 101 if ((*it)->location() != extensions::Manifest::COMPONENT) |
| 102 found_extensions++; | 102 found_extensions++; |
| 103 | 103 |
| 104 ASSERT_EQ(static_cast<uint32>(num_expected_extensions), | 104 ASSERT_EQ(static_cast<uint32>(num_expected_extensions), |
| 105 static_cast<uint32>(found_extensions)); | 105 static_cast<uint32>(found_extensions)); |
| 106 ASSERT_EQ(expect_extensions_enabled, service->extensions_enabled()); | 106 ASSERT_EQ(expect_extensions_enabled, service->extensions_enabled()); |
| 107 | 107 |
| 108 content::WindowedNotificationObserver user_scripts_observer( | 108 content::WindowedNotificationObserver user_scripts_observer( |
| 109 chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, | 109 chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, |
| 110 content::NotificationService::AllSources()); | 110 content::NotificationService::AllSources()); |
| 111 extensions::UserScriptMaster* master = | 111 extensions::UserScriptMaster* master = |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 WaitForServicesToStart(num_expected_extensions_, true); | 184 WaitForServicesToStart(num_expected_extensions_, true); |
| 185 | 185 |
| 186 // Keep a separate list of extensions for which to disable file access, since | 186 // Keep a separate list of extensions for which to disable file access, since |
| 187 // doing so reloads them. | 187 // doing so reloads them. |
| 188 std::vector<const extensions::Extension*> extension_list; | 188 std::vector<const extensions::Extension*> extension_list; |
| 189 | 189 |
| 190 ExtensionService* service = extensions::ExtensionSystem::Get( | 190 ExtensionService* service = extensions::ExtensionSystem::Get( |
| 191 browser()->profile())->extension_service(); | 191 browser()->profile())->extension_service(); |
| 192 for (ExtensionSet::const_iterator it = service->extensions()->begin(); | 192 for (ExtensionSet::const_iterator it = service->extensions()->begin(); |
| 193 it != service->extensions()->end(); ++it) { | 193 it != service->extensions()->end(); ++it) { |
| 194 if ((*it)->location() == extensions::Extension::COMPONENT) | 194 if ((*it)->location() == extensions::Manifest::COMPONENT) |
| 195 continue; | 195 continue; |
| 196 if (service->AllowFileAccess(*it)) | 196 if (service->AllowFileAccess(*it)) |
| 197 extension_list.push_back(*it); | 197 extension_list.push_back(*it); |
| 198 } | 198 } |
| 199 | 199 |
| 200 for (size_t i = 0; i < extension_list.size(); ++i) { | 200 for (size_t i = 0; i < extension_list.size(); ++i) { |
| 201 content::WindowedNotificationObserver user_scripts_observer( | 201 content::WindowedNotificationObserver user_scripts_observer( |
| 202 chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, | 202 chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, |
| 203 content::NotificationService::AllSources()); | 203 content::NotificationService::AllSources()); |
| 204 service->SetAllowFileAccess(extension_list[i], false); | 204 service->SetAllowFileAccess(extension_list[i], false); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 .AppendASCII("extensions") | 273 .AppendASCII("extensions") |
| 274 .AppendASCII("app2"); | 274 .AppendASCII("app2"); |
| 275 load_extensions_.push_back(fourth_extension_path.value()); | 275 load_extensions_.push_back(fourth_extension_path.value()); |
| 276 } | 276 } |
| 277 }; | 277 }; |
| 278 | 278 |
| 279 IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) { | 279 IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) { |
| 280 WaitForServicesToStart(4, true); | 280 WaitForServicesToStart(4, true); |
| 281 TestInjection(true, true); | 281 TestInjection(true, true); |
| 282 } | 282 } |
| OLD | NEW |