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

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

Issue 7583053: Add MessageLoopProxy::current (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No need for MessageLoopProxy destruction observer. Created 9 years, 4 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/sandbox_mount_point_provider.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 file_ = base::CreatePlatformFile( 101 file_ = base::CreatePlatformFile(
102 file_path_, 102 file_path_,
103 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE | 103 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE |
104 base::PLATFORM_FILE_ASYNC, 104 base::PLATFORM_FILE_ASYNC,
105 &created, &error_code); 105 &created, &error_code);
106 ASSERT_EQ(base::PLATFORM_FILE_OK, error_code); 106 ASSERT_EQ(base::PLATFORM_FILE_OK, error_code);
107 107
108 result_.reset(new Result()); 108 result_.reset(new Result());
109 file_writer_delegate_.reset(new FileWriterDelegate( 109 file_writer_delegate_.reset(new FileWriterDelegate(
110 CreateNewOperation(result_.get(), allowed_growth), 110 CreateNewOperation(result_.get(), allowed_growth),
111 offset, base::MessageLoopProxy::CreateForCurrentThread())); 111 offset, base::MessageLoopProxy::current()));
112 request_.reset(new net::URLRequest(blob_url, file_writer_delegate_.get())); 112 request_.reset(new net::URLRequest(blob_url, file_writer_delegate_.get()));
113 } 113 }
114 114
115 FileSystemOperation* CreateNewOperation(Result* result, int64 quota); 115 FileSystemOperation* CreateNewOperation(Result* result, int64 quota);
116 116
117 static net::URLRequest::ProtocolFactory Factory; 117 static net::URLRequest::ProtocolFactory Factory;
118 118
119 scoped_ptr<QuotaFileUtil> quota_file_util_; 119 scoped_ptr<QuotaFileUtil> quota_file_util_;
120 scoped_ptr<FileWriterDelegate> file_writer_delegate_; 120 scoped_ptr<FileWriterDelegate> file_writer_delegate_;
121 scoped_ptr<net::URLRequest> request_; 121 scoped_ptr<net::URLRequest> request_;
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 const GURL kBlobURL("blob:nolimitconcurrent"); 352 const GURL kBlobURL("blob:nolimitconcurrent");
353 const GURL kBlobURL2("blob:nolimitconcurrent2"); 353 const GURL kBlobURL2("blob:nolimitconcurrent2");
354 content_ = kData; 354 content_ = kData;
355 355
356 PrepareForWrite(kBlobURL, 0, QuotaFileUtil::kNoLimit); 356 PrepareForWrite(kBlobURL, 0, QuotaFileUtil::kNoLimit);
357 357
358 // Credate another FileWriterDelegate for concurrent write. 358 // Credate another FileWriterDelegate for concurrent write.
359 result2.reset(new Result()); 359 result2.reset(new Result());
360 file_writer_delegate2.reset(new FileWriterDelegate( 360 file_writer_delegate2.reset(new FileWriterDelegate(
361 CreateNewOperation(result2.get(), QuotaFileUtil::kNoLimit), 361 CreateNewOperation(result2.get(), QuotaFileUtil::kNoLimit),
362 0, base::MessageLoopProxy::CreateForCurrentThread())); 362 0, base::MessageLoopProxy::current()));
363 request2.reset(new net::URLRequest(kBlobURL2, file_writer_delegate2.get())); 363 request2.reset(new net::URLRequest(kBlobURL2, file_writer_delegate2.get()));
364 364
365 ASSERT_EQ(FileSystemUsageCache::kUsageFileSize, 365 ASSERT_EQ(FileSystemUsageCache::kUsageFileSize,
366 test_helper_.GetCachedOriginUsage()); 366 test_helper_.GetCachedOriginUsage());
367 file_writer_delegate_->Start(file_, request_.get()); 367 file_writer_delegate_->Start(file_, request_.get());
368 file_writer_delegate2->Start(file2, request2.get()); 368 file_writer_delegate2->Start(file2, request2.get());
369 MessageLoop::current()->Run(); 369 MessageLoop::current()->Run();
370 if (!result_->complete() || !result2->complete()) 370 if (!result_->complete() || !result2->complete())
371 MessageLoop::current()->Run(); 371 MessageLoop::current()->Run();
372 372
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 EXPECT_EQ(kDataSize + FileSystemUsageCache::kUsageFileSize, 504 EXPECT_EQ(kDataSize + FileSystemUsageCache::kUsageFileSize,
505 test_helper_.GetCachedOriginUsage()); 505 test_helper_.GetCachedOriginUsage());
506 EXPECT_EQ(ComputeCurrentOriginUsage() + FileSystemUsageCache::kUsageFileSize, 506 EXPECT_EQ(ComputeCurrentOriginUsage() + FileSystemUsageCache::kUsageFileSize,
507 test_helper_.GetCachedOriginUsage()); 507 test_helper_.GetCachedOriginUsage());
508 EXPECT_EQ(kDataSize, result_->bytes_written()); 508 EXPECT_EQ(kDataSize, result_->bytes_written());
509 EXPECT_EQ(base::PLATFORM_FILE_OK, result_->status()); 509 EXPECT_EQ(base::PLATFORM_FILE_OK, result_->status());
510 EXPECT_TRUE(result_->complete()); 510 EXPECT_TRUE(result_->complete());
511 } 511 }
512 512
513 } // namespace fileapi 513 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_writer_delegate.cc ('k') | webkit/fileapi/sandbox_mount_point_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698