Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: chrome/browser/extensions/extension_apitest.cc

Issue 11117011: Keep browser process alive while there are platform apps with background pages running. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/platform_app_service.h"
11 #include "chrome/browser/extensions/unpacked_installer.h" 12 #include "chrome/browser/extensions/unpacked_installer.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/extensions/application_launch.h" 15 #include "chrome/browser/ui/extensions/application_launch.h"
15 #include "chrome/common/chrome_notification_types.h" 16 #include "chrome/common/chrome_notification_types.h"
16 #include "chrome/common/extensions/extension.h" 17 #include "chrome/common/extensions/extension.h"
17 #include "chrome/test/base/ui_test_utils.h" 18 #include "chrome/test/base/ui_test_utils.h"
18 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
19 #include "content/public/browser/notification_service.h" 20 #include "content/public/browser/notification_service.h"
20 #include "net/base/net_util.h" 21 #include "net/base/net_util.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 bool ExtensionApiTest::RunPageTest(const std::string& page_url) { 167 bool ExtensionApiTest::RunPageTest(const std::string& page_url) {
167 return RunExtensionSubtest("", page_url); 168 return RunExtensionSubtest("", page_url);
168 } 169 }
169 170
170 bool ExtensionApiTest::RunPageTest(const std::string& page_url, 171 bool ExtensionApiTest::RunPageTest(const std::string& page_url,
171 int flags) { 172 int flags) {
172 return RunExtensionSubtest("", page_url, flags); 173 return RunExtensionSubtest("", page_url, flags);
173 } 174 }
174 175
175 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) {
184 extensions::PlatformAppService::CreateInstance(browser()->profile());
176 return RunExtensionTestImpl(extension_name, "", kFlagLaunchPlatformApp); 185 return RunExtensionTestImpl(extension_name, "", kFlagLaunchPlatformApp);
177 } 186 }
178 187
179 // Load |extension_name| extension and/or |page_url| and wait for 188 // Load |extension_name| extension and/or |page_url| and wait for
180 // PASSED or FAILED notification. 189 // PASSED or FAILED notification.
181 bool ExtensionApiTest::RunExtensionTestImpl(const char* extension_name, 190 bool ExtensionApiTest::RunExtensionTestImpl(const char* extension_name,
182 const std::string& page_url, 191 const std::string& page_url,
183 int flags) { 192 int flags) {
184 bool load_as_component = (flags & kFlagLoadAsComponent) != 0; 193 bool load_as_component = (flags & kFlagLoadAsComponent) != 0;
185 bool launch_platform_app = (flags & kFlagLaunchPlatformApp) != 0; 194 bool launch_platform_app = (flags & kFlagLaunchPlatformApp) != 0;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 test_config_->SetInteger(kTestWebSocketPort, 313 test_config_->SetInteger(kTestWebSocketPort,
305 websocket_server_->host_port_pair().port()); 314 websocket_server_->host_port_pair().port());
306 315
307 return true; 316 return true;
308 } 317 }
309 318
310 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { 319 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) {
311 ExtensionBrowserTest::SetUpCommandLine(command_line); 320 ExtensionBrowserTest::SetUpCommandLine(command_line);
312 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); 321 test_data_dir_ = test_data_dir_.AppendASCII("api_test");
313 } 322 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698