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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/mock_resource_context.h
===================================================================
--- content/browser/mock_resource_context.h (revision 121250)
+++ content/browser/mock_resource_context.h (working copy)
@@ -9,6 +9,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "content/browser/resource_context.h"
+#include "net/url_request/url_request_context.h"
namespace base {
template <typename T>
@@ -20,17 +21,45 @@
class MockResourceContext : public ResourceContext {
public:
// Note that this is a shared instance between all tests. Make no assumptions
- // regarding its members.
+ // regarding its members. Or you can construct a local version below.
static MockResourceContext* GetInstance();
+ MockResourceContext();
+ explicit MockResourceContext(net::URLRequestContext* context);
+ virtual ~MockResourceContext();
+
+ void set_request_context(net::URLRequestContext* context) {
+ test_request_context_ = context;
+ }
+
+ void set_media_observer(MediaObserver* observer) {
+ media_observer_ = observer;
+ }
+ void set_media_stream_manager(media_stream::MediaStreamManager* manager) {
+ media_stream_manager_ = manager;
+ }
+ void set_audio_manager(AudioManager* manager) { audio_manager_ = manager; }
+
+ // ResourceContext implementation:
+ virtual net::HostResolver* GetHostResolver() OVERRIDE;
+ virtual net::URLRequestContext* GetRequestContext() OVERRIDE;
+ virtual ChromeAppCacheService* GetAppCacheService() OVERRIDE;
+ virtual webkit_database::DatabaseTracker* GetDatabaseTracker() OVERRIDE;
+ virtual fileapi::FileSystemContext* GetFileSystemContext() OVERRIDE;
+ virtual ChromeBlobStorageContext* GetBlobStorageContext() OVERRIDE;
+ virtual quota::QuotaManager* GetQuotaManager() OVERRIDE;
+ virtual HostZoomMap* GetHostZoomMap() OVERRIDE;
+ virtual MediaObserver* GetMediaObserver() OVERRIDE;
+ virtual media_stream::MediaStreamManager* GetMediaStreamManager() OVERRIDE;
+ virtual AudioManager* GetAudioManager() OVERRIDE;
+
private:
friend struct base::DefaultLazyInstanceTraits<MockResourceContext>;
- MockResourceContext();
- virtual ~MockResourceContext();
- virtual void EnsureInitialized() const OVERRIDE;
-
- const scoped_refptr<net::URLRequestContext> test_request_context_;
+ scoped_refptr<net::URLRequestContext> test_request_context_;
+ MediaObserver* media_observer_;
+ media_stream::MediaStreamManager* media_stream_manager_;
+ AudioManager* audio_manager_;
};
} // namespace content
« 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