Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/app/chrome_command_ids.h" | 5 #include "chrome/app/chrome_command_ids.h" |
| 6 #include "chrome/browser/automation/automation_util.h" | 6 #include "chrome/browser/automation/automation_util.h" |
| 7 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 7 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 8 #include "chrome/browser/extensions/extension_test_message_listener.h" | 8 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 9 #include "chrome/browser/extensions/platform_app_browsertest_util.h" | 9 #include "chrome/browser/extensions/platform_app_browsertest_util.h" |
| 10 #include "chrome/browser/extensions/shell_window_registry.h" | 10 #include "chrome/browser/extensions/shell_window_registry.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents, | 97 PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents, |
| 98 params); | 98 params); |
| 99 menu->Init(); | 99 menu->Init(); |
| 100 ASSERT_TRUE(menu->HasCommandWithId(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST)); | 100 ASSERT_TRUE(menu->HasCommandWithId(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST)); |
| 101 ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTELEMENT)); | 101 ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTELEMENT)); |
| 102 ASSERT_TRUE(menu->HasCommandWithId(IDC_RELOAD)); | 102 ASSERT_TRUE(menu->HasCommandWithId(IDC_RELOAD)); |
| 103 ASSERT_FALSE(menu->HasCommandWithId(IDC_BACK)); | 103 ASSERT_FALSE(menu->HasCommandWithId(IDC_BACK)); |
| 104 ASSERT_FALSE(menu->HasCommandWithId(IDC_SAVE_PAGE)); | 104 ASSERT_FALSE(menu->HasCommandWithId(IDC_SAVE_PAGE)); |
| 105 } | 105 } |
| 106 | 106 |
| 107 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenuItems) { | |
| 108 ExtensionTestMessageListener launched_listener("Launched", false); | |
| 109 LoadAndLaunchPlatformApp("context_menu2"); | |
|
Mihai Parparita -not on Chrome
2012/08/16 19:58:02
I think you missed adding the new test app to the
| |
| 110 | |
| 111 // Wait for the extension to tell us it's initialized its context menus and | |
| 112 // launched a window. | |
| 113 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | |
| 114 | |
| 115 // The context_menu app has two context menu item. These should both be in | |
| 116 // the top level menu (unlike with regular extensions) | |
| 117 WebContents* web_contents = GetFirstShellWindowWebContents(); | |
| 118 ASSERT_TRUE(web_contents); | |
| 119 WebKit::WebContextMenuData data; | |
| 120 content::ContextMenuParams params(data); | |
| 121 PlatformAppContextMenu* menu = new PlatformAppContextMenu(web_contents, | |
| 122 params); | |
| 123 menu->Init(); | |
| 124 ASSERT_TRUE(menu->HasCommandWithId(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST)); | |
| 125 ASSERT_TRUE(menu->HasCommandWithId(IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST+1)); | |
|
Mihai Parparita -not on Chrome
2012/08/16 19:58:02
Add a space before and after the + sign (see http:
| |
| 126 } | |
| 127 | |
| 107 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DisallowNavigation) { | 128 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DisallowNavigation) { |
| 108 ASSERT_TRUE(StartTestServer()); | 129 ASSERT_TRUE(StartTestServer()); |
| 109 ASSERT_TRUE(RunPlatformAppTest("platform_apps/navigation")) << message_; | 130 ASSERT_TRUE(RunPlatformAppTest("platform_apps/navigation")) << message_; |
| 110 } | 131 } |
| 111 | 132 |
| 112 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, Iframes) { | 133 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, Iframes) { |
| 113 ASSERT_TRUE(StartTestServer()); | 134 ASSERT_TRUE(StartTestServer()); |
| 114 ASSERT_TRUE(RunPlatformAppTest("platform_apps/iframes")) << message_; | 135 ASSERT_TRUE(RunPlatformAppTest("platform_apps/iframes")) << message_; |
| 115 } | 136 } |
| 116 | 137 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 ASSERT_TRUE(StartTestServer()); | 330 ASSERT_TRUE(StartTestServer()); |
| 310 content::WindowedNotificationObserver observer( | 331 content::WindowedNotificationObserver observer( |
| 311 chrome::NOTIFICATION_TAB_ADDED, | 332 chrome::NOTIFICATION_TAB_ADDED, |
| 312 content::Source<content::WebContentsDelegate>(browser())); | 333 content::Source<content::WebContentsDelegate>(browser())); |
| 313 LoadAndLaunchPlatformApp("open_link"); | 334 LoadAndLaunchPlatformApp("open_link"); |
| 314 observer.Wait(); | 335 observer.Wait(); |
| 315 ASSERT_EQ(2, browser()->tab_count()); | 336 ASSERT_EQ(2, browser()->tab_count()); |
| 316 } | 337 } |
| 317 | 338 |
| 318 } // namespace extensions | 339 } // namespace extensions |
| OLD | NEW |