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

Unified Diff: content/child/fileapi/webfilewriter_base_unittest.cc

Issue 23223003: Chromium Blob hacking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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/child/fileapi/webfilewriter_base.cc ('k') | content/child/fileapi/webfilewriter_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/fileapi/webfilewriter_base_unittest.cc
diff --git a/content/child/fileapi/webfilewriter_base_unittest.cc b/content/child/fileapi/webfilewriter_base_unittest.cc
index 76fd974c7a280556a193d3d5430665325d3cf496..329665a189b31cc7b839a532c65b5d55cec80a61 100644
--- a/content/child/fileapi/webfilewriter_base_unittest.cc
+++ b/content/child/fileapi/webfilewriter_base_unittest.cc
@@ -52,6 +52,7 @@ class TestableFileWriter : public WebFileWriterBase {
received_write_path_ = GURL();
received_write_offset_ = kNoOffset;
received_write_blob_url_ = GURL();
+ received_write_blob_uuid_ = std::string();
received_cancel_ = false;
}
@@ -61,6 +62,7 @@ class TestableFileWriter : public WebFileWriterBase {
bool received_write_;
GURL received_write_path_;
GURL received_write_blob_url_;
+ std::string received_write_blob_uuid_;
int64 received_write_offset_;
bool received_cancel_;
@@ -87,8 +89,9 @@ class TestableFileWriter : public WebFileWriterBase {
}
}
- virtual void DoWrite(const GURL& path, const GURL& blob_url,
- int64 offset) OVERRIDE {
+ virtual void DoWriteDeprecated(
+ const GURL& path, const GURL& blob_url,
+ int64 offset) OVERRIDE {
received_write_ = true;
received_write_path_ = path;
received_write_offset_ = offset;
@@ -121,6 +124,41 @@ class TestableFileWriter : public WebFileWriterBase {
}
}
+ virtual void DoWrite(
+ const GURL& path, const std::string& blob_uuid,
+ int64 offset) OVERRIDE {
+ received_write_ = true;
+ received_write_path_ = path;
+ received_write_offset_ = offset;
+ received_write_blob_uuid_ = blob_uuid;
+
+ if (offset == kBasicFileWrite_Offset) {
+ DidWrite(1, true);
+ } else if (offset == kErrorFileWrite_Offset) {
+ DidFail(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ } else if (offset == kMultiFileWrite_Offset) {
+ DidWrite(1, false);
+ DidWrite(1, false);
+ DidWrite(1, true);
+ } else if (offset == kCancelFileWriteBeforeCompletion_Offset) {
+ DidWrite(1, false);
+ cancel();
+ DidWrite(1, false);
+ DidWrite(1, false);
+ DidFail(base::PLATFORM_FILE_ERROR_FAILED); // write completion
+ DidSucceed(); // cancel completion
+ } else if (offset == kCancelFileWriteAfterCompletion_Offset) {
+ DidWrite(1, false);
+ cancel();
+ DidWrite(1, false);
+ DidWrite(1, false);
+ DidWrite(1, true); // write completion
+ DidFail(base::PLATFORM_FILE_ERROR_FAILED); // cancel completion
+ } else {
+ FAIL();
+ }
+ }
+
virtual void DoCancel() OVERRIDE {
received_cancel_ = true;
}
@@ -190,6 +228,9 @@ class FileWriterTest : public testing::Test,
DISALLOW_COPY_AND_ASSIGN(FileWriterTest);
};
+
+// TODO(michaeln): crbug/174200, update the tests once blink is migrated.
+
TEST_F(FileWriterTest, BasicFileWrite) {
// Call the webkit facing api.
const GURL kBlobUrl("blob://bloburl/");
« no previous file with comments | « content/child/fileapi/webfilewriter_base.cc ('k') | content/child/fileapi/webfilewriter_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698