| 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> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "content/public/browser/browser_context.h" | 15 #include "content/public/browser/browser_context.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 class MockBackgroundSyncController; | 19 class MockBackgroundSyncController; |
| 20 class MockResourceContext; | 20 class MockResourceContext; |
| 21 class MockSSLHostStateDelegate; | 21 class MockSSLHostStateDelegate; |
| 22 #if !defined(OS_ANDROID) |
| 22 class ZoomLevelDelegate; | 23 class ZoomLevelDelegate; |
| 24 #endif // !defined(OS_ANDROID) |
| 23 | 25 |
| 24 class TestBrowserContext : public BrowserContext { | 26 class TestBrowserContext : public BrowserContext { |
| 25 public: | 27 public: |
| 26 TestBrowserContext(); | 28 TestBrowserContext(); |
| 27 ~TestBrowserContext() override; | 29 ~TestBrowserContext() override; |
| 28 | 30 |
| 29 // Takes ownership of the temporary directory so that it's not deleted when | 31 // Takes ownership of the temporary directory so that it's not deleted when |
| 30 // this object is destructed. | 32 // this object is destructed. |
| 31 base::FilePath TakePath(); | 33 base::FilePath TakePath(); |
| 32 | 34 |
| 33 void SetSpecialStoragePolicy(storage::SpecialStoragePolicy* policy); | 35 void SetSpecialStoragePolicy(storage::SpecialStoragePolicy* policy); |
| 34 void SetPermissionManager( | 36 void SetPermissionManager( |
| 35 std::unique_ptr<PermissionManager> permission_manager); | 37 std::unique_ptr<PermissionManager> permission_manager); |
| 36 net::URLRequestContextGetter* GetRequestContext(); | 38 net::URLRequestContextGetter* GetRequestContext(); |
| 37 | 39 |
| 38 // Allow clients to make this an incognito context. | 40 // Allow clients to make this an incognito context. |
| 39 void set_is_off_the_record(bool is_off_the_record) { | 41 void set_is_off_the_record(bool is_off_the_record) { |
| 40 is_off_the_record_ = is_off_the_record; | 42 is_off_the_record_ = is_off_the_record; |
| 41 } | 43 } |
| 42 | 44 |
| 43 // BrowserContext implementation. | 45 // BrowserContext implementation. |
| 44 base::FilePath GetPath() const override; | 46 base::FilePath GetPath() const override; |
| 47 #if !defined(OS_ANDROID) |
| 45 std::unique_ptr<ZoomLevelDelegate> CreateZoomLevelDelegate( | 48 std::unique_ptr<ZoomLevelDelegate> CreateZoomLevelDelegate( |
| 46 const base::FilePath& partition_path) override; | 49 const base::FilePath& partition_path) override; |
| 50 #endif // !defined(OS_ANDROID) |
| 47 bool IsOffTheRecord() const override; | 51 bool IsOffTheRecord() const override; |
| 48 DownloadManagerDelegate* GetDownloadManagerDelegate() override; | 52 DownloadManagerDelegate* GetDownloadManagerDelegate() override; |
| 49 ResourceContext* GetResourceContext() override; | 53 ResourceContext* GetResourceContext() override; |
| 50 BrowserPluginGuestManager* GetGuestManager() override; | 54 BrowserPluginGuestManager* GetGuestManager() override; |
| 51 storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; | 55 storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; |
| 52 PushMessagingService* GetPushMessagingService() override; | 56 PushMessagingService* GetPushMessagingService() override; |
| 53 SSLHostStateDelegate* GetSSLHostStateDelegate() override; | 57 SSLHostStateDelegate* GetSSLHostStateDelegate() override; |
| 54 PermissionManager* GetPermissionManager() override; | 58 PermissionManager* GetPermissionManager() override; |
| 55 BackgroundSyncController* GetBackgroundSyncController() override; | 59 BackgroundSyncController* GetBackgroundSyncController() override; |
| 56 net::URLRequestContextGetter* CreateRequestContext( | 60 net::URLRequestContextGetter* CreateRequestContext( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 75 std::unique_ptr<PermissionManager> permission_manager_; | 79 std::unique_ptr<PermissionManager> permission_manager_; |
| 76 std::unique_ptr<MockBackgroundSyncController> background_sync_controller_; | 80 std::unique_ptr<MockBackgroundSyncController> background_sync_controller_; |
| 77 bool is_off_the_record_ = false; | 81 bool is_off_the_record_ = false; |
| 78 | 82 |
| 79 DISALLOW_COPY_AND_ASSIGN(TestBrowserContext); | 83 DISALLOW_COPY_AND_ASSIGN(TestBrowserContext); |
| 80 }; | 84 }; |
| 81 | 85 |
| 82 } // namespace content | 86 } // namespace content |
| 83 | 87 |
| 84 #endif // CONTENT_PUBLIC_TEST_TEST_BROWSER_CONTEXT_H_ | 88 #endif // CONTENT_PUBLIC_TEST_TEST_BROWSER_CONTEXT_H_ |
| OLD | NEW |