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

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

Issue 11728003: Change ExecuteJavaScript* helper functions in browser_test_utils.{h,cc} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding files for gpu_tests and NaCl browser tests. Created 7 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) 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 host->Send(new ChromeViewMsg_LoadBlockedPlugins( 374 host->Send(new ChromeViewMsg_LoadBlockedPlugins(
375 host->GetRoutingID(), std::string())); 375 host->GetRoutingID(), std::string()));
376 EXPECT_EQ(expected_title1, title_watcher1.WaitAndGetTitle()); 376 EXPECT_EQ(expected_title1, title_watcher1.WaitAndGetTitle());
377 377
378 string16 expected_title2(ASCIIToUTF16("2")); 378 string16 expected_title2(ASCIIToUTF16("2"));
379 content::TitleWatcher title_watcher2( 379 content::TitleWatcher title_watcher2(
380 chrome::GetActiveWebContents(browser()), expected_title2); 380 chrome::GetActiveWebContents(browser()), expected_title2);
381 381
382 ASSERT_TRUE(content::ExecuteJavaScript( 382 ASSERT_TRUE(content::ExecuteJavaScript(
383 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), 383 chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
384 L"", L"window.inject()")); 384 "",
385 "window.inject()"));
385 386
386 EXPECT_EQ(expected_title2, title_watcher2.WaitAndGetTitle()); 387 EXPECT_EQ(expected_title2, title_watcher2.WaitAndGetTitle());
387 } 388 }
388 389
389 // If this flakes, use http://crbug.com/113057. 390 // If this flakes, use http://crbug.com/113057.
390 IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, NoCallbackAtLoad) { 391 IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, NoCallbackAtLoad) {
391 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( 392 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
392 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); 393 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK);
393 394
394 GURL url("data:application/vnd.npapi-test,CallOnStartup();"); 395 GURL url("data:application/vnd.npapi-test,CallOnStartup();");
395 ui_test_utils::NavigateToURL(browser(), url); 396 ui_test_utils::NavigateToURL(browser(), url);
396 397
397 // Inject the callback function into the HTML page generated by the browser. 398 // Inject the callback function into the HTML page generated by the browser.
398 ASSERT_TRUE(content::ExecuteJavaScript( 399 ASSERT_TRUE(content::ExecuteJavaScript(
399 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), 400 chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
400 L"", L"CallOnStartup = function() { document.title = \"OK\"; }")); 401 "",
402 "CallOnStartup = function() { document.title = \"OK\"; }"));
401 403
402 string16 expected_title(ASCIIToUTF16("OK")); 404 string16 expected_title(ASCIIToUTF16("OK"));
403 content::TitleWatcher title_watcher( 405 content::TitleWatcher title_watcher(
404 chrome::GetActiveWebContents(browser()), expected_title); 406 chrome::GetActiveWebContents(browser()), expected_title);
405 407
406 content::RenderViewHost* host = 408 content::RenderViewHost* host =
407 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); 409 chrome::GetActiveWebContents(browser())->GetRenderViewHost();
408 host->Send(new ChromeViewMsg_LoadBlockedPlugins( 410 host->Send(new ChromeViewMsg_LoadBlockedPlugins(
409 host->GetRoutingID(), std::string())); 411 host->GetRoutingID(), std::string()));
410 412
(...skipping 14 matching lines...) Expand all
425 427
426 content::RenderViewHost* host = 428 content::RenderViewHost* host =
427 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); 429 chrome::GetActiveWebContents(browser())->GetRenderViewHost();
428 host->Send(new ChromeViewMsg_LoadBlockedPlugins( 430 host->Send(new ChromeViewMsg_LoadBlockedPlugins(
429 host->GetRoutingID(), std::string())); 431 host->GetRoutingID(), std::string()));
430 432
431 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); 433 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
432 } 434 }
433 435
434 #endif // !defined(USE_AURA) 436 #endif // !defined(USE_AURA)
OLDNEW
« no previous file with comments | « chrome/browser/chrome_switches_browsertest.cc ('k') | chrome/browser/devtools/devtools_sanity_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698