| 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 #include "content/public/test/test_browser_context.h" | 5 #include "content/public/test/test_browser_context.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/test/null_task_runner.h" | 10 #include "base/test/null_task_runner.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 net::TestURLRequestContext context_; | 39 net::TestURLRequestContext context_; |
| 40 scoped_refptr<base::SingleThreadTaskRunner> null_task_runner_; | 40 scoped_refptr<base::SingleThreadTaskRunner> null_task_runner_; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 } // namespace | 43 } // namespace |
| 44 | 44 |
| 45 namespace content { | 45 namespace content { |
| 46 | 46 |
| 47 TestBrowserContext::TestBrowserContext() { | 47 TestBrowserContext::TestBrowserContext() { |
| 48 EXPECT_TRUE(browser_context_dir_.CreateUniqueTempDir()); | 48 EXPECT_TRUE(browser_context_dir_.CreateUniqueTempDir()); |
| 49 BrowserContext::Initialize(this, browser_context_dir_.path()); | 49 BrowserContext::Initialize(this, browser_context_dir_.GetPath()); |
| 50 } | 50 } |
| 51 | 51 |
| 52 TestBrowserContext::~TestBrowserContext() { | 52 TestBrowserContext::~TestBrowserContext() { |
| 53 ShutdownStoragePartitions(); | 53 ShutdownStoragePartitions(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 base::FilePath TestBrowserContext::TakePath() { | 56 base::FilePath TestBrowserContext::TakePath() { |
| 57 return browser_context_dir_.Take(); | 57 return browser_context_dir_.Take(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void TestBrowserContext::SetSpecialStoragePolicy( | 60 void TestBrowserContext::SetSpecialStoragePolicy( |
| 61 storage::SpecialStoragePolicy* policy) { | 61 storage::SpecialStoragePolicy* policy) { |
| 62 special_storage_policy_ = policy; | 62 special_storage_policy_ = policy; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void TestBrowserContext::SetPermissionManager( | 65 void TestBrowserContext::SetPermissionManager( |
| 66 std::unique_ptr<PermissionManager> permission_manager) { | 66 std::unique_ptr<PermissionManager> permission_manager) { |
| 67 permission_manager_ = std::move(permission_manager); | 67 permission_manager_ = std::move(permission_manager); |
| 68 } | 68 } |
| 69 | 69 |
| 70 net::URLRequestContextGetter* TestBrowserContext::GetRequestContext() { | 70 net::URLRequestContextGetter* TestBrowserContext::GetRequestContext() { |
| 71 if (!request_context_.get()) { | 71 if (!request_context_.get()) { |
| 72 request_context_ = new TestContextURLRequestContextGetter(); | 72 request_context_ = new TestContextURLRequestContextGetter(); |
| 73 } | 73 } |
| 74 return request_context_.get(); | 74 return request_context_.get(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 base::FilePath TestBrowserContext::GetPath() const { | 77 base::FilePath TestBrowserContext::GetPath() const { |
| 78 return browser_context_dir_.path(); | 78 return browser_context_dir_.GetPath(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 std::unique_ptr<ZoomLevelDelegate> TestBrowserContext::CreateZoomLevelDelegate( | 81 std::unique_ptr<ZoomLevelDelegate> TestBrowserContext::CreateZoomLevelDelegate( |
| 82 const base::FilePath& partition_path) { | 82 const base::FilePath& partition_path) { |
| 83 return std::unique_ptr<ZoomLevelDelegate>(); | 83 return std::unique_ptr<ZoomLevelDelegate>(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool TestBrowserContext::IsOffTheRecord() const { | 86 bool TestBrowserContext::IsOffTheRecord() const { |
| 87 return false; | 87 return false; |
| 88 } | 88 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 147 } |
| 148 | 148 |
| 149 net::URLRequestContextGetter* | 149 net::URLRequestContextGetter* |
| 150 TestBrowserContext::CreateMediaRequestContextForStoragePartition( | 150 TestBrowserContext::CreateMediaRequestContextForStoragePartition( |
| 151 const base::FilePath& partition_path, | 151 const base::FilePath& partition_path, |
| 152 bool in_memory) { | 152 bool in_memory) { |
| 153 return NULL; | 153 return NULL; |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace content | 156 } // namespace content |
| OLD | NEW |