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/browser/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "chrome/browser/extensions/api/test/test_api.h" | 9 #include "chrome/browser/extensions/api/test/test_api.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 bool ExtensionApiTest::RunPageTest(const std::string& page_url) { | 167 bool ExtensionApiTest::RunPageTest(const std::string& page_url) { |
168 return RunExtensionSubtest("", page_url); | 168 return RunExtensionSubtest("", page_url); |
169 } | 169 } |
170 | 170 |
171 bool ExtensionApiTest::RunPageTest(const std::string& page_url, | 171 bool ExtensionApiTest::RunPageTest(const std::string& page_url, |
172 int flags) { | 172 int flags) { |
173 return RunExtensionSubtest("", page_url, flags); | 173 return RunExtensionSubtest("", page_url, flags); |
174 } | 174 } |
175 | 175 |
176 bool ExtensionApiTest::RunPlatformAppTest(const char* extension_name) { | 176 bool ExtensionApiTest::RunPlatformAppTest(const char* extension_name) { |
| 177 bool res = RunPlatformAppTestReturnImmediately(extension_name); |
| 178 CloseShellWindowsAndWaitForAppToExit(); |
| 179 return res; |
| 180 } |
| 181 |
| 182 bool ExtensionApiTest::RunPlatformAppTestReturnImmediately( |
| 183 const char* extension_name) { |
177 return RunExtensionTestImpl(extension_name, "", kFlagLaunchPlatformApp); | 184 return RunExtensionTestImpl(extension_name, "", kFlagLaunchPlatformApp); |
178 } | 185 } |
179 | 186 |
180 // Load |extension_name| extension and/or |page_url| and wait for | 187 // Load |extension_name| extension and/or |page_url| and wait for |
181 // PASSED or FAILED notification. | 188 // PASSED or FAILED notification. |
182 bool ExtensionApiTest::RunExtensionTestImpl(const char* extension_name, | 189 bool ExtensionApiTest::RunExtensionTestImpl(const char* extension_name, |
183 const std::string& page_url, | 190 const std::string& page_url, |
184 int flags) { | 191 int flags) { |
185 bool load_as_component = (flags & kFlagLoadAsComponent) != 0; | 192 bool load_as_component = (flags & kFlagLoadAsComponent) != 0; |
186 bool launch_platform_app = (flags & kFlagLaunchPlatformApp) != 0; | 193 bool launch_platform_app = (flags & kFlagLaunchPlatformApp) != 0; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 test_config_->SetInteger(kTestWebSocketPort, | 313 test_config_->SetInteger(kTestWebSocketPort, |
307 websocket_server_->host_port_pair().port()); | 314 websocket_server_->host_port_pair().port()); |
308 | 315 |
309 return true; | 316 return true; |
310 } | 317 } |
311 | 318 |
312 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { | 319 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { |
313 ExtensionBrowserTest::SetUpCommandLine(command_line); | 320 ExtensionBrowserTest::SetUpCommandLine(command_line); |
314 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); | 321 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); |
315 } | 322 } |
OLD | NEW |