| 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 "net/test/embedded_test_server/embedded_test_server.h" | 14 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 16 | 16 |
| 17 namespace mojo { | 17 namespace mojo { |
| 18 namespace shell { | 18 namespace shell { |
| 19 namespace test { | 19 namespace test { |
| 20 | 20 |
| 21 ShellTestBase::ShellTestBase() { | 21 ShellTestBase::ShellTestBase() { |
| 22 } | 22 } |
| 23 | 23 |
| 24 ShellTestBase::~ShellTestBase() { | 24 ShellTestBase::~ShellTestBase() { |
| 25 } | 25 } |
| 26 | 26 |
| 27 void ShellTestBase::SetUp() { | 27 void ShellTestBase::SetUp() { |
| 28 shell_context_.Init(); |
| 28 test_server_.reset(new net::test_server::EmbeddedTestServer()); | 29 test_server_.reset(new net::test_server::EmbeddedTestServer()); |
| 29 ASSERT_TRUE(test_server_->InitializeAndWaitUntilReady()); | 30 ASSERT_TRUE(test_server_->InitializeAndWaitUntilReady()); |
| 30 base::FilePath service_dir; | 31 base::FilePath service_dir; |
| 31 CHECK(PathService::Get(base::DIR_MODULE, &service_dir)); | 32 CHECK(PathService::Get(base::DIR_MODULE, &service_dir)); |
| 32 test_server_->ServeFilesFromDirectory(service_dir); | 33 test_server_->ServeFilesFromDirectory(service_dir); |
| 33 } | 34 } |
| 34 | 35 |
| 35 ScopedMessagePipeHandle ShellTestBase::ConnectToServiceViaNetwork( | 36 ScopedMessagePipeHandle ShellTestBase::ConnectToServiceViaNetwork( |
| 36 const GURL& application_url, | 37 const GURL& application_url, |
| 37 const std::string& service_name) { | 38 const std::string& service_name) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 54 shell_context_.mojo_url_resolver()->SetBaseURL( | 55 shell_context_.mojo_url_resolver()->SetBaseURL( |
| 55 net::FilePathToFileURL(service_dir)); | 56 net::FilePathToFileURL(service_dir)); |
| 56 | 57 |
| 57 return shell_context_.service_manager()->ConnectToServiceByName( | 58 return shell_context_.service_manager()->ConnectToServiceByName( |
| 58 application_url, service_name).Pass(); | 59 application_url, service_name).Pass(); |
| 59 } | 60 } |
| 60 | 61 |
| 61 } // namespace test | 62 } // namespace test |
| 62 } // namespace shell | 63 } // namespace shell |
| 63 } // namespace mojo | 64 } // namespace mojo |
| OLD | NEW |