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

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

Issue 10855209: Refactoring: ProtocolHandler::MaybeCreateJob takes NetworkDelegate as argument (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest merge Created 8 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) 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 #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/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 const char* FileWriterDelegateTest::content_ = NULL; 137 const char* FileWriterDelegateTest::content_ = NULL;
138 138
139 namespace { 139 namespace {
140 140
141 static std::string g_content; 141 static std::string g_content;
142 142
143 class FileWriterDelegateTestJob : public net::URLRequestJob { 143 class FileWriterDelegateTestJob : public net::URLRequestJob {
144 public: 144 public:
145 FileWriterDelegateTestJob(net::URLRequest* request, 145 FileWriterDelegateTestJob(net::URLRequest* request,
146 net::NetworkDelegate* network_delegate,
146 const std::string& content) 147 const std::string& content)
147 : net::URLRequestJob(request, request->context()->network_delegate()), 148 : net::URLRequestJob(request, network_delegate),
148 content_(content), 149 content_(content),
149 remaining_bytes_(content.length()), 150 remaining_bytes_(content.length()),
150 cursor_(0) { 151 cursor_(0) {
151 } 152 }
152 153
153 virtual void Start() OVERRIDE { 154 virtual void Start() OVERRIDE {
154 MessageLoop::current()->PostTask( 155 MessageLoop::current()->PostTask(
155 FROM_HERE, 156 FROM_HERE,
156 base::Bind(&FileWriterDelegateTestJob::NotifyHeadersComplete, this)); 157 base::Bind(&FileWriterDelegateTestJob::NotifyHeadersComplete, this));
157 } 158 }
(...skipping 24 matching lines...) Expand all
182 std::string content_; 183 std::string content_;
183 int remaining_bytes_; 184 int remaining_bytes_;
184 int cursor_; 185 int cursor_;
185 }; 186 };
186 187
187 } // namespace (anonymous) 188 } // namespace (anonymous)
188 189
189 // static 190 // static
190 net::URLRequestJob* FileWriterDelegateTest::Factory( 191 net::URLRequestJob* FileWriterDelegateTest::Factory(
191 net::URLRequest* request, 192 net::URLRequest* request,
193 net::NetworkDelegate* network_delegate,
192 const std::string& scheme) { 194 const std::string& scheme) {
193 return new FileWriterDelegateTestJob( 195 return new FileWriterDelegateTestJob(
194 request, FileWriterDelegateTest::content_); 196 request, network_delegate, FileWriterDelegateTest::content_);
195 } 197 }
196 198
197 void FileWriterDelegateTest::SetUp() { 199 void FileWriterDelegateTest::SetUp() {
198 ASSERT_TRUE(dir_.CreateUniqueTempDir()); 200 ASSERT_TRUE(dir_.CreateUniqueTempDir());
199 FilePath base_dir = dir_.path().AppendASCII("filesystem"); 201 FilePath base_dir = dir_.path().AppendASCII("filesystem");
200 test_helper_.SetUp(base_dir, NULL); 202 test_helper_.SetUp(base_dir, NULL);
201 203
202 scoped_ptr<FileSystemOperationContext> context( 204 scoped_ptr<FileSystemOperationContext> context(
203 test_helper_.NewOperationContext()); 205 test_helper_.NewOperationContext());
204 context->set_allowed_bytes_growth(kint64max); 206 context->set_allowed_bytes_growth(kint64max);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 file_writer_delegate_.reset(); 457 file_writer_delegate_.reset();
456 458
457 EXPECT_EQ(pre_write_usage + allowed_growth, 459 EXPECT_EQ(pre_write_usage + allowed_growth,
458 test_helper_.GetCachedOriginUsage()); 460 test_helper_.GetCachedOriginUsage());
459 EXPECT_EQ(ComputeCurrentOriginUsage(), test_helper_.GetCachedOriginUsage()); 461 EXPECT_EQ(ComputeCurrentOriginUsage(), test_helper_.GetCachedOriginUsage());
460 EXPECT_EQ(kOverlap + allowed_growth, result_->bytes_written()); 462 EXPECT_EQ(kOverlap + allowed_growth, result_->bytes_written());
461 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, result_->status()); 463 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, result_->status());
462 } 464 }
463 465
464 } // namespace fileapi 466 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_url_request_job_unittest.cc ('k') | webkit/fileapi/local_file_system_operation_write_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698