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

Unified Diff: chrome/browser/ui/views/constrained_window_views_browsertest.cc

Issue 14283005: Allow showing pending URL for new tab navigations, but only if safe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 7 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: chrome/browser/ui/views/constrained_window_views_browsertest.cc
diff --git a/chrome/browser/ui/views/constrained_window_views_browsertest.cc b/chrome/browser/ui/views/constrained_window_views_browsertest.cc
index f47c041298783f2f5e714cb249a5555c99585bbb..3902b2120a86c7fba0ef06515ed0e58149a1e48a 100644
--- a/chrome/browser/ui/views/constrained_window_views_browsertest.cc
+++ b/chrome/browser/ui/views/constrained_window_views_browsertest.cc
@@ -17,6 +17,7 @@
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
#include "content/public/browser/native_web_keyboard_event.h"
+#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
@@ -331,16 +332,25 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest,
NULL,
web_contents);
+ content::WindowedNotificationObserver back_observer(
+ content::NOTIFICATION_LOAD_STOP,
+ content::Source<content::NavigationController>(
+ &web_contents->GetController()));
content::RenderViewHost* render_view_host =
cwdd->GetWebContents()->GetRenderViewHost();
ForwardKeyEvent(render_view_host, ui::VKEY_BACK);
// Backspace is not processed as accelerator before it's sent to web contents.
+ EXPECT_FALSE(web_contents->GetController().GetPendingEntry());
EXPECT_EQ(about_url.spec(), web_contents->GetURL().spec());
+ // Backspace is processed as accelerator after it's sent to web contents.
content::RunAllPendingInMessageLoop();
+ EXPECT_TRUE(web_contents->GetController().GetPendingEntry());
- // Backspace is processed as accelerator after it's sent to web contents.
+ // Wait for the navigation to commit, since the URL will not be visible
+ // until then.
+ back_observer.Wait();
EXPECT_EQ(new_tab_url.spec(), web_contents->GetURL().spec());
}
« no previous file with comments | « chrome/browser/ui/browser_navigator_browsertest.cc ('k') | content/browser/android/content_view_core_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698