| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/runner/shell_test_base.h" | 5 #include "mojo/runner/shell_test_base.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 shell_context_.Shutdown(); | 45 shell_context_.Shutdown(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 ScopedMessagePipeHandle ShellTestBase::ConnectToService( | 48 ScopedMessagePipeHandle ShellTestBase::ConnectToService( |
| 49 const GURL& application_url, | 49 const GURL& application_url, |
| 50 const std::string& service_name) { | 50 const std::string& service_name) { |
| 51 ServiceProviderPtr services; | 51 ServiceProviderPtr services; |
| 52 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 52 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 53 request->url = mojo::String::From(application_url.spec()); | 53 request->url = mojo::String::From(application_url.spec()); |
| 54 shell_context_.application_manager()->ConnectToApplication( | 54 shell_context_.application_manager()->ConnectToApplication( |
| 55 nullptr, request.Pass(), std::string(), GURL(), GetProxy(&services), | 55 nullptr, request.Pass(), std::string(), GetProxy(&services), nullptr, |
| 56 nullptr, shell::GetPermissiveCapabilityFilter(), | 56 shell::GetPermissiveCapabilityFilter(), base::Bind(&QuitIfRunning), |
| 57 base::Bind(&QuitIfRunning), shell::EmptyConnectCallback()); | 57 shell::EmptyConnectCallback()); |
| 58 MessagePipe pipe; | 58 MessagePipe pipe; |
| 59 services->ConnectToService(service_name, pipe.handle1.Pass()); | 59 services->ConnectToService(service_name, pipe.handle1.Pass()); |
| 60 return pipe.handle0.Pass(); | 60 return pipe.handle0.Pass(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 #if !defined(OS_ANDROID) | 63 #if !defined(OS_ANDROID) |
| 64 void ShellTestBase::SetUpTestApplications() { | 64 void ShellTestBase::SetUpTestApplications() { |
| 65 // Set the URLResolver origin to be the same as the base file path for | 65 // Set the URLResolver origin to be the same as the base file path for |
| 66 // local files. This is primarily for test convenience, so that references | 66 // local files. This is primarily for test convenience, so that references |
| 67 // to unknown mojo: URLs that do not have specific local file or custom | 67 // to unknown mojo: URLs that do not have specific local file or custom |
| 68 // mappings registered on the URL resolver are treated as shared libraries. | 68 // mappings registered on the URL resolver are treated as shared libraries. |
| 69 base::FilePath service_dir; | 69 base::FilePath service_dir; |
| 70 CHECK(PathService::Get(base::DIR_MODULE, &service_dir)); | 70 CHECK(PathService::Get(base::DIR_MODULE, &service_dir)); |
| 71 shell_context_.url_resolver()->SetMojoBaseURL( | 71 shell_context_.url_resolver()->SetMojoBaseURL( |
| 72 util::FilePathToFileURL(service_dir)); | 72 util::FilePathToFileURL(service_dir)); |
| 73 } | 73 } |
| 74 #endif | 74 #endif |
| 75 | 75 |
| 76 } // namespace test | 76 } // namespace test |
| 77 } // namespace runner | 77 } // namespace runner |
| 78 } // namespace mojo | 78 } // namespace mojo |
| OLD | NEW |