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

Side by Side Diff: chrome/browser/extensions/extension_startup_browsertest.cc

Issue 420543002: Declarative content scripts: Browser-side: per-extension shared memory regions (lazily loaded) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nit and rebase from master Created 6 years, 4 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 <vector> 5 #include <vector>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/extensions/extension_service.h" 14 #include "chrome/browser/extensions/extension_service.h"
15 #include "chrome/browser/extensions/extension_util.h" 15 #include "chrome/browser/extensions/extension_util.h"
16 #include "chrome/browser/extensions/user_script_master.h" 16 #include "chrome/browser/extensions/shared_user_script_master.h"
17 #include "chrome/browser/prefs/chrome_pref_service_factory.h" 17 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
20 #include "chrome/browser/ui/tabs/tab_strip_model.h" 20 #include "chrome/browser/ui/tabs/tab_strip_model.h"
21 #include "chrome/common/chrome_constants.h" 21 #include "chrome/common/chrome_constants.h"
22 #include "chrome/common/chrome_paths.h" 22 #include "chrome/common/chrome_paths.h"
23 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
24 #include "chrome/test/base/in_process_browser_test.h" 24 #include "chrome/test/base/in_process_browser_test.h"
25 #include "chrome/test/base/testing_profile.h" 25 #include "chrome/test/base/testing_profile.h"
26 #include "chrome/test/base/ui_test_utils.h" 26 #include "chrome/test/base/ui_test_utils.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 if (!unauthenticated_load_allowed_) 124 if (!unauthenticated_load_allowed_)
125 num_expected_extensions = 0; 125 num_expected_extensions = 0;
126 126
127 ASSERT_EQ(static_cast<uint32>(num_expected_extensions), 127 ASSERT_EQ(static_cast<uint32>(num_expected_extensions),
128 static_cast<uint32>(found_extensions)); 128 static_cast<uint32>(found_extensions));
129 ASSERT_EQ(expect_extensions_enabled, service->extensions_enabled()); 129 ASSERT_EQ(expect_extensions_enabled, service->extensions_enabled());
130 130
131 content::WindowedNotificationObserver user_scripts_observer( 131 content::WindowedNotificationObserver user_scripts_observer(
132 extensions::NOTIFICATION_USER_SCRIPTS_UPDATED, 132 extensions::NOTIFICATION_USER_SCRIPTS_UPDATED,
133 content::NotificationService::AllSources()); 133 content::NotificationService::AllSources());
134 extensions::UserScriptMaster* master = 134 extensions::SharedUserScriptMaster* master =
135 extensions::ExtensionSystem::Get(browser()->profile())-> 135 extensions::ExtensionSystem::Get(browser()->profile())->
136 user_script_master(); 136 shared_user_script_master();
137 if (!master->ScriptsReady()) 137 if (!master->scripts_ready())
138 user_scripts_observer.Wait(); 138 user_scripts_observer.Wait();
139 ASSERT_TRUE(master->ScriptsReady()); 139 ASSERT_TRUE(master->scripts_ready());
140 } 140 }
141 141
142 void TestInjection(bool expect_css, bool expect_script) { 142 void TestInjection(bool expect_css, bool expect_script) {
143 if (!unauthenticated_load_allowed_) { 143 if (!unauthenticated_load_allowed_) {
144 expect_css = false; 144 expect_css = false;
145 expect_script = false; 145 expect_script = false;
146 } 146 }
147 147
148 // Load a page affected by the content script and test to see the effect. 148 // Load a page affected by the content script and test to see the effect.
149 base::FilePath test_file; 149 base::FilePath test_file;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 .AppendASCII("extensions") 293 .AppendASCII("extensions")
294 .AppendASCII("app2"); 294 .AppendASCII("app2");
295 load_extensions_.push_back(fourth_extension_path.value()); 295 load_extensions_.push_back(fourth_extension_path.value());
296 } 296 }
297 }; 297 };
298 298
299 IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) { 299 IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) {
300 WaitForServicesToStart(4, true); 300 WaitForServicesToStart(4, true);
301 TestInjection(true, true); 301 TestInjection(true, true);
302 } 302 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_incognito_apitest.cc ('k') | chrome/browser/extensions/extension_system_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698