| Index: mojo/runner/native_runner_unittest.cc
|
| diff --git a/mojo/runner/native_runner_unittest.cc b/mojo/runner/native_runner_unittest.cc
|
| index 529d2762a8f3e7e7e0dcaa6223dbc4f060248527..4df437ab29d41edbafd2721425141784f8e5ef90 100644
|
| --- a/mojo/runner/native_runner_unittest.cc
|
| +++ b/mojo/runner/native_runner_unittest.cc
|
| @@ -3,9 +3,8 @@
|
| // found in the LICENSE file.
|
|
|
| #include "base/files/scoped_temp_dir.h"
|
| -#include "base/path_service.h"
|
| -#include "mojo/fetcher/base_application_fetcher.h"
|
| #include "mojo/runner/context.h"
|
| +#include "mojo/runner/url_resolver.h"
|
| #include "mojo/shell/application_manager.h"
|
| #include "mojo/util/filename_util.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -59,32 +58,40 @@
|
| TestState* state_;
|
| };
|
|
|
| -class NativeApplicationLoaderTest : public testing::Test {
|
| +class NativeApplicationLoaderTest : public testing::Test,
|
| + public shell::ApplicationManager::Delegate {
|
| public:
|
| - NativeApplicationLoaderTest() {
|
| - base::FilePath shell_dir;
|
| - PathService::Get(base::DIR_MODULE, &shell_dir);
|
| - context_.reset(new Context(shell_dir));
|
| - loop_.reset(new base::MessageLoop);
|
| - }
|
| - ~NativeApplicationLoaderTest() override {
|
| - loop_.reset();
|
| - context_.reset();
|
| - }
|
| + NativeApplicationLoaderTest() : application_manager_(this) {}
|
| + ~NativeApplicationLoaderTest() override {}
|
| void SetUp() override {
|
| - context_->Init();
|
| + context_.Init();
|
| scoped_ptr<shell::NativeRunnerFactory> factory(
|
| new TestNativeRunnerFactory(&state_));
|
| - context_->application_manager()->set_native_runner_factory(factory.Pass());
|
| - context_->application_manager()->set_blocking_pool(
|
| - context_->task_runners()->blocking_pool());
|
| + application_manager_.set_native_runner_factory(factory.Pass());
|
| + application_manager_.set_blocking_pool(
|
| + context_.task_runners()->blocking_pool());
|
| }
|
| - void TearDown() override { context_->Shutdown(); }
|
| + void TearDown() override { context_.Shutdown(); }
|
|
|
| protected:
|
| - scoped_ptr<base::MessageLoop> loop_;
|
| - scoped_ptr<Context> context_;
|
| + Context context_;
|
| + base::MessageLoop loop_;
|
| + shell::ApplicationManager application_manager_;
|
| TestState state_;
|
| +
|
| + private:
|
| + // shell::ApplicationManager::Delegate
|
| + GURL ResolveMappings(const GURL& url) override {
|
| + return context_.url_resolver()->ApplyMappings(url);
|
| + }
|
| + GURL ResolveMojoURL(const GURL& url) override {
|
| + return context_.url_resolver()->ResolveMojoURL(url);
|
| + }
|
| + bool CreateFetcher(
|
| + const GURL& url,
|
| + const shell::Fetcher::FetchCallback& loader_callback) override {
|
| + return false;
|
| + }
|
| };
|
|
|
| TEST_F(NativeApplicationLoaderTest, DoesNotExist) {
|
| @@ -96,7 +103,7 @@
|
| ServiceProviderPtr service_provider;
|
| mojo::URLRequestPtr request(mojo::URLRequest::New());
|
| request->url = mojo::String::From(url.spec());
|
| - context_->application_manager()->ConnectToApplication(
|
| + application_manager_.ConnectToApplication(
|
| nullptr, request.Pass(), std::string(), services.Pass(),
|
| service_provider.Pass(), shell::GetPermissiveCapabilityFilter(),
|
| base::Closure(), shell::EmptyConnectCallback());
|
|
|