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

Side by Side Diff: webkit/fileapi/file_writer_delegate_unittest.cc

Issue 10197007: Change webkit/{fileapi,quota} code to use TaskRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test fix Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/fileapi/file_writer_delegate.cc ('k') | webkit/fileapi/isolated_mount_point_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit) 5 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit)
6 // rather than as part of test_shell_tests because they rely on being able 6 // rather than as part of test_shell_tests because they rely on being able
7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses 7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses
8 // TYPE_UI, which URLRequest doesn't allow. 8 // TYPE_UI, which URLRequest doesn't allow.
9 // 9 //
10 10
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 file_path_, 108 file_path_,
109 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE | 109 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE |
110 base::PLATFORM_FILE_ASYNC, 110 base::PLATFORM_FILE_ASYNC,
111 &created, &error_code); 111 &created, &error_code);
112 ASSERT_EQ(base::PLATFORM_FILE_OK, error_code); 112 ASSERT_EQ(base::PLATFORM_FILE_OK, error_code);
113 113
114 result_.reset(new Result()); 114 result_.reset(new Result());
115 file_writer_delegate_.reset(new FileWriterDelegate( 115 file_writer_delegate_.reset(new FileWriterDelegate(
116 CreateNewOperation(result_.get(), allowed_growth), 116 CreateNewOperation(result_.get(), allowed_growth),
117 test_helper_.CreatePath(file_path_), 117 test_helper_.CreatePath(file_path_),
118 offset, base::MessageLoopProxy::current())); 118 offset));
119 request_.reset(new net::URLRequest(blob_url, file_writer_delegate_.get())); 119 request_.reset(new net::URLRequest(blob_url, file_writer_delegate_.get()));
120 } 120 }
121 121
122 FileSystemOperation* CreateNewOperation(Result* result, int64 quota); 122 FileSystemOperation* CreateNewOperation(Result* result, int64 quota);
123 123
124 static net::URLRequest::ProtocolFactory Factory; 124 static net::URLRequest::ProtocolFactory Factory;
125 125
126 scoped_ptr<QuotaFileUtil> quota_file_util_; 126 scoped_ptr<QuotaFileUtil> quota_file_util_;
127 scoped_ptr<FileWriterDelegate> file_writer_delegate_; 127 scoped_ptr<FileWriterDelegate> file_writer_delegate_;
128 scoped_ptr<net::URLRequest> request_; 128 scoped_ptr<net::URLRequest> request_;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 const GURL kBlobURL("blob:nolimitconcurrent"); 319 const GURL kBlobURL("blob:nolimitconcurrent");
320 const GURL kBlobURL2("blob:nolimitconcurrent2"); 320 const GURL kBlobURL2("blob:nolimitconcurrent2");
321 content_ = kData; 321 content_ = kData;
322 322
323 PrepareForWrite(kBlobURL, 0, QuotaFileUtil::kNoLimit); 323 PrepareForWrite(kBlobURL, 0, QuotaFileUtil::kNoLimit);
324 324
325 // Credate another FileWriterDelegate for concurrent write. 325 // Credate another FileWriterDelegate for concurrent write.
326 result2.reset(new Result()); 326 result2.reset(new Result());
327 file_writer_delegate2.reset(new FileWriterDelegate( 327 file_writer_delegate2.reset(new FileWriterDelegate(
328 CreateNewOperation(result2.get(), QuotaFileUtil::kNoLimit), 328 CreateNewOperation(result2.get(), QuotaFileUtil::kNoLimit),
329 test_helper_.CreatePath(file_path2), 329 test_helper_.CreatePath(file_path2), 0));
330 0, base::MessageLoopProxy::current()));
331 request2.reset(new net::URLRequest(kBlobURL2, file_writer_delegate2.get())); 330 request2.reset(new net::URLRequest(kBlobURL2, file_writer_delegate2.get()));
332 331
333 ASSERT_EQ(0, test_helper_.GetCachedOriginUsage()); 332 ASSERT_EQ(0, test_helper_.GetCachedOriginUsage());
334 file_writer_delegate_->Start(file_, request_.get()); 333 file_writer_delegate_->Start(file_, request_.get());
335 file_writer_delegate2->Start(file2, request2.get()); 334 file_writer_delegate2->Start(file2, request2.get());
336 MessageLoop::current()->Run(); 335 MessageLoop::current()->Run();
337 if (!result_->complete() || !result2->complete()) 336 if (!result_->complete() || !result2->complete())
338 MessageLoop::current()->Run(); 337 MessageLoop::current()->Run();
339 338
340 ASSERT_EQ(kDataSize * 2, test_helper_.GetCachedOriginUsage()); 339 ASSERT_EQ(kDataSize * 2, test_helper_.GetCachedOriginUsage());
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, result_->status()); 428 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, result_->status());
430 EXPECT_TRUE(result_->complete()); 429 EXPECT_TRUE(result_->complete());
431 } 430 }
432 431
433 class FileWriterDelegateUnlimitedTest : public FileWriterDelegateTest { 432 class FileWriterDelegateUnlimitedTest : public FileWriterDelegateTest {
434 protected: 433 protected:
435 virtual void SetUpTestHelper(const FilePath& path) OVERRIDE; 434 virtual void SetUpTestHelper(const FilePath& path) OVERRIDE;
436 }; 435 };
437 436
438 } // namespace fileapi 437 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_writer_delegate.cc ('k') | webkit/fileapi/isolated_mount_point_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698