diff options
author | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-12 22:54:42 +0000 |
---|---|---|
committer | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-12 22:54:42 +0000 |
commit | 3e0c664682b788f3093e0528a772b51c72e95a1f (patch) | |
tree | 9164fad6eb703b815c7d32374a074ba9ea955a06 /webkit/fileapi/webfilewriter_base_unittest.cc | |
parent | cda3f562a282c8adab5adbb16a90ad9532b8d021 (diff) | |
download | chromium_src-3e0c664682b788f3093e0528a772b51c72e95a1f.zip chromium_src-3e0c664682b788f3093e0528a772b51c72e95a1f.tar.gz chromium_src-3e0c664682b788f3093e0528a772b51c72e95a1f.tar.bz2 |
More filesystem cleanup: convert URL-encoded-as-FilePath to actual URL, where
possible without WebKit API changes. The WebKit changes will happen in another
CL.
This is a resubmit of http://codereview.chromium.org/6767010/ [third try lucky,
fourth try persistent?], which bounced most recently due to bugs manifesting
only on XP. There are a few changes here that weren't there [in
file_system_operation_write_unittest.cc and file_system_operation.cc], but
they're pretty trivial build/test fixes.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6821065
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81319 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/webfilewriter_base_unittest.cc')
-rw-r--r-- | webkit/fileapi/webfilewriter_base_unittest.cc | 62 |
1 files changed, 27 insertions, 35 deletions
diff --git a/webkit/fileapi/webfilewriter_base_unittest.cc b/webkit/fileapi/webfilewriter_base_unittest.cc index 7a07cd2..43164e7 100644 --- a/webkit/fileapi/webfilewriter_base_unittest.cc +++ b/webkit/fileapi/webfilewriter_base_unittest.cc @@ -31,16 +31,8 @@ const int kMultiFileWrite_Offset = 3; const int kCancelFileWriteBeforeCompletion_Offset = 4; const int kCancelFileWriteAfterCompletion_Offset = 5; -std::string mock_path_as_ascii() { - return std::string("MockPath"); -} - -string16 mock_path_as_string16() { - return ASCIIToUTF16(mock_path_as_ascii()); -} - -FilePath mock_path_as_file_path() { - return FilePath().AppendASCII(mock_path_as_ascii()); +GURL mock_path_as_gurl() { + return GURL("MockPath"); } } // namespace @@ -48,32 +40,32 @@ FilePath mock_path_as_file_path() { class TestableFileWriter : public WebFileWriterBase { public: explicit TestableFileWriter(WebKit::WebFileWriterClient* client) - : WebFileWriterBase(mock_path_as_string16(), client) { + : WebFileWriterBase(mock_path_as_gurl(), client) { reset(); } void reset() { received_truncate_ = false; - received_truncate_path_ = FilePath(); + received_truncate_path_ = GURL(); received_truncate_offset_ = kNoOffset; received_write_ = false; - received_write_path_ = FilePath(); + received_write_path_ = GURL(); received_write_offset_ = kNoOffset; received_write_blob_url_ = GURL(); received_cancel_ = false; } bool received_truncate_; - FilePath received_truncate_path_; + GURL received_truncate_path_; int64 received_truncate_offset_; bool received_write_; - FilePath received_write_path_; + GURL received_write_path_; GURL received_write_blob_url_; int64 received_write_offset_; bool received_cancel_; protected: - virtual void DoTruncate(const FilePath& path, int64 offset) { + virtual void DoTruncate(const GURL& path, int64 offset) { received_truncate_ = true; received_truncate_path_ = path; received_truncate_offset_ = offset; @@ -95,7 +87,7 @@ class TestableFileWriter : public WebFileWriterBase { } } - virtual void DoWrite(const FilePath& path, const GURL& blob_url, + virtual void DoWrite(const GURL& path, const GURL& blob_url, int64 offset) { received_write_ = true; received_write_path_ = path; @@ -205,8 +197,8 @@ TEST_F(FileWriterTest, BasicFileWrite) { // Check that the derived class gets called correctly. EXPECT_TRUE(testable_writer_->received_write_); - EXPECT_EQ(testable_writer_->received_write_path_.value(), - mock_path_as_file_path().value()); + EXPECT_EQ(testable_writer_->received_write_path_, + mock_path_as_gurl()); EXPECT_EQ(kBasicFileWrite_Offset, testable_writer_->received_write_offset_); EXPECT_EQ(kBlobUrl, testable_writer_->received_write_blob_url_); @@ -227,8 +219,8 @@ TEST_F(FileWriterTest, BasicFileTruncate) { // Check that the derived class gets called correctly. EXPECT_TRUE(testable_writer_->received_truncate_); - EXPECT_EQ(mock_path_as_file_path().value(), - testable_writer_->received_truncate_path_.value()); + EXPECT_EQ(mock_path_as_gurl(), + testable_writer_->received_truncate_path_); EXPECT_EQ(kBasicFileTruncate_Offset, testable_writer_->received_truncate_offset_); EXPECT_FALSE(testable_writer_->received_write_); @@ -247,8 +239,8 @@ TEST_F(FileWriterTest, ErrorFileWrite) { // Check that the derived class gets called correctly. EXPECT_TRUE(testable_writer_->received_write_); - EXPECT_EQ(testable_writer_->received_write_path_.value(), - mock_path_as_file_path().value()); + EXPECT_EQ(testable_writer_->received_write_path_, + mock_path_as_gurl()); EXPECT_EQ(kErrorFileWrite_Offset, testable_writer_->received_write_offset_); EXPECT_EQ(kBlobUrl, testable_writer_->received_write_blob_url_); @@ -268,8 +260,8 @@ TEST_F(FileWriterTest, ErrorFileTruncate) { // Check that the derived class gets called correctly. EXPECT_TRUE(testable_writer_->received_truncate_); - EXPECT_EQ(mock_path_as_file_path().value(), - testable_writer_->received_truncate_path_.value()); + EXPECT_EQ(mock_path_as_gurl(), + testable_writer_->received_truncate_path_); EXPECT_EQ(kErrorFileTruncate_Offset, testable_writer_->received_truncate_offset_); EXPECT_FALSE(testable_writer_->received_write_); @@ -289,8 +281,8 @@ TEST_F(FileWriterTest, MultiFileWrite) { // Check that the derived class gets called correctly. EXPECT_TRUE(testable_writer_->received_write_); - EXPECT_EQ(testable_writer_->received_write_path_.value(), - mock_path_as_file_path().value()); + EXPECT_EQ(testable_writer_->received_write_path_, + mock_path_as_gurl()); EXPECT_EQ(kMultiFileWrite_Offset, testable_writer_->received_write_offset_); EXPECT_EQ(kBlobUrl, testable_writer_->received_write_blob_url_); @@ -312,8 +304,8 @@ TEST_F(FileWriterTest, CancelFileWriteBeforeCompletion) { // Check that the derived class gets called correctly. EXPECT_TRUE(testable_writer_->received_write_); - EXPECT_EQ(testable_writer_->received_write_path_.value(), - mock_path_as_file_path().value()); + EXPECT_EQ(testable_writer_->received_write_path_, + mock_path_as_gurl()); EXPECT_EQ(kCancelFileWriteBeforeCompletion_Offset, testable_writer_->received_write_offset_); EXPECT_EQ(kBlobUrl, testable_writer_->received_write_blob_url_); @@ -336,8 +328,8 @@ TEST_F(FileWriterTest, CancelFileWriteAfterCompletion) { // Check that the derived class gets called correctly. EXPECT_TRUE(testable_writer_->received_write_); - EXPECT_EQ(testable_writer_->received_write_path_.value(), - mock_path_as_file_path().value()); + EXPECT_EQ(testable_writer_->received_write_path_, + mock_path_as_gurl()); EXPECT_EQ(kCancelFileWriteAfterCompletion_Offset, testable_writer_->received_write_offset_); EXPECT_EQ(kBlobUrl, testable_writer_->received_write_blob_url_); @@ -359,8 +351,8 @@ TEST_F(FileWriterTest, CancelFileTruncate) { // Check that the derived class gets called correctly. EXPECT_TRUE(testable_writer_->received_truncate_); - EXPECT_EQ(mock_path_as_file_path().value(), - testable_writer_->received_truncate_path_.value()); + EXPECT_EQ(mock_path_as_gurl(), + testable_writer_->received_truncate_path_); EXPECT_EQ(kCancelFileTruncate_Offset, testable_writer_->received_truncate_offset_); EXPECT_TRUE(testable_writer_->received_cancel_); @@ -379,8 +371,8 @@ TEST_F(FileWriterTest, CancelFailedTruncate) { // Check that the derived class gets called correctly. EXPECT_TRUE(testable_writer_->received_truncate_); - EXPECT_EQ(mock_path_as_file_path().value(), - testable_writer_->received_truncate_path_.value()); + EXPECT_EQ(mock_path_as_gurl(), + testable_writer_->received_truncate_path_); EXPECT_EQ(kCancelFailedTruncate_Offset, testable_writer_->received_truncate_offset_); EXPECT_TRUE(testable_writer_->received_cancel_); |