OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MOJO_SHELL_TEST_PACKAGE_MANAGER_H_ | 5 #ifndef MOJO_SHELL_TEST_PACKAGE_MANAGER_H_ |
6 #define MOJO_SHELL_TEST_PACKAGE_MANAGER_H_ | 6 #define MOJO_SHELL_TEST_PACKAGE_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "mojo/shell/package_manager.h" | 11 #include "mojo/shell/package_manager.h" |
12 | 12 |
13 class GURL; | 13 class GURL; |
14 | 14 |
15 namespace mojo { | 15 namespace mojo { |
16 namespace shell { | 16 namespace shell { |
17 | 17 |
18 // An implementation of PackageManager used by tests to support content handler | 18 // An implementation of PackageManager used by tests to support content handler |
19 // registration for MIME types. | 19 // registration for MIME types. |
20 class TestPackageManager : public PackageManager { | 20 class TestPackageManager : public PackageManager { |
21 public: | 21 public: |
22 TestPackageManager(); | 22 TestPackageManager(); |
23 virtual ~TestPackageManager(); | 23 ~TestPackageManager() override; |
24 | 24 |
25 void RegisterContentHandler(const std::string& mime_type, | 25 void RegisterContentHandler(const std::string& mime_type, |
26 const GURL& content_handler_url); | 26 const GURL& content_handler_url); |
27 | 27 |
28 private: | 28 private: |
29 using MimeTypeToURLMap = std::map<std::string, GURL>; | 29 using MimeTypeToURLMap = std::map<std::string, GURL>; |
30 | 30 |
31 // Overridden from PackageManager: | 31 // Overridden from PackageManager: |
32 void SetApplicationManager(ApplicationManager* manager) override; | 32 void SetApplicationManager(ApplicationManager* manager) override; |
33 GURL ResolveURL(const GURL& url) override; | 33 GURL ResolveURL(const GURL& url) override; |
34 void FetchRequest( | 34 void FetchRequest( |
35 URLRequestPtr request, | 35 URLRequestPtr request, |
36 const Fetcher::FetchCallback& loader_callback) override; | 36 const Fetcher::FetchCallback& loader_callback) override; |
37 bool HandleWithContentHandler(Fetcher* fetcher, | 37 bool HandleWithContentHandler(Fetcher* fetcher, |
38 const GURL& unresolved_url, | 38 const GURL& unresolved_url, |
39 base::TaskRunner* task_runner, | 39 base::TaskRunner* task_runner, |
40 URLResponsePtr* new_response, | 40 URLResponsePtr* new_response, |
41 GURL* content_handler_url, | 41 GURL* content_handler_url, |
42 std::string* qualifier) override; | 42 std::string* qualifier) override; |
43 | 43 |
44 MimeTypeToURLMap mime_type_to_url_; | 44 MimeTypeToURLMap mime_type_to_url_; |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(TestPackageManager); | 46 DISALLOW_COPY_AND_ASSIGN(TestPackageManager); |
47 }; | 47 }; |
48 | 48 |
49 } // namespace shell | 49 } // namespace shell |
50 } // namespace mojo | 50 } // namespace mojo |
51 | 51 |
52 #endif // MOJO_SHELL_TEST_PACKAGE_MANAGER_H_ | 52 #endif // MOJO_SHELL_TEST_PACKAGE_MANAGER_H_ |
OLD | NEW |