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

Unified Diff: chrome/browser/ui/browser_browsertest.cc

Issue 232463007: Don't leave aborted URLs in the omnibox unless we're on a new tab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 8 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
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | content/browser/frame_host/navigation_controller_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_browsertest.cc
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index 930e4e330553049b0a539dc488f27020a011cdc0..b333ac7038a383204b02b0da658eb74b2f3bda5b 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/search/search.h"
#include "chrome/browser/sessions/session_backend.h"
#include "chrome/browser/sessions/session_service_factory.h"
#include "chrome/browser/translate/translate_tab_helper.h"
@@ -469,6 +470,50 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_ThirtyFourTabs) {
}
}
+// Test that a browser-initiated navigation to an aborted URL load leaves around
+// a pending entry if we start from the NTP but not from a normal page.
+// See http://crbug.com/355537.
+IN_PROC_BROWSER_TEST_F(BrowserTest, ClearPendingOnFailUnlessNTP) {
+ ASSERT_TRUE(test_server()->Start());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ GURL ntp_url(chrome::GetNewTabPageURL(browser()->profile()));
+ ui_test_utils::NavigateToURL(browser(), ntp_url);
+
+ // Navigate to a 204 URL (aborts with no content) on the NTP and make sure it
+ // sticks around so that the user can edit it.
+ GURL abort_url(test_server()->GetURL("nocontent"));
+ {
+ content::WindowedNotificationObserver stop_observer(
+ content::NOTIFICATION_LOAD_STOP,
+ content::Source<NavigationController>(
+ &web_contents->GetController()));
+ browser()->OpenURL(OpenURLParams(abort_url, Referrer(), CURRENT_TAB,
+ content::PAGE_TRANSITION_TYPED, false));
+ stop_observer.Wait();
+ EXPECT_TRUE(web_contents->GetController().GetPendingEntry());
+ EXPECT_EQ(abort_url, web_contents->GetVisibleURL());
+ }
+
+ // Navigate to a real URL.
+ GURL real_url(test_server()->GetURL("title1.html"));
+ ui_test_utils::NavigateToURL(browser(), real_url);
+ EXPECT_EQ(real_url, web_contents->GetVisibleURL());
+
+ // Now navigating to a 204 URL should clear the pending entry.
+ {
+ content::WindowedNotificationObserver stop_observer(
+ content::NOTIFICATION_LOAD_STOP,
+ content::Source<NavigationController>(
+ &web_contents->GetController()));
+ browser()->OpenURL(OpenURLParams(abort_url, Referrer(), CURRENT_TAB,
+ content::PAGE_TRANSITION_TYPED, false));
+ stop_observer.Wait();
+ EXPECT_FALSE(web_contents->GetController().GetPendingEntry());
+ EXPECT_EQ(real_url, web_contents->GetVisibleURL());
+ }
+}
+
// Test for crbug.com/297289. Ensure that modal dialogs are closed when a
// cross-process navigation is ready to commit.
IN_PROC_BROWSER_TEST_F(BrowserTest, CrossProcessNavCancelsDialogs) {
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | content/browser/frame_host/navigation_controller_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698