Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Unified Diff: mojo/runner/native_runner_unittest.cc

Issue 1338283003: Revert of Move fetching logic out of ApplicationManager, eliminate url mappings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/runner/in_process_native_runner_unittest.cc ('k') | mojo/runner/shell_test_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « mojo/runner/in_process_native_runner_unittest.cc ('k') | mojo/runner/shell_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698