Commit 6b86f957 authored by mkosiba@chromium.org's avatar mkosiba@chromium.org

Use a data url in DidStopLoadingDetailsWithPending test.

This is to make the test continue passing after http://crrev.com/181493007
lands. The test was relying on the renderer stopping all loaders when a
new navigation is issued (which would result in a DidStopLoading callback).
After the mentioned CL lands the renderer will not stop+restart loading when
asked to navigate during a load breaking the test.

The fix is to use a data URL which will result in a DidStopLoading immediately
after the didCommitProvisionalLoad callback. Since the test is only checking
whether the UI-side state is correct it doesn't matter that the DidStopLoading
IPC is pending when didCommitProvisionalLoad is being received.

BUG=325351
TEST=content_browsertests

Review URL: https://codereview.chromium.org/306893002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273758 0039d316-1c4b-4281-b951-d872f2087c98
parent ffb84938
...@@ -97,6 +97,7 @@ class NavigateOnCommitObserver : public WebContentsObserver { ...@@ -97,6 +97,7 @@ class NavigateOnCommitObserver : public WebContentsObserver {
const LoadCommittedDetails& load_details) OVERRIDE { const LoadCommittedDetails& load_details) OVERRIDE {
if (!done_) { if (!done_) {
done_ = true; done_ = true;
shell_->Stop();
shell_->LoadURL(url_); shell_->LoadURL(url_);
} }
} }
...@@ -212,6 +213,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ...@@ -212,6 +213,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
MAYBE_DidStopLoadingDetailsWithPending) { MAYBE_DidStopLoadingDetailsWithPending) {
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
GURL url("data:text/html,<div>test</div>");
// Listen for the first load to stop. // Listen for the first load to stop.
LoadStopNotificationObserver load_observer( LoadStopNotificationObserver load_observer(
...@@ -221,10 +223,10 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ...@@ -221,10 +223,10 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
// is started. // is started.
NavigateOnCommitObserver commit_observer( NavigateOnCommitObserver commit_observer(
shell(), embedded_test_server()->GetURL("/title2.html")); shell(), embedded_test_server()->GetURL("/title2.html"));
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); NavigateToURL(shell(), url);
load_observer.Wait(); load_observer.Wait();
EXPECT_EQ("/title1.html", load_observer.url_.path()); EXPECT_EQ(url, load_observer.url_);
EXPECT_EQ(0, load_observer.session_index_); EXPECT_EQ(0, load_observer.session_index_);
EXPECT_EQ(&shell()->web_contents()->GetController(), EXPECT_EQ(&shell()->web_contents()->GetController(),
load_observer.controller_); load_observer.controller_);
......
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