| 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/shell/shell_test_base.h" | 5 #include "mojo/shell/shell_test_base.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "net/base/filename_util.h" | 13 #include "net/base/filename_util.h" |
| 14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 15 | 15 |
| 16 namespace mojo { | 16 namespace mojo { |
| 17 namespace shell { | 17 namespace shell { |
| 18 namespace test { | 18 namespace test { |
| 19 | 19 |
| 20 ShellTestBase::ShellTestBase() { | 20 ShellTestBase::ShellTestBase() { |
| 21 } | 21 } |
| 22 | 22 |
| 23 ShellTestBase::~ShellTestBase() { | 23 ShellTestBase::~ShellTestBase() { |
| 24 } | 24 } |
| 25 | 25 |
| 26 ScopedMessagePipeHandle ShellTestBase::LaunchServiceInProcess( | 26 ScopedMessagePipeHandle ShellTestBase::ConnectToService( |
| 27 const GURL& service_url, | 27 const GURL& application_url, |
| 28 const std::string& service_name) { | 28 const std::string& service_name) { |
| 29 base::FilePath base_dir; | 29 base::FilePath base_dir; |
| 30 CHECK(PathService::Get(base::DIR_EXE, &base_dir)); | 30 CHECK(PathService::Get(base::DIR_EXE, &base_dir)); |
| 31 // On android, the library is bundled with the app. | 31 // On android, the library is bundled with the app. |
| 32 #if defined(OS_ANDROID) | 32 #if defined(OS_ANDROID) |
| 33 // On Android, the library is bundled with the app. | 33 // On Android, the library is bundled with the app. |
| 34 base::FilePath service_dir; | 34 base::FilePath service_dir; |
| 35 CHECK(PathService::Get(base::DIR_MODULE, &service_dir)); | 35 CHECK(PathService::Get(base::DIR_MODULE, &service_dir)); |
| 36 #else | 36 #else |
| 37 // On other platforms, "loadable modules" are dumped beside the executables. | 37 // On other platforms, "loadable modules" are dumped beside the executables. |
| 38 base::FilePath service_dir; | 38 base::FilePath service_dir; |
| 39 CHECK(PathService::Get(base::DIR_EXE, &service_dir)); | 39 CHECK(PathService::Get(base::DIR_EXE, &service_dir)); |
| 40 #endif | 40 #endif |
| 41 shell_context_.mojo_url_resolver()->set_origin( | 41 shell_context_.mojo_url_resolver()->set_origin( |
| 42 net::FilePathToFileURL(service_dir).spec()); | 42 net::FilePathToFileURL(service_dir).spec()); |
| 43 | 43 |
| 44 return shell_context_.service_manager()->ConnectToServiceByName( | 44 return shell_context_.service_manager()->ConnectToServiceByName( |
| 45 service_url, service_name).Pass(); | 45 application_url, service_name).Pass(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 } // namespace test | 48 } // namespace test |
| 49 } // namespace shell | 49 } // namespace shell |
| 50 } // namespace mojo | 50 } // namespace mojo |
| OLD | NEW |