Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(926)

Side by Side Diff: content/browser/mock_resource_context.h

Issue 9369009: Make content::ResourceContext be a real interface like the rest of the Content API (i.e. don't ha... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_BROWSER_MOCK_RESOURCE_CONTEXT_H_ 5 #ifndef CONTENT_BROWSER_MOCK_RESOURCE_CONTEXT_H_
6 #define CONTENT_BROWSER_MOCK_RESOURCE_CONTEXT_H_ 6 #define CONTENT_BROWSER_MOCK_RESOURCE_CONTEXT_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "content/browser/resource_context.h" 11 #include "content/browser/resource_context.h"
12 #include "net/url_request/url_request_context.h"
12 13
13 namespace base { 14 namespace base {
14 template <typename T> 15 template <typename T>
15 struct DefaultLazyInstanceTraits; 16 struct DefaultLazyInstanceTraits;
16 } // namespace base 17 } // namespace base
17 18
18 namespace content { 19 namespace content {
19 20
20 class MockResourceContext : public ResourceContext { 21 class MockResourceContext : public ResourceContext {
21 public: 22 public:
22 // Note that this is a shared instance between all tests. Make no assumptions 23 // Note that this is a shared instance between all tests. Make no assumptions
23 // regarding its members. 24 // regarding its members. Or you can construct a local version below.
24 static MockResourceContext* GetInstance(); 25 static MockResourceContext* GetInstance();
25 26
27 MockResourceContext();
28 explicit MockResourceContext(net::URLRequestContext* context);
29 virtual ~MockResourceContext();
30
31 void set_request_context(net::URLRequestContext* context) {
32 test_request_context_ = context;
33 }
34
35 void set_media_observer(MediaObserver* observer) {
36 media_observer_ = observer;
37 }
38 void set_media_stream_manager(media_stream::MediaStreamManager* manager) {
39 media_stream_manager_ = manager;
40 }
41 void set_audio_manager(AudioManager* manager) { audio_manager_ = manager; }
42
43 // ResourceContext implementation:
44 virtual net::HostResolver* GetHostResolver() OVERRIDE;
45 virtual net::URLRequestContext* GetRequestContext() OVERRIDE;
46 virtual ChromeAppCacheService* GetAppCacheService() OVERRIDE;
47 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() OVERRIDE;
48 virtual fileapi::FileSystemContext* GetFileSystemContext() OVERRIDE;
49 virtual ChromeBlobStorageContext* GetBlobStorageContext() OVERRIDE;
50 virtual quota::QuotaManager* GetQuotaManager() OVERRIDE;
51 virtual HostZoomMap* GetHostZoomMap() OVERRIDE;
52 virtual MediaObserver* GetMediaObserver() OVERRIDE;
53 virtual media_stream::MediaStreamManager* GetMediaStreamManager() OVERRIDE;
54 virtual AudioManager* GetAudioManager() OVERRIDE;
55
26 private: 56 private:
27 friend struct base::DefaultLazyInstanceTraits<MockResourceContext>; 57 friend struct base::DefaultLazyInstanceTraits<MockResourceContext>;
28 58
29 MockResourceContext(); 59 scoped_refptr<net::URLRequestContext> test_request_context_;
30 virtual ~MockResourceContext(); 60 MediaObserver* media_observer_;
31 virtual void EnsureInitialized() const OVERRIDE; 61 media_stream::MediaStreamManager* media_stream_manager_;
32 62 AudioManager* audio_manager_;
33 const scoped_refptr<net::URLRequestContext> test_request_context_;
34 }; 63 };
35 64
36 } // namespace content 65 } // namespace content
37 66
38 #endif // CONTENT_BROWSER_MOCK_RESOURCE_CONTEXT_H_ 67 #endif // CONTENT_BROWSER_MOCK_RESOURCE_CONTEXT_H_
OLDNEW
« no previous file with comments | « content/browser/mock_content_browser_client.cc ('k') | content/browser/mock_resource_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698