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

Side by Side Diff: chrome/browser/content_settings/content_settings_browsertest.cc

Issue 10795090: Move ExecuteJavaScript functions from ui_test_utils.h to browser_test_utils.h so they can be reused… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/content_settings/cookie_settings.h" 9 #include "chrome/browser/content_settings/cookie_settings.h"
10 #include "chrome/browser/content_settings/host_content_settings_map.h" 10 #include "chrome/browser/content_settings/host_content_settings_map.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 content::RenderViewHost* host = 133 content::RenderViewHost* host =
134 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); 134 chrome::GetActiveWebContents(browser())->GetRenderViewHost();
135 host->Send(new ChromeViewMsg_LoadBlockedPlugins( 135 host->Send(new ChromeViewMsg_LoadBlockedPlugins(
136 host->GetRoutingID(), std::string())); 136 host->GetRoutingID(), std::string()));
137 EXPECT_EQ(expected_title1, title_watcher1.WaitAndGetTitle()); 137 EXPECT_EQ(expected_title1, title_watcher1.WaitAndGetTitle());
138 138
139 string16 expected_title2(ASCIIToUTF16("2")); 139 string16 expected_title2(ASCIIToUTF16("2"));
140 content::TitleWatcher title_watcher2( 140 content::TitleWatcher title_watcher2(
141 chrome::GetActiveWebContents(browser()), expected_title2); 141 chrome::GetActiveWebContents(browser()), expected_title2);
142 142
143 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( 143 ASSERT_TRUE(content::ExecuteJavaScript(
144 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), 144 chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
145 L"", L"window.inject()")); 145 L"", L"window.inject()"));
146 146
147 EXPECT_EQ(expected_title2, title_watcher2.WaitAndGetTitle()); 147 EXPECT_EQ(expected_title2, title_watcher2.WaitAndGetTitle());
148 } 148 }
149 149
150 // If this flakes, use http://crbug.com/113057. 150 // If this flakes, use http://crbug.com/113057.
151 IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, NoCallbackAtLoad) { 151 IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, NoCallbackAtLoad) {
152 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( 152 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
153 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); 153 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK);
154 154
155 GURL url("data:application/vnd.npapi-test,CallOnStartup();"); 155 GURL url("data:application/vnd.npapi-test,CallOnStartup();");
156 ui_test_utils::NavigateToURL(browser(), url); 156 ui_test_utils::NavigateToURL(browser(), url);
157 157
158 // Inject the callback function into the HTML page generated by the browser. 158 // Inject the callback function into the HTML page generated by the browser.
159 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( 159 ASSERT_TRUE(content::ExecuteJavaScript(
160 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), 160 chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
161 L"", L"CallOnStartup = function() { document.title = \"OK\"; }")); 161 L"", L"CallOnStartup = function() { document.title = \"OK\"; }"));
162 162
163 string16 expected_title(ASCIIToUTF16("OK")); 163 string16 expected_title(ASCIIToUTF16("OK"));
164 content::TitleWatcher title_watcher( 164 content::TitleWatcher title_watcher(
165 chrome::GetActiveWebContents(browser()), expected_title); 165 chrome::GetActiveWebContents(browser()), expected_title);
166 166
167 content::RenderViewHost* host = 167 content::RenderViewHost* host =
168 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); 168 chrome::GetActiveWebContents(browser())->GetRenderViewHost();
169 host->Send(new ChromeViewMsg_LoadBlockedPlugins( 169 host->Send(new ChromeViewMsg_LoadBlockedPlugins(
170 host->GetRoutingID(), std::string())); 170 host->GetRoutingID(), std::string()));
171 171
172 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); 172 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
173 } 173 }
174 174
175 #endif // !defined(USE_AURA) 175 #endif // !defined(USE_AURA)
OLDNEW
« no previous file with comments | « chrome/browser/chrome_switches_browsertest.cc ('k') | chrome/browser/debugger/devtools_sanity_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698