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

Unified Diff: content/browser/web_contents/web_contents_impl_browsertest.cc

Issue 1530183004: Revert 3 CLs for shouldOverrideUrlLoading implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (simple conflict in AwContentsClientShouldOverrideUrlLoadingTest). Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/web_contents_impl_browsertest.cc
diff --git a/content/browser/web_contents/web_contents_impl_browsertest.cc b/content/browser/web_contents/web_contents_impl_browsertest.cc
index a0a9c40fe13677bfb6ab8d825940b17f9698095c..532cf018ff75835e539d3dc92fd89b18181a7961 100644
--- a/content/browser/web_contents/web_contents_impl_browsertest.cc
+++ b/content/browser/web_contents/web_contents_impl_browsertest.cc
@@ -189,6 +189,60 @@ class LoadingStateChangedDelegate : public WebContentsDelegate {
int loadingStateToDifferentDocumentCount_;
};
+// See: http://crbug.com/298193
+#if defined(OS_WIN) || defined(OS_LINUX)
+#define MAYBE_DidStopLoadingDetails DISABLED_DidStopLoadingDetails
+#else
+#define MAYBE_DidStopLoadingDetails DidStopLoadingDetails
+#endif
+
+// Test that DidStopLoading includes the correct URL in the details.
+IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
+ MAYBE_DidStopLoadingDetails) {
+ ASSERT_TRUE(embedded_test_server()->Start());
+
+ LoadStopNotificationObserver load_observer(
+ &shell()->web_contents()->GetController());
+ NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html"));
+ load_observer.Wait();
+
+ EXPECT_EQ("/title1.html", load_observer.url_.path());
+ EXPECT_EQ(0, load_observer.session_index_);
+ EXPECT_EQ(&shell()->web_contents()->GetController(),
+ load_observer.controller_);
+}
+
+// See: http://crbug.com/298193
+#if defined(OS_WIN) || defined(OS_LINUX)
+#define MAYBE_DidStopLoadingDetailsWithPending \
+ DISABLED_DidStopLoadingDetailsWithPending
+#else
+#define MAYBE_DidStopLoadingDetailsWithPending DidStopLoadingDetailsWithPending
+#endif
+
+// Test that DidStopLoading includes the correct URL in the details when a
+// pending entry is present.
+IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
+ MAYBE_DidStopLoadingDetailsWithPending) {
+ ASSERT_TRUE(embedded_test_server()->Start());
+ GURL url("data:text/html,<div>test</div>");
+
+ // Listen for the first load to stop.
+ LoadStopNotificationObserver load_observer(
+ &shell()->web_contents()->GetController());
+ // Start a new pending navigation as soon as the first load commits.
+ // We will hear a DidStopLoading from the first load as the new load
+ // is started.
+ NavigateOnCommitObserver commit_observer(
+ shell(), embedded_test_server()->GetURL("/title2.html"));
+ NavigateToURL(shell(), url);
+ load_observer.Wait();
+
+ EXPECT_EQ(url, load_observer.url_);
+ EXPECT_EQ(0, load_observer.session_index_);
+ EXPECT_EQ(&shell()->web_contents()->GetController(),
+ load_observer.controller_);
+}
// Test that a renderer-initiated navigation to an invalid URL does not leave
// around a pending entry that could be used in a URL spoof. We test this in
// a browser test because our unit test framework incorrectly calls
« no previous file with comments | « components/navigation_interception/intercept_navigation_throttle.cc ('k') | content/public/renderer/content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698