| 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/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/api/test/test_api.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) { |
| 176 return RunExtensionTestImpl(extension_name, "", kFlagLaunchPlatformApp); | 183 return RunExtensionTestImpl(extension_name, "", kFlagLaunchPlatformApp); |
| 177 } | 184 } |
| 178 | 185 |
| 179 // Load |extension_name| extension and/or |page_url| and wait for | 186 // Load |extension_name| extension and/or |page_url| and wait for |
| 180 // PASSED or FAILED notification. | 187 // PASSED or FAILED notification. |
| 181 bool ExtensionApiTest::RunExtensionTestImpl(const char* extension_name, | 188 bool ExtensionApiTest::RunExtensionTestImpl(const char* extension_name, |
| 182 const std::string& page_url, | 189 const std::string& page_url, |
| 183 int flags) { | 190 int flags) { |
| 184 bool load_as_component = (flags & kFlagLoadAsComponent) != 0; | 191 bool load_as_component = (flags & kFlagLoadAsComponent) != 0; |
| 185 bool launch_platform_app = (flags & kFlagLaunchPlatformApp) != 0; | 192 bool launch_platform_app = (flags & kFlagLaunchPlatformApp) != 0; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 test_config_->SetInteger(kTestWebSocketPort, | 311 test_config_->SetInteger(kTestWebSocketPort, |
| 305 websocket_server_->host_port_pair().port()); | 312 websocket_server_->host_port_pair().port()); |
| 306 | 313 |
| 307 return true; | 314 return true; |
| 308 } | 315 } |
| 309 | 316 |
| 310 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { | 317 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { |
| 311 ExtensionBrowserTest::SetUpCommandLine(command_line); | 318 ExtensionBrowserTest::SetUpCommandLine(command_line); |
| 312 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); | 319 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); |
| 313 } | 320 } |
| OLD | NEW |