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

Unified Diff: chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc

Issue 273163003: Fix uses of NavigationEntries in RenderViewContextMenu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test Created 6 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/renderer_context_menu/render_view_context_menu_browsertest.cc
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc
index b09b51890f11a662cd7ed467edb671214d29bc53..3e20b30d0adbbcc1e3f319ed05dbcb367a4817cf 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc
@@ -223,4 +223,29 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, OpenIncognitoNoneReferrer) {
ASSERT_EQ(kEmptyReferrer, page_referrer);
}
+// Ensure that View Page Info won't crash if there is no visible entry.
+// See http://crbug.com/370863.
+IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, ViewPageInfoWithNoEntry) {
+ // Create a new tab with no committed entry.
+ ui_test_utils::WindowedTabAddedNotificationObserver tab_observer(
+ content::NotificationService::AllSources());
+ ASSERT_TRUE(content::ExecuteScript(
+ browser()->tab_strip_model()->GetActiveWebContents(), "window.open();"));
nasko 2014/05/09 22:56:08 Will the about:blank synchronous navigation issue
Charlie Reis 2014/05/09 23:34:43 Good question. Looks like it does send a didCommi
+ tab_observer.Wait();
+ content::WebContents* tab = tab_observer.GetTab();
+ EXPECT_FALSE(tab->GetController().GetLastCommittedEntry());
+ EXPECT_FALSE(tab->GetController().GetVisibleEntry());
+
+ // Create a context menu.
+ content::ContextMenuParams context_menu_params;
+ TestRenderViewContextMenu menu(tab->GetMainFrame(), context_menu_params);
+ menu.Init();
+
+ // The item shouldn't be enabled in the menu.
+ EXPECT_FALSE(menu.IsCommandIdEnabled(IDC_CONTENT_CONTEXT_VIEWPAGEINFO));
+
+ // Ensure that viewing page info doesn't crash even if you can get to it.
+ menu.ExecuteCommand(IDC_CONTENT_CONTEXT_VIEWPAGEINFO, 0);
+}
+
} // namespace

Powered by Google App Engine
This is Rietveld 408576698