OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_TEST_TEST_BROWSER_CONTEXT_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_TEST_BROWSER_CONTEXT_H_ |
6 #define CONTENT_PUBLIC_TEST_TEST_BROWSER_CONTEXT_H_ | 6 #define CONTENT_PUBLIC_TEST_TEST_BROWSER_CONTEXT_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
9 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
10 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 | 18 |
18 class MockBackgroundSyncController; | 19 class MockBackgroundSyncController; |
19 class MockResourceContext; | 20 class MockResourceContext; |
20 class MockSSLHostStateDelegate; | 21 class MockSSLHostStateDelegate; |
21 class ZoomLevelDelegate; | 22 class ZoomLevelDelegate; |
22 | 23 |
23 class TestBrowserContext : public BrowserContext { | 24 class TestBrowserContext : public BrowserContext { |
24 public: | 25 public: |
25 TestBrowserContext(); | 26 TestBrowserContext(); |
26 ~TestBrowserContext() override; | 27 ~TestBrowserContext() override; |
27 | 28 |
28 // Takes ownership of the temporary directory so that it's not deleted when | 29 // Takes ownership of the temporary directory so that it's not deleted when |
29 // this object is destructed. | 30 // this object is destructed. |
30 base::FilePath TakePath(); | 31 base::FilePath TakePath(); |
31 | 32 |
32 void SetSpecialStoragePolicy(storage::SpecialStoragePolicy* policy); | 33 void SetSpecialStoragePolicy(storage::SpecialStoragePolicy* policy); |
33 void SetPermissionManager(scoped_ptr<PermissionManager> permission_manager); | 34 void SetPermissionManager( |
| 35 std::unique_ptr<PermissionManager> permission_manager); |
34 | 36 |
35 base::FilePath GetPath() const override; | 37 base::FilePath GetPath() const override; |
36 scoped_ptr<ZoomLevelDelegate> CreateZoomLevelDelegate( | 38 std::unique_ptr<ZoomLevelDelegate> CreateZoomLevelDelegate( |
37 const base::FilePath& partition_path) override; | 39 const base::FilePath& partition_path) override; |
38 bool IsOffTheRecord() const override; | 40 bool IsOffTheRecord() const override; |
39 DownloadManagerDelegate* GetDownloadManagerDelegate() override; | 41 DownloadManagerDelegate* GetDownloadManagerDelegate() override; |
40 net::URLRequestContextGetter* GetRequestContext() override; | 42 net::URLRequestContextGetter* GetRequestContext() override; |
41 net::URLRequestContextGetter* GetMediaRequestContext() override; | 43 net::URLRequestContextGetter* GetMediaRequestContext() override; |
42 net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( | 44 net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( |
43 int renderer_child_id) override; | 45 int renderer_child_id) override; |
44 net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition( | 46 net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition( |
45 const base::FilePath& partition_path, | 47 const base::FilePath& partition_path, |
46 bool in_memory) override; | 48 bool in_memory) override; |
47 ResourceContext* GetResourceContext() override; | 49 ResourceContext* GetResourceContext() override; |
48 BrowserPluginGuestManager* GetGuestManager() override; | 50 BrowserPluginGuestManager* GetGuestManager() override; |
49 storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; | 51 storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; |
50 PushMessagingService* GetPushMessagingService() override; | 52 PushMessagingService* GetPushMessagingService() override; |
51 SSLHostStateDelegate* GetSSLHostStateDelegate() override; | 53 SSLHostStateDelegate* GetSSLHostStateDelegate() override; |
52 PermissionManager* GetPermissionManager() override; | 54 PermissionManager* GetPermissionManager() override; |
53 BackgroundSyncController* GetBackgroundSyncController() override; | 55 BackgroundSyncController* GetBackgroundSyncController() override; |
54 net::URLRequestContextGetter* CreateRequestContext( | 56 net::URLRequestContextGetter* CreateRequestContext( |
55 ProtocolHandlerMap* protocol_handlers, | 57 ProtocolHandlerMap* protocol_handlers, |
56 URLRequestInterceptorScopedVector request_interceptors) override; | 58 URLRequestInterceptorScopedVector request_interceptors) override; |
57 net::URLRequestContextGetter* CreateRequestContextForStoragePartition( | 59 net::URLRequestContextGetter* CreateRequestContextForStoragePartition( |
58 const base::FilePath& partition_path, | 60 const base::FilePath& partition_path, |
59 bool in_memory, | 61 bool in_memory, |
60 ProtocolHandlerMap* protocol_handlers, | 62 ProtocolHandlerMap* protocol_handlers, |
61 URLRequestInterceptorScopedVector request_interceptors) override; | 63 URLRequestInterceptorScopedVector request_interceptors) override; |
62 | 64 |
63 private: | 65 private: |
64 base::ScopedTempDir browser_context_dir_; | 66 base::ScopedTempDir browser_context_dir_; |
65 scoped_refptr<net::URLRequestContextGetter> request_context_; | 67 scoped_refptr<net::URLRequestContextGetter> request_context_; |
66 scoped_ptr<MockResourceContext> resource_context_; | 68 std::unique_ptr<MockResourceContext> resource_context_; |
67 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_; | 69 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_; |
68 scoped_ptr<MockSSLHostStateDelegate> ssl_host_state_delegate_; | 70 std::unique_ptr<MockSSLHostStateDelegate> ssl_host_state_delegate_; |
69 scoped_ptr<PermissionManager> permission_manager_; | 71 std::unique_ptr<PermissionManager> permission_manager_; |
70 scoped_ptr<MockBackgroundSyncController> background_sync_controller_; | 72 std::unique_ptr<MockBackgroundSyncController> background_sync_controller_; |
71 | 73 |
72 DISALLOW_COPY_AND_ASSIGN(TestBrowserContext); | 74 DISALLOW_COPY_AND_ASSIGN(TestBrowserContext); |
73 }; | 75 }; |
74 | 76 |
75 } // namespace content | 77 } // namespace content |
76 | 78 |
77 #endif // CONTENT_PUBLIC_TEST_TEST_BROWSER_CONTEXT_H_ | 79 #endif // CONTENT_PUBLIC_TEST_TEST_BROWSER_CONTEXT_H_ |
OLD | NEW |