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

Unified Diff: mojo/fetcher/about_fetcher_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/fetcher/about_fetcher.cc ('k') | mojo/fetcher/base_application_fetcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/fetcher/about_fetcher_unittest.cc
diff --git a/mojo/runner/about_fetcher_unittest.cc b/mojo/fetcher/about_fetcher_unittest.cc
similarity index 84%
rename from mojo/runner/about_fetcher_unittest.cc
rename to mojo/fetcher/about_fetcher_unittest.cc
index 2f5b2d91093531d43b558ce21d31a33572edb7f8..81e46124de0ef1b58087a53e47e30a8b3d4d7850 100644
--- a/mojo/runner/about_fetcher_unittest.cc
+++ b/mojo/fetcher/about_fetcher_unittest.cc
@@ -6,6 +6,7 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
+#include "base/path_service.h"
#include "base/run_loop.h"
#include "mojo/application/public/cpp/application_connection.h"
#include "mojo/application/public/cpp/application_delegate.h"
@@ -13,14 +14,16 @@
#include "mojo/application/public/cpp/interface_factory.h"
#include "mojo/application/public/interfaces/content_handler.mojom.h"
#include "mojo/common/weak_binding_set.h"
-#include "mojo/runner/about_fetcher.h"
+#include "mojo/fetcher/about_fetcher.h"
+#include "mojo/fetcher/base_application_fetcher.h"
#include "mojo/runner/context.h"
#include "mojo/shell/application_loader.h"
#include "mojo/shell/application_manager.h"
+#include "mojo/util/filename_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace mojo {
-namespace runner {
+namespace fetcher {
namespace {
class TestContentHandler : public ApplicationDelegate,
@@ -67,30 +70,6 @@ class TestContentHandler : public ApplicationDelegate,
DISALLOW_COPY_AND_ASSIGN(TestContentHandler);
};
-class TestApplicationManagerDelegate
- : public shell::ApplicationManager::Delegate {
- public:
- TestApplicationManagerDelegate() {}
- ~TestApplicationManagerDelegate() override {}
-
- private:
- // Overridden from ApplicationManager::Delegate:
- GURL ResolveMappings(const GURL& url) override { return url; }
- GURL ResolveMojoURL(const GURL& url) override { return url; }
- bool CreateFetcher(
- const GURL& url,
- const shell::Fetcher::FetchCallback& loader_callback) override {
- if (url.SchemeIs(AboutFetcher::kAboutScheme)) {
- AboutFetcher::Start(url, loader_callback);
- return true;
- }
-
- return false;
- }
-
- DISALLOW_COPY_AND_ASSIGN(TestApplicationManagerDelegate);
-};
-
class TestLoader : public shell::ApplicationLoader {
public:
explicit TestLoader(ApplicationDelegate* delegate) : delegate_(delegate) {}
@@ -143,8 +122,11 @@ class AboutFetcherTest : public testing::Test {
// Overridden from testing::Test:
void SetUp() override {
- Context::EnsureEmbedderIsInitialized();
- application_manager_.reset(new shell::ApplicationManager(&test_delegate_));
+ runner::Context::EnsureEmbedderIsInitialized();
+ base::FilePath shell_dir;
+ PathService::Get(base::DIR_MODULE, &shell_dir);
+ application_manager_.reset(new shell::ApplicationManager(
+ make_scoped_ptr(new BaseApplicationFetcher(shell_dir))));
application_manager_->SetLoaderForURL(
make_scoped_ptr(new TestLoader(&html_content_handler_)),
GURL("test:html_content_handler"));
@@ -156,7 +138,6 @@ class AboutFetcherTest : public testing::Test {
private:
base::ShadowingAtExitManager at_exit_;
- TestApplicationManagerDelegate test_delegate_;
TestContentHandler html_content_handler_;
base::MessageLoop loop_;
scoped_ptr<shell::ApplicationManager> application_manager_;
@@ -183,5 +164,5 @@ TEST_F(AboutFetcherTest, UnrecognizedURL) {
}
} // namespace
-} // namespace runner
+} // namespace fetcher
} // namespace mojo
« no previous file with comments | « mojo/fetcher/about_fetcher.cc ('k') | mojo/fetcher/base_application_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698