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

Side by Side Diff: chrome/browser/chrome_site_per_process_browsertest.cc

Issue 1502963004: Use content::NavigateIframeToURL in ProcessManagerBrowserTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and use content::NavigateIframeToURL from https://codereview.chromium.org/1522443004/ Created 5 years 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
« no previous file with comments | « no previous file | chrome/browser/extensions/process_manager_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/files/file_path.h"
7 #include "base/path_service.h"
6 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
7 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/tabs/tab_strip_model.h" 10 #include "chrome/browser/ui/tabs/tab_strip_model.h"
9 #include "chrome/test/base/in_process_browser_test.h" 11 #include "chrome/test/base/in_process_browser_test.h"
10 #include "chrome/test/base/ui_test_utils.h" 12 #include "chrome/test/base/ui_test_utils.h"
11 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_service.h" 14 #include "content/public/browser/notification_service.h"
13 #include "content/public/browser/notification_types.h" 15 #include "content/public/browser/notification_types.h"
14 #include "content/public/browser/render_frame_host.h" 16 #include "content/public/browser/render_frame_host.h"
15 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 EXPECT_TRUE(is_object_created); 97 EXPECT_TRUE(is_object_created);
96 EXPECT_TRUE(ExecuteScript(frame_host, 98 EXPECT_TRUE(ExecuteScript(frame_host,
97 "window.webkitRequestFileSystem(" 99 "window.webkitRequestFileSystem("
98 "window.TEMPORARY, 1024, function() {});")); 100 "window.TEMPORARY, 1024, function() {});"));
99 } 101 }
100 102
101 // Ensure that creating a plugin in a cross-site subframe doesn't crash. This 103 // Ensure that creating a plugin in a cross-site subframe doesn't crash. This
102 // involves querying content settings from the renderer process and using the 104 // involves querying content settings from the renderer process and using the
103 // top frame's origin as one of the parameters. See https://crbug.com/426658. 105 // top frame's origin as one of the parameters. See https://crbug.com/426658.
104 IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest, PluginWithRemoteTopFrame) { 106 IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest, PluginWithRemoteTopFrame) {
105 GURL main_url(embedded_test_server()->GetURL("a.com", "/iframe.html")); 107 // Serve from the root so that flash_object.html can load the swf file.
Charlie Reis 2015/12/16 18:44:58 I don't understand why these changes are necessary
Charlie Reis 2015/12/16 20:41:37 Oh, sorry, I missed this part: On 2015/12/16 09:2
alexmos 2015/12/17 02:04:30 Thanks for fixing this! I probably didn't catch t
108 base::FilePath test_data_dir;
109 CHECK(base::PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir));
110 embedded_test_server()->ServeFilesFromDirectory(test_data_dir);
111
112 GURL main_url(
113 embedded_test_server()->GetURL("a.com", "/chrome/test/data/iframe.html"));
106 ui_test_utils::NavigateToURL(browser(), main_url); 114 ui_test_utils::NavigateToURL(browser(), main_url);
107 115
108 // Navigate subframe to a page with a Flash object. 116 // Navigate subframe to a page with a Flash object.
109 content::WebContents* active_web_contents = 117 content::WebContents* active_web_contents =
110 browser()->tab_strip_model()->GetActiveWebContents(); 118 browser()->tab_strip_model()->GetActiveWebContents();
111 GURL frame_url = 119 GURL frame_url =
112 embedded_test_server()->GetURL("b.com", "/flash_object.html"); 120 embedded_test_server()->GetURL("b.com",
113 content::DOMMessageQueue msg_queue; 121 "/chrome/test/data/flash_object.html");
122
114 EXPECT_TRUE(NavigateIframeToURL(active_web_contents, "test", frame_url)); 123 EXPECT_TRUE(NavigateIframeToURL(active_web_contents, "test", frame_url));
115 124
125 content::RenderFrameHost* render_frame_host =
126 content::FrameMatchingPredicate(active_web_contents,
127 base::Bind(&content::FrameMatchesName,
128 "test"));
129 ASSERT_TRUE(render_frame_host);
130 std::string script(
131 "if (performance.timing.loadEventStart) {"
132 " domAutomationController.send(true);"
133 "} else {"
134 " window.addEventListener('load', function() {"
135 " domAutomationController.send(false);"
136 " });"
137 "}");
Charlie Reis 2015/12/16 18:44:58 Is this basically a sanity check that NavigateIfra
robwu 2015/12/18 09:18:01 I've just removed this check. NavigateIframeToURL
138 bool was_onload_triggered = false;
116 // Ensure the page finishes loading without crashing. 139 // Ensure the page finishes loading without crashing.
117 std::string status; 140 EXPECT_TRUE(ExecuteScriptAndExtractBool(render_frame_host, script,
118 while (msg_queue.WaitForMessage(&status)) { 141 &was_onload_triggered));
119 if (status == "\"DONE\"") 142 // NavigateIframeToURL returns when the load event was triggered on the iframe
120 break; 143 // element. This usually happens when the load event was fired in the child
121 } 144 // frame, so we check it here as well.
145 EXPECT_TRUE(was_onload_triggered);
122 } 146 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/process_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698