| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 int found_extensions = 0; | 90 int found_extensions = 0; |
| 91 for (ExtensionSet::const_iterator it = service->extensions()->begin(); | 91 for (ExtensionSet::const_iterator it = service->extensions()->begin(); |
| 92 it != service->extensions()->end(); ++it) | 92 it != service->extensions()->end(); ++it) |
| 93 if ((*it)->location() != extensions::Extension::COMPONENT) | 93 if ((*it)->location() != extensions::Extension::COMPONENT) |
| 94 found_extensions++; | 94 found_extensions++; |
| 95 | 95 |
| 96 ASSERT_EQ(static_cast<uint32>(num_expected_extensions), | 96 ASSERT_EQ(static_cast<uint32>(num_expected_extensions), |
| 97 static_cast<uint32>(found_extensions)); | 97 static_cast<uint32>(found_extensions)); |
| 98 ASSERT_EQ(expect_extensions_enabled, service->extensions_enabled()); | 98 ASSERT_EQ(expect_extensions_enabled, service->extensions_enabled()); |
| 99 | 99 |
| 100 ui_test_utils::WindowedNotificationObserver user_scripts_observer( | 100 content::WindowedNotificationObserver user_scripts_observer( |
| 101 chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, | 101 chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, |
| 102 content::NotificationService::AllSources()); | 102 content::NotificationService::AllSources()); |
| 103 extensions::UserScriptMaster* master = | 103 extensions::UserScriptMaster* master = |
| 104 browser()->profile()->GetUserScriptMaster(); | 104 browser()->profile()->GetUserScriptMaster(); |
| 105 if (!master->ScriptsReady()) | 105 if (!master->ScriptsReady()) |
| 106 user_scripts_observer.Wait(); | 106 user_scripts_observer.Wait(); |
| 107 ASSERT_TRUE(master->ScriptsReady()); | 107 ASSERT_TRUE(master->ScriptsReady()); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void TestInjection(bool expect_css, bool expect_script) { | 110 void TestInjection(bool expect_css, bool expect_script) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 ExtensionService* service = browser()->profile()->GetExtensionService(); | 178 ExtensionService* service = browser()->profile()->GetExtensionService(); |
| 179 for (ExtensionSet::const_iterator it = service->extensions()->begin(); | 179 for (ExtensionSet::const_iterator it = service->extensions()->begin(); |
| 180 it != service->extensions()->end(); ++it) { | 180 it != service->extensions()->end(); ++it) { |
| 181 if ((*it)->location() == extensions::Extension::COMPONENT) | 181 if ((*it)->location() == extensions::Extension::COMPONENT) |
| 182 continue; | 182 continue; |
| 183 if (service->AllowFileAccess(*it)) | 183 if (service->AllowFileAccess(*it)) |
| 184 extension_list.push_back(*it); | 184 extension_list.push_back(*it); |
| 185 } | 185 } |
| 186 | 186 |
| 187 for (size_t i = 0; i < extension_list.size(); ++i) { | 187 for (size_t i = 0; i < extension_list.size(); ++i) { |
| 188 ui_test_utils::WindowedNotificationObserver user_scripts_observer( | 188 content::WindowedNotificationObserver user_scripts_observer( |
| 189 chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, | 189 chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, |
| 190 content::NotificationService::AllSources()); | 190 content::NotificationService::AllSources()); |
| 191 service->SetAllowFileAccess(extension_list[i], false); | 191 service->SetAllowFileAccess(extension_list[i], false); |
| 192 user_scripts_observer.Wait(); | 192 user_scripts_observer.Wait(); |
| 193 } | 193 } |
| 194 | 194 |
| 195 TestInjection(false, false); | 195 TestInjection(false, false); |
| 196 } | 196 } |
| 197 | 197 |
| 198 // ExtensionsLoadTest | 198 // ExtensionsLoadTest |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 .AppendASCII("extensions") | 260 .AppendASCII("extensions") |
| 261 .AppendASCII("app2"); | 261 .AppendASCII("app2"); |
| 262 load_extensions_.push_back(fourth_extension_path.value()); | 262 load_extensions_.push_back(fourth_extension_path.value()); |
| 263 } | 263 } |
| 264 }; | 264 }; |
| 265 | 265 |
| 266 IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) { | 266 IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) { |
| 267 WaitForServicesToStart(4, true); | 267 WaitForServicesToStart(4, true); |
| 268 TestInjection(true, true); | 268 TestInjection(true, true); |
| 269 } | 269 } |
| OLD | NEW |