summaryrefslogtreecommitdiffstats
path: root/webkit/blob/mock_blob_url_request_context.h
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-16 05:16:23 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-16 05:16:23 +0000
commit169adebb59774f88757a940621998440c590336b (patch)
tree7dda8ad06b08912556d30eac97058b2ad58e9d83 /webkit/blob/mock_blob_url_request_context.h
parentb1b800c69645b72c13df44a5b770d5b295b194fb (diff)
downloadchromium_src-169adebb59774f88757a940621998440c590336b.zip
chromium_src-169adebb59774f88757a940621998440c590336b.tar.gz
chromium_src-169adebb59774f88757a940621998440c590336b.tar.bz2
Implement CannedSyncableFileSystem.Write for write testing
Also factor out MockBlobURLRequestContext class so that we can easily test writing with blob urls. BUG=148897 TEST=LocalFileChangeTrackerTest.* TBR=jam@chromium.org Review URL: https://codereview.chromium.org/11146015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/blob/mock_blob_url_request_context.h')
-rw-r--r--webkit/blob/mock_blob_url_request_context.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/webkit/blob/mock_blob_url_request_context.h b/webkit/blob/mock_blob_url_request_context.h
new file mode 100644
index 0000000..9190db9
--- /dev/null
+++ b/webkit/blob/mock_blob_url_request_context.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_BLOB_MOCK_BLOB_URL_REQUEST_CONTEXT_H_
+#define WEBKIT_BLOB_MOCK_BLOB_URL_REQUEST_CONTEXT_H_
+
+#include "net/url_request/url_request_context.h"
+#include "net/url_request/url_request_job.h"
+#include "net/url_request/url_request_job_factory_impl.h"
+
+namespace webkit_blob {
+
+class BlobStorageController;
+
+class MockBlobURLRequestContext : public net::URLRequestContext {
+ public:
+ MockBlobURLRequestContext();
+ virtual ~MockBlobURLRequestContext();
+
+ BlobStorageController* blob_storage_controller() const {
+ return blob_storage_controller_.get();
+ }
+
+ private:
+ net::URLRequestJobFactoryImpl job_factory_;
+ scoped_ptr<BlobStorageController> blob_storage_controller_;
+
+ DISALLOW_COPY_AND_ASSIGN(MockBlobURLRequestContext);
+};
+
+class ScopedTextBlob {
+ public:
+ ScopedTextBlob(const MockBlobURLRequestContext& request_context,
+ const GURL& blob_url,
+ const std::string& data);
+ ~ScopedTextBlob();
+
+ private:
+ const GURL blob_url_;
+ BlobStorageController* blob_storage_controller_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedTextBlob);
+};
+
+} // namespace webkit_blob
+
+#endif // WEBKIT_BLOB_MOCK_BLOB_URL_REQUEST_CONTEXT_H_