Chromium Code Reviews| 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 92150813dfa8d2c7cb13bd65fc0b46c701a658ea..0a4b827c2ded9188fbb5179728ddc4784b69598e 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): update the tests to once webkit api is updated. |
|
ericu
2013/08/21 23:26:09
to what?
michaeln
2013/08/27 23:24:06
added a link to the bug
ericu
2013/08/28 22:01:28
Still "update the tests to"...to what?
Oh, do you
michaeln
2013/08/28 22:54:47
Yes, i meant "too" (or just botched the sentence).
|
| + |
| TEST_F(FileWriterTest, BasicFileWrite) { |
| // Call the webkit facing api. |
| const GURL kBlobUrl("blob://bloburl/"); |