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

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

Issue 2086333002: Only show the open link as user context menu if at least one of the profiles is open (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 d2101d8366a1c62b04bde1fedd6356b9b6204faa..3303b01d669ff91b2362b792fea8a743d7156c91 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
@@ -419,7 +419,7 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, OpenLinkInProfileEntryPresent) {
}
// Create one additional profile, but do not yet open windows in it.
- CreateSecondaryProfile(1);
+ Profile* profile1 = CreateSecondaryProfile(1);
Peter Kasting 2016/06/22 22:53:21 Nit: There's no |profile2|, so just call this |pro
{
std::unique_ptr<TestRenderViewContextMenu> menu(
@@ -429,8 +429,24 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, OpenLinkInProfileEntryPresent) {
ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB));
ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW));
ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_COPYLINKLOCATION));
- // With two profiles (the current and another profile), no submenu is
- // created. Instead, a single item is added to the main context menu.
+ // With the second profile not open, no entry is created.
+ ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKINPROFILE));
+ ASSERT_FALSE(menu->IsItemPresent(IDC_OPEN_LINK_IN_PROFILE_FIRST));
+ }
+
+ profiles::FindOrCreateNewWindowForProfile(
+ profile1, chrome::startup::IS_NOT_PROCESS_STARTUP,
+ chrome::startup::IS_NOT_FIRST_RUN, false);
+
+ {
+ std::unique_ptr<TestRenderViewContextMenu> menu(
+ CreateContextMenuMediaTypeNone(GURL("http://www.google.com/"),
+ GURL("http://www.google.com/")));
+
+ ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB));
+ ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW));
+ ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_COPYLINKLOCATION));
+ // With the second profile open, an inline menu entry is created.
ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKINPROFILE));
ASSERT_TRUE(menu->IsItemPresent(IDC_OPEN_LINK_IN_PROFILE_FIRST));
}

Powered by Google App Engine
This is Rietveld 408576698