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

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: fix conflicts 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
« no previous file with comments | « no previous file | chrome/browser/tab_contents/render_view_context_menu.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4e92a244ee7cfd8501dc11fc382650d819c3c02e..df84214388380c9c6f06d593a855986256fa0d30 100644
--- a/chrome/browser/extensions/platform_app_browsertest.cc
+++ b/chrome/browser/extensions/platform_app_browsertest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/automation/automation_util.h"
#include "chrome/browser/tab_contents/render_view_context_menu.h"
@@ -110,6 +111,61 @@ 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, AppWithContextMenuSelection) {
+ 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.selection_text = ASCIIToUTF16("Hello World");
+ 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_FALSE(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) {
« no previous file with comments | « no previous file | chrome/browser/tab_contents/render_view_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698