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" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_tabstrip.h" | 12 #include "chrome/browser/ui/browser_tabstrip.h" |
13 #include "chrome/browser/ui/extensions/application_launch.h" | 13 #include "chrome/browser/ui/extensions/application_launch.h" |
14 #include "chrome/browser/ui/extensions/shell_window.h" | 14 #include "chrome/browser/ui/extensions/shell_window.h" |
15 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
16 #include "chrome/test/base/ui_test_utils.h" | 16 #include "chrome/test/base/ui_test_utils.h" |
17 #include "content/public/browser/render_process_host.h" | 17 #include "content/public/browser/render_process_host.h" |
18 | 18 |
19 using content::WebContents; | 19 using content::WebContents; |
20 using extensions::Extension; | 20 |
| 21 namespace extensions { |
21 | 22 |
22 namespace { | 23 namespace { |
23 // Non-abstract RenderViewContextMenu class. | 24 // Non-abstract RenderViewContextMenu class. |
24 class PlatformAppContextMenu : public RenderViewContextMenu { | 25 class PlatformAppContextMenu : public RenderViewContextMenu { |
25 public: | 26 public: |
26 PlatformAppContextMenu(WebContents* web_contents, | 27 PlatformAppContextMenu(WebContents* web_contents, |
27 const content::ContextMenuParams& params) | 28 const content::ContextMenuParams& params) |
28 : RenderViewContextMenu(web_contents, params) {} | 29 : RenderViewContextMenu(web_contents, params) {} |
29 | 30 |
30 bool HasCommandWithId(int command_id) { | 31 bool HasCommandWithId(int command_id) { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // Setup the command line | 216 // Setup the command line |
216 ClearCommandLineArgs(); | 217 ClearCommandLineArgs(); |
217 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 218 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
218 FilePath relative_test_doc = FilePath::FromUTF8Unsafe( | 219 FilePath relative_test_doc = FilePath::FromUTF8Unsafe( |
219 "platform_apps/launch_files/test.txt"); | 220 "platform_apps/launch_files/test.txt"); |
220 relative_test_doc = relative_test_doc.NormalizePathSeparators(); | 221 relative_test_doc = relative_test_doc.NormalizePathSeparators(); |
221 command_line->AppendArgPath(relative_test_doc); | 222 command_line->AppendArgPath(relative_test_doc); |
222 | 223 |
223 // Load the extension | 224 // Load the extension |
224 ResultCatcher catcher; | 225 ResultCatcher catcher; |
225 const extensions::Extension* extension = LoadExtension( | 226 const Extension* extension = LoadExtension( |
226 test_data_dir_.AppendASCII("platform_apps/launch_file")); | 227 test_data_dir_.AppendASCII("platform_apps/launch_file")); |
227 ASSERT_TRUE(extension); | 228 ASSERT_TRUE(extension); |
228 | 229 |
229 // Run the test | 230 // Run the test |
230 application_launch::LaunchParams params(browser()->profile(), extension, | 231 application_launch::LaunchParams params(browser()->profile(), extension, |
231 extension_misc::LAUNCH_NONE, | 232 extension_misc::LAUNCH_NONE, |
232 NEW_WINDOW); | 233 NEW_WINDOW); |
233 params.command_line = CommandLine::ForCurrentProcess(); | 234 params.command_line = CommandLine::ForCurrentProcess(); |
234 params.current_directory = test_data_dir_; | 235 params.current_directory = test_data_dir_; |
235 application_launch::OpenApplication(params); | 236 application_launch::OpenApplication(params); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 307 |
307 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenLink) { | 308 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenLink) { |
308 ASSERT_TRUE(StartTestServer()); | 309 ASSERT_TRUE(StartTestServer()); |
309 content::WindowedNotificationObserver observer( | 310 content::WindowedNotificationObserver observer( |
310 chrome::NOTIFICATION_TAB_ADDED, | 311 chrome::NOTIFICATION_TAB_ADDED, |
311 content::Source<content::WebContentsDelegate>(browser())); | 312 content::Source<content::WebContentsDelegate>(browser())); |
312 LoadAndLaunchPlatformApp("open_link"); | 313 LoadAndLaunchPlatformApp("open_link"); |
313 observer.Wait(); | 314 observer.Wait(); |
314 ASSERT_EQ(2, browser()->tab_count()); | 315 ASSERT_EQ(2, browser()->tab_count()); |
315 } | 316 } |
| 317 |
| 318 } // namespace extensions |
OLD | NEW |