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

Unified Diff: chrome/browser/extensions/platform_app_browsertest.cc

Issue 10828392: Context menus for text fields in platform apps should show available actions (copy, paste, etc). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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/extensions/platform_app_browsertest.cc
diff --git a/chrome/browser/extensions/platform_app_browsertest.cc b/chrome/browser/extensions/platform_app_browsertest.cc
index da77893260beac04e3476220f861bbe684e0b8ae..410f1ac9a3c2fc46192717f5733ffde8e1609173 100644
--- a/chrome/browser/extensions/platform_app_browsertest.cc
+++ b/chrome/browser/extensions/platform_app_browsertest.cc
@@ -102,6 +102,34 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenu) {
ASSERT_TRUE(menu->HasCommandWithId(IDC_RELOAD));
ASSERT_FALSE(menu->HasCommandWithId(IDC_BACK));
ASSERT_FALSE(menu->HasCommandWithId(IDC_SAVE_PAGE));
+ ASSERT_FALSE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_UNDO));
+}
+
+IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuTextField) {
+ ExtensionTestMessageListener launched_listener("Launched", false);
+ LoadAndLaunchPlatformApp("context_menu");
+
+ // Wait for the extension to tell us it's initialized its context menus and
+ // launched a window.
+ ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+
+ // The context_menu app has one context menu item. This, along with a
+ // separator and the developer tools, is all that should be in the menu.
+ WebContents* web_contents = GetFirstShellWindowWebContents();
+ ASSERT_TRUE(web_contents);
+ WebKit::WebContextMenuData data;
+ content::ContextMenuParams params(data);
+ params.is_editable = true;
+ PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents,
+ params);
+ menu->Init();
+ ASSERT_TRUE(menu->HasCommandWithId(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST));
+ ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTELEMENT));
+ ASSERT_TRUE(menu->HasCommandWithId(IDC_RELOAD));
+ ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_UNDO));
+ ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_COPY));
+ ASSERT_FALSE(menu->HasCommandWithId(IDC_BACK));
+ ASSERT_FALSE(menu->HasCommandWithId(IDC_SAVE_PAGE));
}
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuClicked) {

Powered by Google App Engine
This is Rietveld 408576698