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

Side by Side Diff: content/browser/fileapi/file_writer_delegate_unittest.cc

Issue 1003953008: Remove prerender cookie store, part 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prerender-revert-cookie-store-3
Patch Set: rebase (just in case since this is so huge) Created 5 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 // Creates and sets up a FileWriterDelegate for writing the given |blob_url|, 135 // Creates and sets up a FileWriterDelegate for writing the given |blob_url|,
136 // and creates a new FileWriterDelegate for the file. 136 // and creates a new FileWriterDelegate for the file.
137 void PrepareForWrite(const char* test_file_path, 137 void PrepareForWrite(const char* test_file_path,
138 const GURL& blob_url, 138 const GURL& blob_url,
139 int64 offset, 139 int64 offset,
140 int64 allowed_growth) { 140 int64 allowed_growth) {
141 file_writer_delegate_.reset( 141 file_writer_delegate_.reset(
142 CreateWriterDelegate(test_file_path, offset, allowed_growth)); 142 CreateWriterDelegate(test_file_path, offset, allowed_growth));
143 request_ = empty_context_.CreateRequest( 143 request_ = empty_context_.CreateRequest(
144 blob_url, net::DEFAULT_PRIORITY, file_writer_delegate_.get(), NULL); 144 blob_url, net::DEFAULT_PRIORITY, file_writer_delegate_.get());
145 } 145 }
146 146
147 // This should be alive until the very end of this instance. 147 // This should be alive until the very end of this instance.
148 base::MessageLoopForIO loop_; 148 base::MessageLoopForIO loop_;
149 149
150 scoped_refptr<storage::FileSystemContext> file_system_context_; 150 scoped_refptr<storage::FileSystemContext> file_system_context_;
151 151
152 net::URLRequestContext empty_context_; 152 net::URLRequestContext empty_context_;
153 scoped_ptr<FileWriterDelegate> file_writer_delegate_; 153 scoped_ptr<FileWriterDelegate> file_writer_delegate_;
154 scoped_ptr<net::URLRequest> request_; 154 scoped_ptr<net::URLRequest> request_;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 362
363 const GURL kBlobURL("blob:nolimitconcurrent"); 363 const GURL kBlobURL("blob:nolimitconcurrent");
364 const GURL kBlobURL2("blob:nolimitconcurrent2"); 364 const GURL kBlobURL2("blob:nolimitconcurrent2");
365 content_ = kData; 365 content_ = kData;
366 366
367 PrepareForWrite("test", kBlobURL, 0, kint64max); 367 PrepareForWrite("test", kBlobURL, 0, kint64max);
368 368
369 // Credate another FileWriterDelegate for concurrent write. 369 // Credate another FileWriterDelegate for concurrent write.
370 file_writer_delegate2.reset(CreateWriterDelegate("test2", 0, kint64max)); 370 file_writer_delegate2.reset(CreateWriterDelegate("test2", 0, kint64max));
371 request2 = empty_context_.CreateRequest( 371 request2 = empty_context_.CreateRequest(
372 kBlobURL2, net::DEFAULT_PRIORITY, file_writer_delegate2.get(), NULL); 372 kBlobURL2, net::DEFAULT_PRIORITY, file_writer_delegate2.get());
373 373
374 Result result, result2; 374 Result result, result2;
375 ASSERT_EQ(0, usage()); 375 ASSERT_EQ(0, usage());
376 file_writer_delegate_->Start(request_.Pass(), GetWriteCallback(&result)); 376 file_writer_delegate_->Start(request_.Pass(), GetWriteCallback(&result));
377 file_writer_delegate2->Start(request2.Pass(), GetWriteCallback(&result2)); 377 file_writer_delegate2->Start(request2.Pass(), GetWriteCallback(&result2));
378 base::MessageLoop::current()->Run(); 378 base::MessageLoop::current()->Run();
379 if (result.write_status() == FileWriterDelegate::SUCCESS_IO_PENDING || 379 if (result.write_status() == FileWriterDelegate::SUCCESS_IO_PENDING ||
380 result2.write_status() == FileWriterDelegate::SUCCESS_IO_PENDING) 380 result2.write_status() == FileWriterDelegate::SUCCESS_IO_PENDING)
381 base::MessageLoop::current()->Run(); 381 base::MessageLoop::current()->Run();
382 382
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 file_writer_delegate_.reset(); 487 file_writer_delegate_.reset();
488 488
489 EXPECT_EQ(pre_write_usage + allowed_growth, usage()); 489 EXPECT_EQ(pre_write_usage + allowed_growth, usage());
490 EXPECT_EQ(GetFileSizeOnDisk("test"), usage()); 490 EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
491 EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written()); 491 EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written());
492 EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status()); 492 EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status());
493 } 493 }
494 } 494 }
495 495
496 } // namespace content 496 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698