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

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

Issue 10907243: Add "inspect background page" to platform app right-click menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add test for app loaded from .crx Created 8 years, 3 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 50165a1710d68971ebb90e5b935b377e93d79a05..3ca358ba0ed849fa00afdedaff7be633fdaa2f2c 100644
--- a/chrome/browser/extensions/platform_app_browsertest.cc
+++ b/chrome/browser/extensions/platform_app_browsertest.cc
@@ -169,6 +169,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, EmptyContextMenu) {
menu.reset(new PlatformAppContextMenu(web_contents, params));
menu->Init();
ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTELEMENT));
+ ASSERT_TRUE(
+ menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE));
ASSERT_TRUE(menu->HasCommandWithId(IDC_RELOAD));
ASSERT_FALSE(menu->HasCommandWithId(IDC_BACK));
ASSERT_FALSE(menu->HasCommandWithId(IDC_SAVE_PAGE));
@@ -194,12 +196,42 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenu) {
ASSERT_TRUE(menu->HasCommandWithId(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST));
ASSERT_TRUE(menu->HasCommandWithId(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST + 1));
ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTELEMENT));
+ ASSERT_TRUE(
+ menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE));
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, InstalledAppWithContextMenu) {
+ ExtensionTestMessageListener launched_listener("Launched", false);
+ InstallAndLaunchPlatformApp("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 two context menu items. These, along with a
+ // separator and the developer tools, is all that should be in the menu.
asargent_no_longer_on_chrome 2012/09/19 17:06:14 comment nit: actually we're asserting that the dev
Marijn Kruisselbrink 2012/09/19 17:33:23 Ah yes, the danger of copy-pasting code... Fixed.
+ WebContents* web_contents = GetFirstShellWindowWebContents();
+ ASSERT_TRUE(web_contents);
+ WebKit::WebContextMenuData data;
+ content::ContextMenuParams params(data);
+ scoped_ptr<PlatformAppContextMenu> menu;
+ menu.reset(new PlatformAppContextMenu(web_contents, params));
+ menu->Init();
+ ASSERT_TRUE(menu->HasCommandWithId(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST));
+ ASSERT_TRUE(menu->HasCommandWithId(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST + 1));
+ ASSERT_FALSE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTELEMENT));
+ ASSERT_FALSE(
+ menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE));
+ ASSERT_FALSE(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");
@@ -220,6 +252,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuTextField) {
menu->Init();
ASSERT_TRUE(menu->HasCommandWithId(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST));
ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTELEMENT));
+ ASSERT_TRUE(
+ menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE));
ASSERT_TRUE(menu->HasCommandWithId(IDC_RELOAD));
ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_UNDO));
ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_COPY));
@@ -247,6 +281,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuSelection) {
menu->Init();
ASSERT_TRUE(menu->HasCommandWithId(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST));
ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTELEMENT));
+ ASSERT_TRUE(
+ menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE));
ASSERT_TRUE(menu->HasCommandWithId(IDC_RELOAD));
ASSERT_FALSE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_UNDO));
ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_COPY));

Powered by Google App Engine
This is Rietveld 408576698