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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 216
217 // Verify that the referrer on the page matches |kEmptyReferrer|. 217 // Verify that the referrer on the page matches |kEmptyReferrer|.
218 std::string page_referrer; 218 std::string page_referrer;
219 ASSERT_TRUE(content::ExecuteScriptAndExtractString( 219 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
220 tab, 220 tab,
221 "window.domAutomationController.send(window.document.referrer);", 221 "window.domAutomationController.send(window.document.referrer);",
222 &page_referrer)); 222 &page_referrer));
223 ASSERT_EQ(kEmptyReferrer, page_referrer); 223 ASSERT_EQ(kEmptyReferrer, page_referrer);
224 } 224 }
225 225
226 // Ensure that View Page Info won't crash if there is no visible entry.
227 // See http://crbug.com/370863.
228 IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, ViewPageInfoWithNoEntry) {
229 // Create a new tab with no committed entry.
230 ui_test_utils::WindowedTabAddedNotificationObserver tab_observer(
231 content::NotificationService::AllSources());
232 ASSERT_TRUE(content::ExecuteScript(
233 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
234 tab_observer.Wait();
235 content::WebContents* tab = tab_observer.GetTab();
236 EXPECT_FALSE(tab->GetController().GetLastCommittedEntry());
237 EXPECT_FALSE(tab->GetController().GetVisibleEntry());
238
239 // Create a context menu.
240 content::ContextMenuParams context_menu_params;
241 TestRenderViewContextMenu menu(tab->GetMainFrame(), context_menu_params);
242 menu.Init();
243
244 // The item shouldn't be enabled in the menu.
245 EXPECT_FALSE(menu.IsCommandIdEnabled(IDC_CONTENT_CONTEXT_VIEWPAGEINFO));
246
247 // Ensure that viewing page info doesn't crash even if you can get to it.
248 menu.ExecuteCommand(IDC_CONTENT_CONTEXT_VIEWPAGEINFO, 0);
249 }
250
226 } // namespace 251 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698