| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 | 82 |
| 83 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenu) { | 83 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, AppWithContextMenu) { |
| 84 ExtensionTestMessageListener launched_listener("Launched", false); | 84 ExtensionTestMessageListener launched_listener("Launched", false); |
| 85 LoadAndLaunchPlatformApp("context_menu"); | 85 LoadAndLaunchPlatformApp("context_menu"); |
| 86 | 86 |
| 87 // Wait for the extension to tell us it's initialized its context menus and | 87 // Wait for the extension to tell us it's initialized its context menus and |
| 88 // launched a window. | 88 // launched a window. |
| 89 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 89 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
| 90 | 90 |
| 91 // The context_menu app has one context menu item. This, along with a | 91 // The context_menu app has two context menu items. These, along with a |
| 92 // separator and the developer tools, is all that should be in the menu. | 92 // separator and the developer tools, is all that should be in the menu. |
| 93 WebContents* web_contents = GetFirstShellWindowWebContents(); | 93 WebContents* web_contents = GetFirstShellWindowWebContents(); |
| 94 ASSERT_TRUE(web_contents); | 94 ASSERT_TRUE(web_contents); |
| 95 WebKit::WebContextMenuData data; | 95 WebKit::WebContextMenuData data; |
| 96 content::ContextMenuParams params(data); | 96 content::ContextMenuParams params(data); |
| 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_EXTENSIONS_CONTEXT_CUSTOM_FIRST + 1)); |
| 101 ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTELEMENT)); | 102 ASSERT_TRUE(menu->HasCommandWithId(IDC_CONTENT_CONTEXT_INSPECTELEMENT)); |
| 102 ASSERT_TRUE(menu->HasCommandWithId(IDC_RELOAD)); | 103 ASSERT_TRUE(menu->HasCommandWithId(IDC_RELOAD)); |
| 103 ASSERT_FALSE(menu->HasCommandWithId(IDC_BACK)); | 104 ASSERT_FALSE(menu->HasCommandWithId(IDC_BACK)); |
| 104 ASSERT_FALSE(menu->HasCommandWithId(IDC_SAVE_PAGE)); | 105 ASSERT_FALSE(menu->HasCommandWithId(IDC_SAVE_PAGE)); |
| 105 } | 106 } |
| 106 | 107 |
| 107 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DisallowNavigation) { | 108 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DisallowNavigation) { |
| 108 ASSERT_TRUE(StartTestServer()); | 109 ASSERT_TRUE(StartTestServer()); |
| 109 ASSERT_TRUE(RunPlatformAppTest("platform_apps/navigation")) << message_; | 110 ASSERT_TRUE(RunPlatformAppTest("platform_apps/navigation")) << message_; |
| 110 } | 111 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 ASSERT_TRUE(StartTestServer()); | 310 ASSERT_TRUE(StartTestServer()); |
| 310 content::WindowedNotificationObserver observer( | 311 content::WindowedNotificationObserver observer( |
| 311 chrome::NOTIFICATION_TAB_ADDED, | 312 chrome::NOTIFICATION_TAB_ADDED, |
| 312 content::Source<content::WebContentsDelegate>(browser())); | 313 content::Source<content::WebContentsDelegate>(browser())); |
| 313 LoadAndLaunchPlatformApp("open_link"); | 314 LoadAndLaunchPlatformApp("open_link"); |
| 314 observer.Wait(); | 315 observer.Wait(); |
| 315 ASSERT_EQ(2, browser()->tab_count()); | 316 ASSERT_EQ(2, browser()->tab_count()); |
| 316 } | 317 } |
| 317 | 318 |
| 318 } // namespace extensions | 319 } // namespace extensions |
| OLD | NEW |