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

Unified Diff: mojo/shell/test_package_manager.h

Issue 1352663002: Extract some stuff into PackageManager (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/package_manager.h ('k') | mojo/shell/test_package_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/test_package_manager.h
diff --git a/mojo/shell/test_package_manager.h b/mojo/shell/test_package_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..6a3e29f242f2287bfc8430f645bc5458b5956a9a
--- /dev/null
+++ b/mojo/shell/test_package_manager.h
@@ -0,0 +1,52 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_SHELL_TEST_PACKAGE_MANAGER_H_
+#define MOJO_SHELL_TEST_PACKAGE_MANAGER_H_
+
+#include <map>
+#include <string>
+
+#include "mojo/shell/package_manager.h"
+
+class GURL;
+
+namespace mojo {
+namespace shell {
+
+// An implementation of PackageManager used by tests to support content handler
+// registration for MIME types.
+class TestPackageManager : public PackageManager {
+ public:
+ TestPackageManager();
+ virtual ~TestPackageManager();
+
+ void RegisterContentHandler(const std::string& mime_type,
+ const GURL& content_handler_url);
+
+ private:
+ using MimeTypeToURLMap = std::map<std::string, GURL>;
+
+ // Overridden from PackageManager:
+ void SetApplicationManager(ApplicationManager* manager) override;
+ GURL ResolveURL(const GURL& url) override;
+ void FetchRequest(
+ URLRequestPtr request,
+ const Fetcher::FetchCallback& loader_callback) override;
+ bool HandleWithContentHandler(Fetcher* fetcher,
+ const GURL& unresolved_url,
+ base::TaskRunner* task_runner,
+ URLResponsePtr* new_response,
+ GURL* content_handler_url,
+ std::string* qualifier) override;
+
+ MimeTypeToURLMap mime_type_to_url_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestPackageManager);
+};
+
+} // namespace shell
+} // namespace mojo
+
+#endif // MOJO_SHELL_TEST_PACKAGE_MANAGER_H_
« no previous file with comments | « mojo/shell/package_manager.h ('k') | mojo/shell/test_package_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698