| 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_helper.h" | 5 #include "mojo/shell/shell_test_helper.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/path_service.h" |
| 9 #include "mojo/shell/init.h" | 12 #include "mojo/shell/init.h" |
| 13 #include "net/base/filename_util.h" |
| 10 | 14 |
| 11 namespace mojo { | 15 namespace mojo { |
| 12 namespace shell { | 16 namespace shell { |
| 13 | 17 |
| 14 ShellTestHelper::ShellTestHelper() { | 18 ShellTestHelper::ShellTestHelper() { |
| 15 base::CommandLine::Init(0, NULL); | 19 base::CommandLine::Init(0, NULL); |
| 16 mojo::shell::InitializeLogging(); | 20 mojo::shell::InitializeLogging(); |
| 17 } | 21 } |
| 18 | 22 |
| 19 ShellTestHelper::~ShellTestHelper() { | 23 ShellTestHelper::~ShellTestHelper() { |
| 20 } | 24 } |
| 21 | 25 |
| 22 void ShellTestHelper::Init() { | 26 void ShellTestHelper::Init() { |
| 23 context_.reset(new Context); | 27 context_.reset(new Context); |
| 24 test_api_.reset(new ServiceManager::TestAPI(context_->service_manager())); | 28 test_api_.reset(new ServiceManager::TestAPI(context_->service_manager())); |
| 29 base::FilePath service_dir; |
| 30 CHECK(PathService::Get(base::DIR_MODULE, &service_dir)); |
| 31 context_->mojo_url_resolver()->set_origin( |
| 32 net::FilePathToFileURL(service_dir).spec()); |
| 25 } | 33 } |
| 26 | 34 |
| 27 void ShellTestHelper::SetLoaderForURL(scoped_ptr<ServiceLoader> loader, | 35 void ShellTestHelper::SetLoaderForURL(scoped_ptr<ServiceLoader> loader, |
| 28 const GURL& url) { | 36 const GURL& url) { |
| 29 context_->service_manager()->SetLoaderForURL(loader.Pass(), url); | 37 context_->service_manager()->SetLoaderForURL(loader.Pass(), url); |
| 30 } | 38 } |
| 31 | 39 |
| 32 } // namespace shell | 40 } // namespace shell |
| 33 } // namespace mojo | 41 } // namespace mojo |
| OLD | NEW |