| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Tests for the --load-and-launch-app switch. | 5 // Tests for the --load-and-launch-app switch. |
| 6 // The two cases are when chrome is running and another process uses the switch | 6 // The two cases are when chrome is running and another process uses the switch |
| 7 // and when chrome is started from scratch. | 7 // and when chrome is started from scratch. |
| 8 | 8 |
| 9 #include "apps/switches.h" | 9 #include "apps/switches.h" |
| 10 #include "base/process/launch.h" | 10 #include "base/process/launch.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 DISABLED_LoadAndLaunchAppChromeRunning | 27 DISABLED_LoadAndLaunchAppChromeRunning |
| 28 #else | 28 #else |
| 29 #define MAYBE_LoadAndLaunchAppChromeRunning LoadAndLaunchAppChromeRunning | 29 #define MAYBE_LoadAndLaunchAppChromeRunning LoadAndLaunchAppChromeRunning |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 // Case where Chrome is already running. | 32 // Case where Chrome is already running. |
| 33 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 33 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, |
| 34 MAYBE_LoadAndLaunchAppChromeRunning) { | 34 MAYBE_LoadAndLaunchAppChromeRunning) { |
| 35 ExtensionTestMessageListener launched_listener("Launched", false); | 35 ExtensionTestMessageListener launched_listener("Launched", false); |
| 36 | 36 |
| 37 const CommandLine& cmdline = *CommandLine::ForCurrentProcess(); | 37 const base::CommandLine& cmdline = *base::CommandLine::ForCurrentProcess(); |
| 38 CommandLine new_cmdline(cmdline.GetProgram()); | 38 base::CommandLine new_cmdline(cmdline.GetProgram()); |
| 39 | 39 |
| 40 const char* kSwitchNames[] = { | 40 const char* kSwitchNames[] = { |
| 41 switches::kUserDataDir, | 41 switches::kUserDataDir, |
| 42 }; | 42 }; |
| 43 new_cmdline.CopySwitchesFrom(cmdline, kSwitchNames, arraysize(kSwitchNames)); | 43 new_cmdline.CopySwitchesFrom(cmdline, kSwitchNames, arraysize(kSwitchNames)); |
| 44 | 44 |
| 45 base::FilePath app_path = test_data_dir_ | 45 base::FilePath app_path = test_data_dir_ |
| 46 .AppendASCII("platform_apps") | 46 .AppendASCII("platform_apps") |
| 47 .AppendASCII("minimal"); | 47 .AppendASCII("minimal"); |
| 48 | 48 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 64 #if defined(OS_MACOSX) | 64 #if defined(OS_MACOSX) |
| 65 #define MAYBE_LoadAndLaunchAppWithFile DISABLED_LoadAndLaunchAppWithFile | 65 #define MAYBE_LoadAndLaunchAppWithFile DISABLED_LoadAndLaunchAppWithFile |
| 66 #else | 66 #else |
| 67 #define MAYBE_LoadAndLaunchAppWithFile LoadAndLaunchAppWithFile | 67 #define MAYBE_LoadAndLaunchAppWithFile LoadAndLaunchAppWithFile |
| 68 #endif | 68 #endif |
| 69 | 69 |
| 70 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 70 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, |
| 71 MAYBE_LoadAndLaunchAppWithFile) { | 71 MAYBE_LoadAndLaunchAppWithFile) { |
| 72 ExtensionTestMessageListener launched_listener("Launched", false); | 72 ExtensionTestMessageListener launched_listener("Launched", false); |
| 73 | 73 |
| 74 const CommandLine& cmdline = *CommandLine::ForCurrentProcess(); | 74 const base::CommandLine& cmdline = *base::CommandLine::ForCurrentProcess(); |
| 75 CommandLine new_cmdline(cmdline.GetProgram()); | 75 base::CommandLine new_cmdline(cmdline.GetProgram()); |
| 76 | 76 |
| 77 const char* kSwitchNames[] = { | 77 const char* kSwitchNames[] = { |
| 78 switches::kUserDataDir, | 78 switches::kUserDataDir, |
| 79 }; | 79 }; |
| 80 new_cmdline.CopySwitchesFrom(cmdline, kSwitchNames, arraysize(kSwitchNames)); | 80 new_cmdline.CopySwitchesFrom(cmdline, kSwitchNames, arraysize(kSwitchNames)); |
| 81 | 81 |
| 82 base::FilePath app_path = test_data_dir_ | 82 base::FilePath app_path = test_data_dir_ |
| 83 .AppendASCII("platform_apps") | 83 .AppendASCII("platform_apps") |
| 84 .AppendASCII("load_and_launch_file"); | 84 .AppendASCII("load_and_launch_file"); |
| 85 | 85 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 102 process, TestTimeouts::action_timeout())); | 102 process, TestTimeouts::action_timeout())); |
| 103 } | 103 } |
| 104 | 104 |
| 105 namespace { | 105 namespace { |
| 106 | 106 |
| 107 // TestFixture that appends --load-and-launch-app before calling BrowserMain. | 107 // TestFixture that appends --load-and-launch-app before calling BrowserMain. |
| 108 class PlatformAppLoadAndLaunchBrowserTest : public PlatformAppBrowserTest { | 108 class PlatformAppLoadAndLaunchBrowserTest : public PlatformAppBrowserTest { |
| 109 protected: | 109 protected: |
| 110 PlatformAppLoadAndLaunchBrowserTest() {} | 110 PlatformAppLoadAndLaunchBrowserTest() {} |
| 111 | 111 |
| 112 void SetUpCommandLine(CommandLine* command_line) override { | 112 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 113 PlatformAppBrowserTest::SetUpCommandLine(command_line); | 113 PlatformAppBrowserTest::SetUpCommandLine(command_line); |
| 114 app_path_ = test_data_dir_ | 114 app_path_ = test_data_dir_ |
| 115 .AppendASCII("platform_apps") | 115 .AppendASCII("platform_apps") |
| 116 .AppendASCII("minimal"); | 116 .AppendASCII("minimal"); |
| 117 command_line->AppendSwitchNative(apps::kLoadAndLaunchApp, | 117 command_line->AppendSwitchNative(apps::kLoadAndLaunchApp, |
| 118 app_path_.value()); | 118 app_path_.value()); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void LoadAndLaunchApp() { | 121 void LoadAndLaunchApp() { |
| 122 ExtensionTestMessageListener launched_listener("Launched", false); | 122 ExtensionTestMessageListener launched_listener("Launched", false); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 146 LoadAndLaunchAppChromeNotRunning | 146 LoadAndLaunchAppChromeNotRunning |
| 147 #endif | 147 #endif |
| 148 | 148 |
| 149 // Case where Chrome is not running. | 149 // Case where Chrome is not running. |
| 150 IN_PROC_BROWSER_TEST_F(PlatformAppLoadAndLaunchBrowserTest, | 150 IN_PROC_BROWSER_TEST_F(PlatformAppLoadAndLaunchBrowserTest, |
| 151 MAYBE_LoadAndLaunchAppChromeNotRunning) { | 151 MAYBE_LoadAndLaunchAppChromeNotRunning) { |
| 152 LoadAndLaunchApp(); | 152 LoadAndLaunchApp(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace apps | 155 } // namespace apps |
| OLD | NEW |