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

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

Issue 623933003: Replacing the OVERRIDE with override and FINAL with final in content/browser/fileapi (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 class BlobURLRequestJobFactory; 78 class BlobURLRequestJobFactory;
79 79
80 } // namespace (anonymous) 80 } // namespace (anonymous)
81 81
82 class FileWriterDelegateTest : public PlatformTest { 82 class FileWriterDelegateTest : public PlatformTest {
83 public: 83 public:
84 FileWriterDelegateTest() {} 84 FileWriterDelegateTest() {}
85 85
86 protected: 86 protected:
87 virtual void SetUp() OVERRIDE; 87 virtual void SetUp() override;
88 virtual void TearDown() OVERRIDE; 88 virtual void TearDown() override;
89 89
90 int64 usage() { 90 int64 usage() {
91 return file_system_context_->GetQuotaUtil(kFileSystemType) 91 return file_system_context_->GetQuotaUtil(kFileSystemType)
92 ->GetOriginUsageOnFileTaskRunner( 92 ->GetOriginUsageOnFileTaskRunner(
93 file_system_context_.get(), kOrigin, kFileSystemType); 93 file_system_context_.get(), kOrigin, kFileSystemType);
94 } 94 }
95 95
96 int64 GetFileSizeOnDisk(const char* test_file_path) { 96 int64 GetFileSizeOnDisk(const char* test_file_path) {
97 // There might be in-flight flush/write. 97 // There might be in-flight flush/write.
98 base::MessageLoop::current()->PostTask( 98 base::MessageLoop::current()->PostTask(
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 public: 168 public:
169 FileWriterDelegateTestJob(net::URLRequest* request, 169 FileWriterDelegateTestJob(net::URLRequest* request,
170 net::NetworkDelegate* network_delegate, 170 net::NetworkDelegate* network_delegate,
171 const std::string& content) 171 const std::string& content)
172 : net::URLRequestJob(request, network_delegate), 172 : net::URLRequestJob(request, network_delegate),
173 content_(content), 173 content_(content),
174 remaining_bytes_(content.length()), 174 remaining_bytes_(content.length()),
175 cursor_(0) { 175 cursor_(0) {
176 } 176 }
177 177
178 virtual void Start() OVERRIDE { 178 virtual void Start() override {
179 base::MessageLoop::current()->PostTask( 179 base::MessageLoop::current()->PostTask(
180 FROM_HERE, 180 FROM_HERE,
181 base::Bind(&FileWriterDelegateTestJob::NotifyHeadersComplete, this)); 181 base::Bind(&FileWriterDelegateTestJob::NotifyHeadersComplete, this));
182 } 182 }
183 183
184 virtual bool ReadRawData(net::IOBuffer* buf, 184 virtual bool ReadRawData(net::IOBuffer* buf,
185 int buf_size, 185 int buf_size,
186 int *bytes_read) OVERRIDE { 186 int *bytes_read) override {
187 if (remaining_bytes_ < buf_size) 187 if (remaining_bytes_ < buf_size)
188 buf_size = static_cast<int>(remaining_bytes_); 188 buf_size = static_cast<int>(remaining_bytes_);
189 189
190 for (int i = 0; i < buf_size; ++i) 190 for (int i = 0; i < buf_size; ++i)
191 buf->data()[i] = content_[cursor_++]; 191 buf->data()[i] = content_[cursor_++];
192 remaining_bytes_ -= buf_size; 192 remaining_bytes_ -= buf_size;
193 193
194 SetStatus(net::URLRequestStatus()); 194 SetStatus(net::URLRequestStatus());
195 *bytes_read = buf_size; 195 *bytes_read = buf_size;
196 return true; 196 return true;
197 } 197 }
198 198
199 virtual int GetResponseCode() const OVERRIDE { 199 virtual int GetResponseCode() const override {
200 return 200; 200 return 200;
201 } 201 }
202 202
203 protected: 203 protected:
204 virtual ~FileWriterDelegateTestJob() {} 204 virtual ~FileWriterDelegateTestJob() {}
205 205
206 private: 206 private:
207 std::string content_; 207 std::string content_;
208 int remaining_bytes_; 208 int remaining_bytes_;
209 int cursor_; 209 int cursor_;
210 }; 210 };
211 211
212 class BlobURLRequestJobFactory : public net::URLRequestJobFactory { 212 class BlobURLRequestJobFactory : public net::URLRequestJobFactory {
213 public: 213 public:
214 explicit BlobURLRequestJobFactory(const char** content_data) 214 explicit BlobURLRequestJobFactory(const char** content_data)
215 : content_data_(content_data) { 215 : content_data_(content_data) {
216 } 216 }
217 217
218 virtual net::URLRequestJob* MaybeCreateJobWithProtocolHandler( 218 virtual net::URLRequestJob* MaybeCreateJobWithProtocolHandler(
219 const std::string& scheme, 219 const std::string& scheme,
220 net::URLRequest* request, 220 net::URLRequest* request,
221 net::NetworkDelegate* network_delegate) const OVERRIDE { 221 net::NetworkDelegate* network_delegate) const override {
222 return new FileWriterDelegateTestJob( 222 return new FileWriterDelegateTestJob(
223 request, network_delegate, *content_data_); 223 request, network_delegate, *content_data_);
224 } 224 }
225 225
226 virtual bool IsHandledProtocol(const std::string& scheme) const OVERRIDE { 226 virtual bool IsHandledProtocol(const std::string& scheme) const override {
227 return scheme == "blob"; 227 return scheme == "blob";
228 } 228 }
229 229
230 virtual bool IsHandledURL(const GURL& url) const OVERRIDE { 230 virtual bool IsHandledURL(const GURL& url) const override {
231 return url.SchemeIs("blob"); 231 return url.SchemeIs("blob");
232 } 232 }
233 233
234 virtual bool IsSafeRedirectTarget(const GURL& location) const OVERRIDE { 234 virtual bool IsSafeRedirectTarget(const GURL& location) const override {
235 return true; 235 return true;
236 } 236 }
237 237
238 private: 238 private:
239 const char** content_data_; 239 const char** content_data_;
240 240
241 DISALLOW_COPY_AND_ASSIGN(BlobURLRequestJobFactory); 241 DISALLOW_COPY_AND_ASSIGN(BlobURLRequestJobFactory);
242 }; 242 };
243 243
244 } // namespace (anonymous) 244 } // namespace (anonymous)
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 file_writer_delegate_.reset(); 477 file_writer_delegate_.reset();
478 478
479 EXPECT_EQ(pre_write_usage + allowed_growth, usage()); 479 EXPECT_EQ(pre_write_usage + allowed_growth, usage());
480 EXPECT_EQ(GetFileSizeOnDisk("test"), usage()); 480 EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
481 EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written()); 481 EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written());
482 EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status()); 482 EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status());
483 } 483 }
484 } 484 }
485 485
486 } // namespace content 486 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/file_system_url_request_job_unittest.cc ('k') | content/browser/fileapi/fileapi_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698