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

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

Issue 10832348: Tab value for context menu onclick event should be optional. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update the test code to chrome.app.runtime instead of experimental 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 | « chrome/browser/extensions/menu_manager.cc ('k') | chrome/common/extensions/api/context_menus.json » ('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 65441b602bed50f81f989267aa1a453ba7c8fa6e..da77893260beac04e3476220f861bbe684e0b8ae 100644
--- a/chrome/browser/extensions/platform_app_browsertest.cc
+++ b/chrome/browser/extensions/platform_app_browsertest.cc
@@ -104,6 +104,33 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenu) {
ASSERT_FALSE(menu->HasCommandWithId(IDC_SAVE_PAGE));
}
+IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuClicked) {
+ ExtensionTestMessageListener launched_listener("Launched", false);
+ LoadAndLaunchPlatformApp("context_menu_click");
+
+ // Wait for the extension to tell us it's initialized its context menus and
+ // launched a window.
+ ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
+
+ // Test that the menu item shows up
+ WebContents* web_contents = GetFirstShellWindowWebContents();
+ ASSERT_TRUE(web_contents);
+ WebKit::WebContextMenuData data;
+ content::ContextMenuParams params(data);
+ params.page_url = GURL("http://foo.bar");
+ PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents,
+ params);
+ menu->Init();
+ ASSERT_TRUE(menu->HasCommandWithId(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST));
+
+ // Execute the menu item
+ ExtensionTestMessageListener onclicked_listener("onClicked fired for id1",
+ false);
+ menu->ExecuteCommand(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST);
+
+ ASSERT_TRUE(onclicked_listener.WaitUntilSatisfied());
+}
+
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DisallowNavigation) {
ASSERT_TRUE(StartTestServer());
ASSERT_TRUE(RunPlatformAppTest("platform_apps/navigation")) << message_;
« no previous file with comments | « chrome/browser/extensions/menu_manager.cc ('k') | chrome/common/extensions/api/context_menus.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698