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/strings/string_split.h" | 7 #include "base/strings/string_split.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chrome/browser/extensions/extension_service.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/app_launch_params.h" |
14 #include "chrome/browser/ui/extensions/application_launch.h" | 15 #include "chrome/browser/ui/extensions/application_launch.h" |
15 #include "chrome/test/base/ui_test_utils.h" | 16 #include "chrome/test/base/ui_test_utils.h" |
16 #include "extensions/browser/api/test/test_api.h" | 17 #include "extensions/browser/api/test/test_api.h" |
17 #include "extensions/browser/extension_registry.h" | 18 #include "extensions/browser/extension_registry.h" |
18 #include "extensions/browser/extension_system.h" | 19 #include "extensions/browser/extension_system.h" |
| 20 #include "extensions/common/constants.h" |
19 #include "extensions/common/extension.h" | 21 #include "extensions/common/extension.h" |
20 #include "extensions/common/extension_set.h" | 22 #include "extensions/common/extension_set.h" |
21 #include "extensions/test/result_catcher.h" | 23 #include "extensions/test/result_catcher.h" |
22 #include "net/base/escape.h" | 24 #include "net/base/escape.h" |
23 #include "net/base/filename_util.h" | 25 #include "net/base/filename_util.h" |
24 #include "net/test/embedded_test_server/embedded_test_server.h" | 26 #include "net/test/embedded_test_server/embedded_test_server.h" |
25 #include "net/test/embedded_test_server/http_request.h" | 27 #include "net/test/embedded_test_server/http_request.h" |
26 #include "net/test/embedded_test_server/http_response.h" | 28 #include "net/test/embedded_test_server/http_response.h" |
27 #include "net/test/spawned_test_server/spawned_test_server.h" | 29 #include "net/test/spawned_test_server/spawned_test_server.h" |
28 | 30 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 "Relative page_url given with no extension_name"; | 303 "Relative page_url given with no extension_name"; |
302 | 304 |
303 url = extension->GetResourceURL(page_url); | 305 url = extension->GetResourceURL(page_url); |
304 } | 306 } |
305 | 307 |
306 if (use_incognito) | 308 if (use_incognito) |
307 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), url); | 309 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), url); |
308 else | 310 else |
309 ui_test_utils::NavigateToURL(browser(), url); | 311 ui_test_utils::NavigateToURL(browser(), url); |
310 } else if (launch_platform_app) { | 312 } else if (launch_platform_app) { |
311 AppLaunchParams params(browser()->profile(), | 313 AppLaunchParams params(browser()->profile(), extension, |
312 extension, | 314 extensions::LAUNCH_CONTAINER_NONE, NEW_WINDOW, |
313 extensions::LAUNCH_CONTAINER_NONE, | 315 extensions::SOURCE_UNTRACKED); |
314 NEW_WINDOW); | |
315 params.command_line = *CommandLine::ForCurrentProcess(); | 316 params.command_line = *CommandLine::ForCurrentProcess(); |
316 OpenApplication(params); | 317 OpenApplication(params); |
317 } | 318 } |
318 | 319 |
319 if (!catcher.GetNextResult()) { | 320 if (!catcher.GetNextResult()) { |
320 message_ = catcher.message(); | 321 message_ = catcher.message(); |
321 return false; | 322 return false; |
322 } | 323 } |
323 | 324 |
324 return true; | 325 return true; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 test_config_->SetInteger(kSpawnedTestServerPort, | 410 test_config_->SetInteger(kSpawnedTestServerPort, |
410 test_server()->host_port_pair().port()); | 411 test_server()->host_port_pair().port()); |
411 | 412 |
412 return true; | 413 return true; |
413 } | 414 } |
414 | 415 |
415 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { | 416 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { |
416 ExtensionBrowserTest::SetUpCommandLine(command_line); | 417 ExtensionBrowserTest::SetUpCommandLine(command_line); |
417 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); | 418 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); |
418 } | 419 } |
OLD | NEW |