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

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

Issue 9015022: Replace most of Browser::GetSelectedTabContents calls into Browser::GetSelectedWebContents. I've ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "chrome/browser/extensions/extension_apitest.h" 6 #include "chrome/browser/extensions/extension_apitest.h"
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/common/chrome_notification_types.h" 9 #include "chrome/common/chrome_notification_types.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
11 #include "chrome/common/extensions/extension.h" 11 #include "chrome/common/extensions/extension.h"
12 #include "chrome/test/base/ui_test_utils.h" 12 #include "chrome/test/base/ui_test_utils.h"
13 #include "content/browser/tab_contents/tab_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
15 #include "net/base/mock_host_resolver.h" 15 #include "net/base/mock_host_resolver.h"
16 16
17 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptAllFrames) { 17 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptAllFrames) {
18 ASSERT_TRUE(StartTestServer()); 18 ASSERT_TRUE(StartTestServer());
19 ASSERT_TRUE(RunExtensionTest("content_scripts/all_frames")) << message_; 19 ASSERT_TRUE(RunExtensionTest("content_scripts/all_frames")) << message_;
20 } 20 }
21 21
22 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptAboutBlankIframes) { 22 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptAboutBlankIframes) {
23 ASSERT_TRUE(StartTestServer()); 23 ASSERT_TRUE(StartTestServer());
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 ui_test_utils::NavigateToURL(browser(), url); 93 ui_test_utils::NavigateToURL(browser(), url);
94 94
95 LoadExtension( 95 LoadExtension(
96 test_data_dir_.AppendASCII("content_scripts/existing_renderers")); 96 test_data_dir_.AppendASCII("content_scripts/existing_renderers"));
97 97
98 signal.Wait(); 98 signal.Wait();
99 99
100 // And check that its styles were affected by the styles that just got loaded. 100 // And check that its styles were affected by the styles that just got loaded.
101 bool styles_injected; 101 bool styles_injected;
102 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 102 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
103 browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", 103 browser()->GetSelectedWebContents()->GetRenderViewHost(), L"",
104 L"window.domAutomationController.send(" 104 L"window.domAutomationController.send("
105 L"document.defaultView.getComputedStyle(document.body, null)." 105 L"document.defaultView.getComputedStyle(document.body, null)."
106 L"getPropertyValue('background-color') == 'rgb(255, 0, 0)')", 106 L"getPropertyValue('background-color') == 'rgb(255, 0, 0)')",
107 &styles_injected)); 107 &styles_injected));
108 ASSERT_TRUE(styles_injected); 108 ASSERT_TRUE(styles_injected);
109 } 109 }
110 110
111 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptCSSLocalization) { 111 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptCSSLocalization) {
112 ASSERT_TRUE(StartTestServer()); 112 ASSERT_TRUE(StartTestServer());
113 ASSERT_TRUE(RunExtensionTest("content_scripts/css_l10n")) << message_; 113 ASSERT_TRUE(RunExtensionTest("content_scripts/css_l10n")) << message_;
(...skipping 17 matching lines...) Expand all
131 ui_test_utils::NavigateToURL( 131 ui_test_utils::NavigateToURL(
132 browser(), test_server()->GetURL("events.html")); 132 browser(), test_server()->GetURL("events.html"));
133 133
134 // Navigate to an extension page that will fire the event events.js is 134 // Navigate to an extension page that will fire the event events.js is
135 // listening for. 135 // listening for.
136 ui_test_utils::NavigateToURLWithDisposition( 136 ui_test_utils::NavigateToURLWithDisposition(
137 browser(), extension->GetResourceURL("fire_event.html"), 137 browser(), extension->GetResourceURL("fire_event.html"),
138 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_NONE); 138 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_NONE);
139 EXPECT_TRUE(catcher.GetNextResult()); 139 EXPECT_TRUE(catcher.GetNextResult());
140 } 140 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/chrome_app_api_browsertest.cc ('k') | chrome/browser/extensions/extension_browsertests_misc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698