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

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

Issue 11753009: Simplify ExecuteJavaScript* functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update prerender_browsertest.cc. 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 content::RenderViewHost* host = 372 content::RenderViewHost* host =
373 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); 373 chrome::GetActiveWebContents(browser())->GetRenderViewHost();
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::ExecuteScript(
383 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), 383 chrome::GetActiveWebContents(browser()), "window.inject()"));
384 "",
385 "window.inject()"));
386 384
387 EXPECT_EQ(expected_title2, title_watcher2.WaitAndGetTitle()); 385 EXPECT_EQ(expected_title2, title_watcher2.WaitAndGetTitle());
388 } 386 }
389 387
390 // If this flakes, use http://crbug.com/113057. 388 // If this flakes, use http://crbug.com/113057.
391 IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, NoCallbackAtLoad) { 389 IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, NoCallbackAtLoad) {
392 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( 390 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
393 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); 391 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK);
394 392
395 GURL url("data:application/vnd.npapi-test,CallOnStartup();"); 393 GURL url("data:application/vnd.npapi-test,CallOnStartup();");
396 ui_test_utils::NavigateToURL(browser(), url); 394 ui_test_utils::NavigateToURL(browser(), url);
397 395
398 // Inject the callback function into the HTML page generated by the browser. 396 // Inject the callback function into the HTML page generated by the browser.
399 ASSERT_TRUE(content::ExecuteJavaScript( 397 ASSERT_TRUE(content::ExecuteScript(
400 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), 398 chrome::GetActiveWebContents(browser()),
401 "",
402 "CallOnStartup = function() { document.title = \"OK\"; }")); 399 "CallOnStartup = function() { document.title = \"OK\"; }"));
403 400
404 string16 expected_title(ASCIIToUTF16("OK")); 401 string16 expected_title(ASCIIToUTF16("OK"));
405 content::TitleWatcher title_watcher( 402 content::TitleWatcher title_watcher(
406 chrome::GetActiveWebContents(browser()), expected_title); 403 chrome::GetActiveWebContents(browser()), expected_title);
407 404
408 content::RenderViewHost* host = 405 content::RenderViewHost* host =
409 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); 406 chrome::GetActiveWebContents(browser())->GetRenderViewHost();
410 host->Send(new ChromeViewMsg_LoadBlockedPlugins( 407 host->Send(new ChromeViewMsg_LoadBlockedPlugins(
411 host->GetRoutingID(), std::string())); 408 host->GetRoutingID(), std::string()));
(...skipping 15 matching lines...) Expand all
427 424
428 content::RenderViewHost* host = 425 content::RenderViewHost* host =
429 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); 426 chrome::GetActiveWebContents(browser())->GetRenderViewHost();
430 host->Send(new ChromeViewMsg_LoadBlockedPlugins( 427 host->Send(new ChromeViewMsg_LoadBlockedPlugins(
431 host->GetRoutingID(), std::string())); 428 host->GetRoutingID(), std::string()));
432 429
433 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); 430 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
434 } 431 }
435 432
436 #endif // !defined(USE_AURA) 433 #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