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

Side by Side Diff: chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc

Issue 275833002: Implement "Copy image" for canvas (chromium side). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 6 years, 5 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
« no previous file with comments | « chrome/browser/renderer_context_menu/render_view_context_menu.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 scoped_ptr<TestRenderViewContextMenu> menu( 70 scoped_ptr<TestRenderViewContextMenu> menu(
71 CreateContextMenu(GURL("chrome://history"), 71 CreateContextMenu(GURL("chrome://history"),
72 GURL())); 72 GURL()));
73 73
74 ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB)); 74 ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB));
75 ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW)); 75 ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW));
76 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_COPYLINKLOCATION)); 76 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_COPYLINKLOCATION));
77 } 77 }
78 78
79 IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, 79 IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest,
80 SaveAsImageForCanvas) { 80 ContextMenuForCanvas) {
81 content::ContextMenuParams params; 81 content::ContextMenuParams params;
82 params.media_type = blink::WebContextMenuData::MediaTypeCanvas; 82 params.media_type = blink::WebContextMenuData::MediaTypeCanvas;
83 83
84 TestRenderViewContextMenu menu( 84 TestRenderViewContextMenu menu(
85 browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(), 85 browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(),
86 params); 86 params);
87 menu.Init(); 87 menu.Init();
88 88
89 ASSERT_TRUE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_SAVEIMAGEAS)); 89 ASSERT_TRUE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_SAVEIMAGEAS));
90 ASSERT_TRUE(menu.IsItemPresent(IDC_CONTENT_CONTEXT_COPYIMAGE));
90 } 91 }
91 92
92 // Opens a link in a new tab via a "real" context menu. 93 // Opens a link in a new tab via a "real" context menu.
93 IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, RealMenu) { 94 IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, RealMenu) {
94 ContextMenuNotificationObserver menu_observer( 95 ContextMenuNotificationObserver menu_observer(
95 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); 96 IDC_CONTENT_CONTEXT_OPENLINKNEWTAB);
96 ui_test_utils::WindowedTabAddedNotificationObserver tab_observer( 97 ui_test_utils::WindowedTabAddedNotificationObserver tab_observer(
97 content::NotificationService::AllSources()); 98 content::NotificationService::AllSources());
98 99
99 // Go to a page with a link 100 // Go to a page with a link
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 menu.Init(); 249 menu.Init();
249 250
250 // The item shouldn't be enabled in the menu. 251 // The item shouldn't be enabled in the menu.
251 EXPECT_FALSE(menu.IsCommandIdEnabled(IDC_CONTENT_CONTEXT_VIEWPAGEINFO)); 252 EXPECT_FALSE(menu.IsCommandIdEnabled(IDC_CONTENT_CONTEXT_VIEWPAGEINFO));
252 253
253 // Ensure that viewing page info doesn't crash even if you can get to it. 254 // Ensure that viewing page info doesn't crash even if you can get to it.
254 menu.ExecuteCommand(IDC_CONTENT_CONTEXT_VIEWPAGEINFO, 0); 255 menu.ExecuteCommand(IDC_CONTENT_CONTEXT_VIEWPAGEINFO, 0);
255 } 256 }
256 257
257 } // namespace 258 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/renderer_context_menu/render_view_context_menu.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698