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

Unified Diff: mojo/runner/native_runner_unittest.cc

Issue 1342503003: 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 4df437ab29d41edbafd2721425141784f8e5ef90..529d2762a8f3e7e7e0dcaa6223dbc4f060248527 100644
--- a/mojo/runner/native_runner_unittest.cc
+++ b/mojo/runner/native_runner_unittest.cc
@@ -3,8 +3,9 @@
// 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"
@@ -58,40 +59,32 @@ class TestNativeRunnerFactory : public shell::NativeRunnerFactory {
TestState* state_;
};
-class NativeApplicationLoaderTest : public testing::Test,
- public shell::ApplicationManager::Delegate {
+class NativeApplicationLoaderTest : public testing::Test {
public:
- NativeApplicationLoaderTest() : application_manager_(this) {}
- ~NativeApplicationLoaderTest() override {}
+ 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();
+ }
void SetUp() override {
- context_.Init();
+ context_->Init();
scoped_ptr<shell::NativeRunnerFactory> factory(
new TestNativeRunnerFactory(&state_));
- application_manager_.set_native_runner_factory(factory.Pass());
- application_manager_.set_blocking_pool(
- context_.task_runners()->blocking_pool());
+ context_->application_manager()->set_native_runner_factory(factory.Pass());
+ context_->application_manager()->set_blocking_pool(
+ context_->task_runners()->blocking_pool());
}
- void TearDown() override { context_.Shutdown(); }
+ void TearDown() override { context_->Shutdown(); }
protected:
- Context context_;
- base::MessageLoop loop_;
- shell::ApplicationManager application_manager_;
+ scoped_ptr<base::MessageLoop> loop_;
+ scoped_ptr<Context> context_;
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) {
@@ -103,7 +96,7 @@ TEST_F(NativeApplicationLoaderTest, DoesNotExist) {
ServiceProviderPtr service_provider;
mojo::URLRequestPtr request(mojo::URLRequest::New());
request->url = mojo::String::From(url.spec());
- application_manager_.ConnectToApplication(
+ context_->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