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