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
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_TEST_TEST_BROWSER_CONTEXT_H_
6 #define CONTENT_PUBLIC_TEST_TEST_BROWSER_CONTEXT_H_
8 #include "base/compiler_specific.h"
9 #include "base/files/file_path.h"
10 #include "base/files/scoped_temp_dir.h"
11 #include "base/gtest_prod_util.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "content/public/browser/browser_context.h"
17 class MockResourceContext
;
18 class MockSSLHostStateDelegate
;
19 class ZoomLevelDelegate
;
21 class TestBrowserContext
: public BrowserContext
{
24 ~TestBrowserContext() override
;
26 // Takes ownership of the temporary directory so that it's not deleted when
27 // this object is destructed.
28 base::FilePath
TakePath();
30 void SetSpecialStoragePolicy(storage::SpecialStoragePolicy
* policy
);
32 base::FilePath
GetPath() const override
;
33 scoped_ptr
<ZoomLevelDelegate
> CreateZoomLevelDelegate(
34 const base::FilePath
& partition_path
) override
;
35 bool IsOffTheRecord() const override
;
36 DownloadManagerDelegate
* GetDownloadManagerDelegate() override
;
37 net::URLRequestContextGetter
* GetRequestContext() override
;
38 net::URLRequestContextGetter
* GetRequestContextForRenderProcess(
39 int renderer_child_id
) override
;
40 net::URLRequestContextGetter
* GetMediaRequestContext() override
;
41 net::URLRequestContextGetter
* GetMediaRequestContextForRenderProcess(
42 int renderer_child_id
) override
;
43 net::URLRequestContextGetter
* GetMediaRequestContextForStoragePartition(
44 const base::FilePath
& partition_path
,
45 bool in_memory
) override
;
46 ResourceContext
* GetResourceContext() override
;
47 BrowserPluginGuestManager
* GetGuestManager() override
;
48 storage::SpecialStoragePolicy
* GetSpecialStoragePolicy() override
;
49 PushMessagingService
* GetPushMessagingService() override
;
50 SSLHostStateDelegate
* GetSSLHostStateDelegate() override
;
51 PermissionManager
* GetPermissionManager() override
;
54 FRIEND_TEST_ALL_PREFIXES(DOMStorageTest
, SessionOnly
);
55 FRIEND_TEST_ALL_PREFIXES(DOMStorageTest
, SaveSessionState
);
57 scoped_refptr
<net::URLRequestContextGetter
> request_context_
;
58 scoped_ptr
<MockResourceContext
> resource_context_
;
59 base::ScopedTempDir browser_context_dir_
;
60 scoped_refptr
<storage::SpecialStoragePolicy
> special_storage_policy_
;
61 scoped_ptr
<MockSSLHostStateDelegate
> ssl_host_state_delegate_
;
63 DISALLOW_COPY_AND_ASSIGN(TestBrowserContext
);
66 } // namespace content
68 #endif // CONTENT_PUBLIC_TEST_TEST_BROWSER_CONTEXT_H_