| 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_system.h" | 18 #include "extensions/browser/extension_system.h" |
| 19 #include "extensions/common/constants.h" |
| 18 #include "extensions/common/extension.h" | 20 #include "extensions/common/extension.h" |
| 19 #include "extensions/common/extension_set.h" | 21 #include "extensions/common/extension_set.h" |
| 20 #include "extensions/test/result_catcher.h" | 22 #include "extensions/test/result_catcher.h" |
| 21 #include "net/base/escape.h" | 23 #include "net/base/escape.h" |
| 22 #include "net/base/filename_util.h" | 24 #include "net/base/filename_util.h" |
| 23 #include "net/test/embedded_test_server/embedded_test_server.h" | 25 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 24 #include "net/test/embedded_test_server/http_request.h" | 26 #include "net/test/embedded_test_server/http_request.h" |
| 25 #include "net/test/embedded_test_server/http_response.h" | 27 #include "net/test/embedded_test_server/http_response.h" |
| 26 #include "net/test/spawned_test_server/spawned_test_server.h" | 28 #include "net/test/spawned_test_server/spawned_test_server.h" |
| 27 | 29 |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 "Relative page_url given with no extension_name"; | 302 "Relative page_url given with no extension_name"; |
| 301 | 303 |
| 302 url = extension->GetResourceURL(page_url); | 304 url = extension->GetResourceURL(page_url); |
| 303 } | 305 } |
| 304 | 306 |
| 305 if (use_incognito) | 307 if (use_incognito) |
| 306 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), url); | 308 ui_test_utils::OpenURLOffTheRecord(browser()->profile(), url); |
| 307 else | 309 else |
| 308 ui_test_utils::NavigateToURL(browser(), url); | 310 ui_test_utils::NavigateToURL(browser(), url); |
| 309 } else if (launch_platform_app) { | 311 } else if (launch_platform_app) { |
| 310 AppLaunchParams params(browser()->profile(), | 312 AppLaunchParams params(browser()->profile(), extension, |
| 311 extension, | 313 extensions::LAUNCH_CONTAINER_NONE, NEW_WINDOW, |
| 312 extensions::LAUNCH_CONTAINER_NONE, | 314 extensions::SOURCE_UNTRACKED); |
| 313 NEW_WINDOW); | |
| 314 params.command_line = *CommandLine::ForCurrentProcess(); | 315 params.command_line = *CommandLine::ForCurrentProcess(); |
| 315 OpenApplication(params); | 316 OpenApplication(params); |
| 316 } | 317 } |
| 317 | 318 |
| 318 if (!catcher.GetNextResult()) { | 319 if (!catcher.GetNextResult()) { |
| 319 message_ = catcher.message(); | 320 message_ = catcher.message(); |
| 320 return false; | 321 return false; |
| 321 } | 322 } |
| 322 | 323 |
| 323 return true; | 324 return true; |
| (...skipping 85 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 |