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 "shell/shell_test_base.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.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 "mojo/shell/filename_util.h" | 13 #include "shell/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() { |
(...skipping 10 matching lines...) Expand all Loading... |
34 const std::string& service_name) { | 34 const std::string& service_name) { |
35 // Set the MojoURLResolver origin to be the same as the base file path for | 35 // Set the MojoURLResolver origin to be the same as the base file path for |
36 // local files. This is primarily for test convenience, so that references | 36 // local files. This is primarily for test convenience, so that references |
37 // to unknown mojo: urls that do not have specific local file or custom | 37 // to unknown mojo: urls that do not have specific local file or custom |
38 // mappings registered on the URL resolver are treated as shared libraries. | 38 // mappings registered on the URL resolver are treated as shared libraries. |
39 base::FilePath service_dir; | 39 base::FilePath service_dir; |
40 CHECK(PathService::Get(base::DIR_MODULE, &service_dir)); | 40 CHECK(PathService::Get(base::DIR_MODULE, &service_dir)); |
41 shell_context_.mojo_url_resolver()->SetBaseURL( | 41 shell_context_.mojo_url_resolver()->SetBaseURL( |
42 FilePathToFileURL(service_dir)); | 42 FilePathToFileURL(service_dir)); |
43 | 43 |
44 return shell_context_.ConnectToServiceByName( | 44 return shell_context_.ConnectToServiceByName(application_url, service_name) |
45 application_url, service_name).Pass(); | 45 .Pass(); |
46 } | 46 } |
47 | 47 |
48 ScopedMessagePipeHandle ShellTestBase::ConnectToServiceViaNetwork( | 48 ScopedMessagePipeHandle ShellTestBase::ConnectToServiceViaNetwork( |
49 const GURL& application_url, | 49 const GURL& application_url, |
50 const std::string& service_name) { | 50 const std::string& service_name) { |
51 return shell_context_.ConnectToServiceByName( | 51 return shell_context_.ConnectToServiceByName(application_url, service_name) |
52 application_url, service_name).Pass(); | 52 .Pass(); |
53 } | 53 } |
54 | 54 |
55 } // namespace test | 55 } // namespace test |
56 } // namespace shell | 56 } // namespace shell |
57 } // namespace mojo | 57 } // namespace mojo |
OLD | NEW |