Chromium Code Reviews| Index: content/public/test/browser_test_utils.cc |
| diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc |
| index a1949d3f38c9295b1ad286fb0cc6b66cf524917e..89246f6a6571eabd0db5d5a758905b0a38ff525b 100644 |
| --- a/content/public/test/browser_test_utils.cc |
| +++ b/content/public/test/browser_test_utils.cc |
| @@ -295,6 +295,27 @@ bool IsLastCommittedEntryOfPageType(WebContents* web_contents, |
| return last_entry->GetPageType() == page_type; |
| } |
| +bool NavigateIframeToURL(WebContents* web_contents, |
| + const GURL& url, |
| + std::string iframe_id) { |
| + // TODO(creis): This should wait for LOAD_STOP, but cross-site subframe |
| + // navigations generate extra DidStartLoading and DidStopLoading messages. |
| + // Until we replace swappedout:// with frame proxies, we need to listen for |
| + // something else. For now, we trigger NEW_SUBFRAME navigations and listen |
| + // for commit. |
|
Charlie Reis
2014/12/12 18:02:45
Also mention http://crbug.com/436250.
alexmos
2014/12/13 00:58:12
Done.
|
| + std::string script = base::StringPrintf( |
| + "setTimeout(\"" |
| + "var iframes = document.getElementById('%s');iframes.src='%s';" |
| + "\",0)", |
| + iframe_id.c_str(), url.spec().c_str()); |
| + WindowedNotificationObserver load_observer( |
| + NOTIFICATION_NAV_ENTRY_COMMITTED, |
| + Source<NavigationController>(&web_contents->GetController())); |
| + bool result = ExecuteScript(web_contents, script); |
| + load_observer.Wait(); |
| + return result; |
| +} |
| + |
| void CrashTab(WebContents* web_contents) { |
| RenderProcessHost* rph = web_contents->GetRenderProcessHost(); |
| RenderProcessHostWatcher watcher( |