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

Side by Side Diff: content/test/content_browser_test_utils_internal.cc

Issue 1224363002: OOPIF: Fix window.open to work from frames with remote parent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove internal:: from ToRenderFrameHost Created 5 years, 5 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
« no previous file with comments | « content/test/content_browser_test_utils_internal.h ('k') | content/test/test_web_contents.h » ('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 "content/test/content_browser_test_utils_internal.h" 5 #include "content/test/content_browser_test_utils_internal.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "content/browser/frame_host/frame_tree_node.h" 13 #include "content/browser/frame_host/frame_tree_node.h"
14 #include "content/browser/frame_host/navigator.h" 14 #include "content/browser/frame_host/navigator.h"
15 #include "content/browser/frame_host/render_frame_proxy_host.h" 15 #include "content/browser/frame_host/render_frame_proxy_host.h"
16 #include "content/public/test/browser_test_utils.h"
17 #include "content/public/test/content_browser_test_utils.h"
18 #include "content/shell/browser/shell.h"
16 #include "content/test/test_frame_navigation_observer.h" 19 #include "content/test/test_frame_navigation_observer.h"
17 #include "url/gurl.h" 20 #include "url/gurl.h"
18 21
19 namespace content { 22 namespace content {
20 23
21 void NavigateFrameToURL(FrameTreeNode* node, const GURL& url) { 24 void NavigateFrameToURL(FrameTreeNode* node, const GURL& url) {
22 TestFrameNavigationObserver observer(node); 25 TestFrameNavigationObserver observer(node);
23 NavigationController::LoadURLParams params(url); 26 NavigationController::LoadURLParams params(url);
24 params.transition_type = ui::PAGE_TRANSITION_LINK; 27 params.transition_type = ui::PAGE_TRANSITION_LINK;
25 params.frame_tree_node_id = node->frame_tree_node_id(); 28 params.frame_tree_node_id = node->frame_tree_node_id();
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 if (index == seen_site_instance_ids_.size()) 215 if (index == seen_site_instance_ids_.size())
213 seen_site_instance_ids_.push_back(site_instance->GetId()); 216 seen_site_instance_ids_.push_back(site_instance->GetId());
214 217
215 // Whosoever writes a test using >=26 site instances shall be a lucky ducky. 218 // Whosoever writes a test using >=26 site instances shall be a lucky ducky.
216 if (index < 25) 219 if (index < 25)
217 return base::StringPrintf("%c", 'A' + static_cast<char>(index)); 220 return base::StringPrintf("%c", 'A' + static_cast<char>(index));
218 else 221 else
219 return base::StringPrintf("Z%d", static_cast<int>(index - 25)); 222 return base::StringPrintf("Z%d", static_cast<int>(index - 25));
220 } 223 }
221 224
225 Shell* OpenPopup(const ToRenderFrameHost& opener,
226 const GURL& url,
227 const std::string& name) {
228 ShellAddedObserver new_shell_observer;
229 bool did_create_popup = false;
230 bool did_execute_script = ExecuteScriptAndExtractBool(
231 opener,
232 "window.domAutomationController.send("
233 " !!window.open('" + url.spec() + "', '" + name + "'));",
234 &did_create_popup);
235 if (!did_execute_script || !did_create_popup)
236 return nullptr;
237
238 Shell* new_shell = new_shell_observer.GetShell();
239 WaitForLoadStop(new_shell->web_contents());
240 return new_shell;
241 }
242
222 } // namespace content 243 } // namespace content
OLDNEW
« no previous file with comments | « content/test/content_browser_test_utils_internal.h ('k') | content/test/test_web_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698