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

Side by Side Diff: webkit/fileapi/file_system_operation_write_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
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 24 matching lines...) Expand all
35 using quota::QuotaManager; 35 using quota::QuotaManager;
36 36
37 namespace fileapi { 37 namespace fileapi {
38 38
39 namespace { 39 namespace {
40 40
41 class MockQuotaManager : public QuotaManager { 41 class MockQuotaManager : public QuotaManager {
42 public: 42 public:
43 MockQuotaManager(const FilePath& base_dir, int64 quota) 43 MockQuotaManager(const FilePath& base_dir, int64 quota)
44 : QuotaManager(false /* is_incognito */, base_dir, 44 : QuotaManager(false /* is_incognito */, base_dir,
45 base::MessageLoopProxy::CreateForCurrentThread(), 45 base::MessageLoopProxy::current(),
46 base::MessageLoopProxy::CreateForCurrentThread(), 46 base::MessageLoopProxy::current(),
47 NULL /* special_storage_policy */), 47 NULL /* special_storage_policy */),
48 usage_(0), 48 usage_(0),
49 quota_(quota) {} 49 quota_(quota) {}
50 50
51 virtual void GetUsageAndQuota(const GURL& origin, quota::StorageType type, 51 virtual void GetUsageAndQuota(const GURL& origin, quota::StorageType type,
52 GetUsageAndQuotaCallback* callback) { 52 GetUsageAndQuotaCallback* callback) {
53 callback->Run(quota::kQuotaStatusOk, usage_, quota_); 53 callback->Run(quota::kQuotaStatusOk, usage_, quota_);
54 delete callback; 54 delete callback;
55 } 55 }
56 56
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 }; 137 };
138 138
139 static net::URLRequestJob* BlobURLRequestJobFactory(net::URLRequest* request, 139 static net::URLRequestJob* BlobURLRequestJobFactory(net::URLRequest* request,
140 const std::string& scheme) { 140 const std::string& scheme) {
141 webkit_blob::BlobStorageController* blob_storage_controller = 141 webkit_blob::BlobStorageController* blob_storage_controller =
142 static_cast<const TestURLRequestContext*>(request->context())-> 142 static_cast<const TestURLRequestContext*>(request->context())->
143 blob_storage_controller(); 143 blob_storage_controller();
144 return new webkit_blob::BlobURLRequestJob( 144 return new webkit_blob::BlobURLRequestJob(
145 request, 145 request,
146 blob_storage_controller->GetBlobDataFromUrl(request->url()), 146 blob_storage_controller->GetBlobDataFromUrl(request->url()),
147 base::MessageLoopProxy::CreateForCurrentThread()); 147 base::MessageLoopProxy::current());
148 } 148 }
149 149
150 class MockDispatcher : public FileSystemCallbackDispatcher { 150 class MockDispatcher : public FileSystemCallbackDispatcher {
151 public: 151 public:
152 MockDispatcher(FileSystemOperationWriteTest* test) : test_(test) { } 152 MockDispatcher(FileSystemOperationWriteTest* test) : test_(test) { }
153 153
154 virtual void DidFail(base::PlatformFileError status) { 154 virtual void DidFail(base::PlatformFileError status) {
155 test_->set_failure_status(status); 155 test_->set_failure_status(status);
156 MessageLoop::current()->Quit(); 156 MessageLoop::current()->Quit();
157 } 157 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 url_request_context->blob_storage_controller()->UnregisterBlobUrl(blob_url); 339 url_request_context->blob_storage_controller()->UnregisterBlobUrl(blob_url);
340 340
341 EXPECT_EQ(10, bytes_written()); 341 EXPECT_EQ(10, bytes_written());
342 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status()); 342 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status());
343 EXPECT_TRUE(complete()); 343 EXPECT_TRUE(complete());
344 } 344 }
345 345
346 // TODO(ericu,dmikurube): Add tests for Cancel. 346 // TODO(ericu,dmikurube): Add tests for Cancel.
347 347
348 } // namespace fileapi 348 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_operation_unittest.cc ('k') | webkit/fileapi/file_system_path_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698