Chromium Code Reviews| 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 |