Commit 9c328adc authored by Bo Liu's avatar Bo Liu Committed by Commit Bot

Fix PopupWindowBrowserNavResumeLoad

Loading "file://" on higher versions of android will simply hang instead
of finish in an error, thus causing the test to fail. Presumably on
higher versions with dynamic permissions, browser is waiting for user
consent which is probably not implemented in content shell or tests.

Change it to link to itself instead, which is guaranteed to work.

Bug: 990854
Change-Id: I6501deb0899a4c99f4a917e5ee1fd6ae144cdff3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1817100
Commit-Queue: Bo <boliu@chromium.org>
Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699284}
parent 4cdf6ead
...@@ -3430,15 +3430,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, FrozenAndUnfrozenIPC) { ...@@ -3430,15 +3430,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, FrozenAndUnfrozenIPC) {
EXPECT_TRUE(delete_rfh_c.deleted()); EXPECT_TRUE(delete_rfh_c.deleted());
} }
// http://crbug.com/990854
#if defined(OS_ANDROID)
#define MAYBE_PopupWindowBrowserNavResumeLoad \
DISABLED_PopupWindowBrowserNavResumeLoad
#else
#define MAYBE_PopupWindowBrowserNavResumeLoad PopupWindowBrowserNavResumeLoad
#endif
IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
MAYBE_PopupWindowBrowserNavResumeLoad) { PopupWindowBrowserNavResumeLoad) {
// This test verifies a pop up that requires navigation from browser side // This test verifies a pop up that requires navigation from browser side
// works with a delegate that delays navigations of pop ups. // works with a delegate that delays navigations of pop ups.
// Create a file: scheme pop up from a file: scheme page, which requires // Create a file: scheme pop up from a file: scheme page, which requires
...@@ -3460,8 +3453,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ...@@ -3460,8 +3453,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
ShellAddedObserver new_shell_observer; ShellAddedObserver new_shell_observer;
bool success = false; bool success = false;
EXPECT_TRUE(ExecuteScriptAndExtractBool( EXPECT_TRUE(ExecuteScriptAndExtractBool(
shell(), shell(), "window.domAutomationController.send(clickLinkToSelf());",
"window.domAutomationController.send(clickDeadFileNewWindowLink());",
&success)); &success));
new_shell = new_shell_observer.GetShell(); new_shell = new_shell_observer.GetShell();
new_contents = new_shell->web_contents(); new_contents = new_shell->web_contents();
...@@ -3472,10 +3464,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ...@@ -3472,10 +3464,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
EXPECT_FALSE(new_contents->GetDelegate()); EXPECT_FALSE(new_contents->GetDelegate());
new_contents->SetDelegate(new_shell); new_contents->SetDelegate(new_shell);
new_contents->ResumeLoadingCreatedWebContents(); new_contents->ResumeLoadingCreatedWebContents();
// Dead file link may or may not load depending on OS. The result is not
// relevant for this test, so not checking the the result.
WaitForLoadStop(new_contents); WaitForLoadStop(new_contents);
EXPECT_TRUE(new_contents->GetLastCommittedURL().SchemeIs("file")); EXPECT_EQ(url, new_contents->GetLastCommittedURL());
} }
namespace { namespace {
......
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
return simulateClick(document.getElementById("view_source_link")); return simulateClick(document.getElementById("view_source_link"));
} }
function clickDeadFileNewWindowLink() { function clickLinkToSelf() {
return simulateClick(document.getElementById("dead_file_new_window_link")); return simulateClick(document.getElementById("linkToSelf"));
} }
function clickGoogleChromeLink() { function clickGoogleChromeLink() {
...@@ -55,6 +55,9 @@ ...@@ -55,6 +55,9 @@
<a href="view-source:about:blank" id="view_source_link">view-source:</a><br> <a href="view-source:about:blank" id="view_source_link">view-source:</a><br>
<a href="title2.html" id="same_site_new_window_link" target="_blank">same-site new window</a> <a href="title2.html" id="same_site_new_window_link" target="_blank">same-site new window</a>
<a href="http://foo.com/title2.html" id="cross_site_new_window_link" target="_blank">cross-site new window</a> <a href="http://foo.com/title2.html" id="cross_site_new_window_link" target="_blank">cross-site new window</a>
<a href="file://" id="dead_file_new_window_link" target="_blank">dead-file new window</a> <a href="" id="linkToSelf" target="_blank">self new window</a>
<script>
document.getElementById("linkToSelf").href = window.location.toString();
</script>
<a href="googlechrome://" id="google_chrome_link">googlechrome:</a></br> <a href="googlechrome://" id="google_chrome_link">googlechrome:</a></br>
</html> </html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment