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/extension_service.h" |
9 #include "chrome/browser/extensions/api/test/test_api.h" | 10 #include "chrome/browser/extensions/api/test/test_api.h" |
10 #include "chrome/browser/extensions/extension_service.h" | |
11 #include "chrome/browser/extensions/unpacked_installer.h" | 11 #include "chrome/browser/extensions/unpacked_installer.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/extensions/application_launch.h" | 14 #include "chrome/browser/ui/extensions/application_launch.h" |
15 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
16 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
17 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
19 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
20 #include "net/base/net_util.h" | 20 #include "net/base/net_util.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 bool ExtensionApiTest::RunPageTest(const std::string& page_url) { | 166 bool ExtensionApiTest::RunPageTest(const std::string& page_url) { |
167 return RunExtensionSubtest("", page_url); | 167 return RunExtensionSubtest("", page_url); |
168 } | 168 } |
169 | 169 |
170 bool ExtensionApiTest::RunPageTest(const std::string& page_url, | 170 bool ExtensionApiTest::RunPageTest(const std::string& page_url, |
171 int flags) { | 171 int flags) { |
172 return RunExtensionSubtest("", page_url, flags); | 172 return RunExtensionSubtest("", page_url, flags); |
173 } | 173 } |
174 | 174 |
175 bool ExtensionApiTest::RunPlatformAppTest(const char* extension_name) { | 175 bool ExtensionApiTest::RunPlatformAppTest(const char* extension_name) { |
176 bool res = RunPlatformAppTestReturnImmediately(extension_name); | |
177 CloseShellWindowsAndWaitForAppToExit(); | |
178 return res; | |
179 } | |
180 | |
181 bool ExtensionApiTest::RunPlatformAppTestReturnImmediately( | |
182 const char* extension_name) { | |
183 return RunExtensionTestImpl(extension_name, "", kFlagLaunchPlatformApp); | 176 return RunExtensionTestImpl(extension_name, "", kFlagLaunchPlatformApp); |
184 } | 177 } |
185 | 178 |
186 // Load |extension_name| extension and/or |page_url| and wait for | 179 // Load |extension_name| extension and/or |page_url| and wait for |
187 // PASSED or FAILED notification. | 180 // PASSED or FAILED notification. |
188 bool ExtensionApiTest::RunExtensionTestImpl(const char* extension_name, | 181 bool ExtensionApiTest::RunExtensionTestImpl(const char* extension_name, |
189 const std::string& page_url, | 182 const std::string& page_url, |
190 int flags) { | 183 int flags) { |
191 bool load_as_component = (flags & kFlagLoadAsComponent) != 0; | 184 bool load_as_component = (flags & kFlagLoadAsComponent) != 0; |
192 bool launch_platform_app = (flags & kFlagLaunchPlatformApp) != 0; | 185 bool launch_platform_app = (flags & kFlagLaunchPlatformApp) != 0; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 test_config_->SetInteger(kTestWebSocketPort, | 304 test_config_->SetInteger(kTestWebSocketPort, |
312 websocket_server_->host_port_pair().port()); | 305 websocket_server_->host_port_pair().port()); |
313 | 306 |
314 return true; | 307 return true; |
315 } | 308 } |
316 | 309 |
317 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { | 310 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { |
318 ExtensionBrowserTest::SetUpCommandLine(command_line); | 311 ExtensionBrowserTest::SetUpCommandLine(command_line); |
319 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); | 312 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); |
320 } | 313 } |
OLD | NEW |