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

Unified Diff: mojo/shell/capability_filter_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/shell/application_manager_unittest.cc ('k') | mojo/shell/local_fetcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/capability_filter_unittest.cc
diff --git a/mojo/shell/capability_filter_unittest.cc b/mojo/shell/capability_filter_unittest.cc
index 73a9588feb6552de09a85ffcba67e5d79205941f..a659d42b45dddcaeadba7c5da99fc6c82efb3058 100644
--- a/mojo/shell/capability_filter_unittest.cc
+++ b/mojo/shell/capability_filter_unittest.cc
@@ -18,6 +18,7 @@
#include "mojo/application/public/interfaces/content_handler.mojom.h"
#include "mojo/common/weak_binding_set.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "mojo/shell/application_fetcher.h"
#include "mojo/shell/application_loader.h"
#include "mojo/shell/application_manager.h"
#include "mojo/shell/capability_filter_unittest.mojom.h"
@@ -284,35 +285,30 @@ class TestFetcher : public Fetcher {
DISALLOW_COPY_AND_ASSIGN(TestFetcher);
};
-class TestApplicationManagerDelegate : public ApplicationManager::Delegate {
+class TestApplicationFetcher : public ApplicationFetcher {
public:
- TestApplicationManagerDelegate() {}
- ~TestApplicationManagerDelegate() override {}
+ TestApplicationFetcher() {}
+ ~TestApplicationFetcher() override {}
void set_use_test_fetcher(bool use_test_fetcher) {
use_test_fetcher_ = use_test_fetcher;
}
private:
- // Overridden from ApplicationManager::Delegate:
- GURL ResolveMappings(const GURL& url) override {
+ // Overridden from ApplicationFetcher:
+ void SetApplicationManager(ApplicationManager* manager) override {}
+ GURL ResolveURL(const GURL& url) override {
return url;
}
- GURL ResolveMojoURL(const GURL& url) override {
- return url;
- }
- bool CreateFetcher(const GURL& url,
- const Fetcher::FetchCallback& loader_callback) override {
- if (use_test_fetcher_) {
- new TestFetcher(url, loader_callback);
- return true;
- }
- return false;
+ void FetchRequest(URLRequestPtr request,
+ const Fetcher::FetchCallback& loader_callback) override {
+ if (use_test_fetcher_)
+ new TestFetcher(GURL(request->url), loader_callback);
}
bool use_test_fetcher_;
- DISALLOW_COPY_AND_ASSIGN(TestApplicationManagerDelegate);
+ DISALLOW_COPY_AND_ASSIGN(TestApplicationFetcher);
};
class TestLoader : public ApplicationLoader {
@@ -334,7 +330,9 @@ class TestLoader : public ApplicationLoader {
class CapabilityFilterTest : public testing::Test {
public:
- CapabilityFilterTest() : validator_(nullptr) {}
+ CapabilityFilterTest()
+ : test_application_fetcher_(nullptr),
+ validator_(nullptr) {}
~CapabilityFilterTest() override {}
protected:
@@ -391,18 +389,20 @@ class CapabilityFilterTest : public testing::Test {
}
ConnectionValidator* validator() { return validator_; }
void set_use_test_fetcher() {
- test_delegate_.set_use_test_fetcher(true);
+ test_application_fetcher_->set_use_test_fetcher(true);
}
// Overridden from testing::Test:
void SetUp() override {
- application_manager_.reset(new ApplicationManager(&test_delegate_));
+ test_application_fetcher_ = new TestApplicationFetcher;
+ application_manager_.reset(
+ new ApplicationManager(make_scoped_ptr(test_application_fetcher_)));
CreateLoader<ServiceApplication>("test:service");
CreateLoader<ServiceApplication>("test:service2");
}
void TearDown() override {
application_manager_.reset();
- test_delegate_.set_use_test_fetcher(false);
+ test_application_fetcher_->set_use_test_fetcher(false);
}
private:
@@ -411,8 +411,8 @@ class CapabilityFilterTest : public testing::Test {
return scoped_ptr<ApplicationDelegate>(new T);
}
+ TestApplicationFetcher* test_application_fetcher_;
base::ShadowingAtExitManager at_exit_;
- TestApplicationManagerDelegate test_delegate_;
base::MessageLoop loop_;
scoped_ptr<ApplicationManager> application_manager_;
ConnectionValidator* validator_;
« no previous file with comments | « mojo/shell/application_manager_unittest.cc ('k') | mojo/shell/local_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698