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

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

Issue 12066003: Remove TabStripModel wrapper use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gtk Created 7 years, 10 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 | Annotate | Revision Log
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_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"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "chrome/browser/extensions/extension_service.h" 12 #include "chrome/browser/extensions/extension_service.h"
13 #include "chrome/browser/extensions/extension_system.h" 13 #include "chrome/browser/extensions/extension_system.h"
14 #include "chrome/browser/extensions/user_script_master.h" 14 #include "chrome/browser/extensions/user_script_master.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_tabstrip.h" 17 #include "chrome/browser/ui/tabs/tab_strip_model.h"
18 #include "chrome/common/chrome_notification_types.h" 18 #include "chrome/common/chrome_notification_types.h"
19 #include "chrome/common/chrome_paths.h" 19 #include "chrome/common/chrome_paths.h"
20 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/extensions/feature_switch.h" 21 #include "chrome/common/extensions/feature_switch.h"
22 #include "chrome/test/base/in_process_browser_test.h" 22 #include "chrome/test/base/in_process_browser_test.h"
23 #include "chrome/test/base/testing_profile.h" 23 #include "chrome/test/base/testing_profile.h"
24 #include "chrome/test/base/ui_test_utils.h" 24 #include "chrome/test/base/ui_test_utils.h"
25 #include "content/public/browser/notification_details.h" 25 #include "content/public/browser/notification_details.h"
26 #include "content/public/browser/notification_service.h" 26 #include "content/public/browser/notification_service.h"
27 #include "content/public/browser/web_contents.h" 27 #include "content/public/browser/web_contents.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // Load a page affected by the content script and test to see the effect. 120 // Load a page affected by the content script and test to see the effect.
121 FilePath test_file; 121 FilePath test_file;
122 PathService::Get(chrome::DIR_TEST_DATA, &test_file); 122 PathService::Get(chrome::DIR_TEST_DATA, &test_file);
123 test_file = test_file.AppendASCII("extensions") 123 test_file = test_file.AppendASCII("extensions")
124 .AppendASCII("test_file.html"); 124 .AppendASCII("test_file.html");
125 125
126 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(test_file)); 126 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(test_file));
127 127
128 bool result = false; 128 bool result = false;
129 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( 129 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
130 chrome::GetActiveWebContents(browser()), 130 browser()->tab_strip_model()->GetActiveWebContents(),
131 "window.domAutomationController.send(" 131 "window.domAutomationController.send("
132 " document.defaultView.getComputedStyle(document.body, null)." 132 " document.defaultView.getComputedStyle(document.body, null)."
133 " getPropertyValue('background-color') == 'rgb(245, 245, 220)')", 133 " getPropertyValue('background-color') == 'rgb(245, 245, 220)')",
134 &result)); 134 &result));
135 EXPECT_EQ(expect_css, result); 135 EXPECT_EQ(expect_css, result);
136 136
137 result = false; 137 result = false;
138 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( 138 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
139 chrome::GetActiveWebContents(browser()), 139 browser()->tab_strip_model()->GetActiveWebContents(),
140 "window.domAutomationController.send(document.title == 'Modified')", 140 "window.domAutomationController.send(document.title == 'Modified')",
141 &result)); 141 &result));
142 EXPECT_EQ(expect_script, result); 142 EXPECT_EQ(expect_script, result);
143 } 143 }
144 144
145 FilePath preferences_file_; 145 FilePath preferences_file_;
146 FilePath extensions_dir_; 146 FilePath extensions_dir_;
147 FilePath user_scripts_dir_; 147 FilePath user_scripts_dir_;
148 bool enable_extensions_; 148 bool enable_extensions_;
149 // Extensions to load from the command line. 149 // Extensions to load from the command line.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698