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

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

Issue 2822593003: Remove URLRequestJob::GetResponseCode implementations (Closed)
Patch Set: Fix Created 3 years, 8 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 <stdint.h> 5 #include <stdint.h>
6 #include <limits> 6 #include <limits>
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/files/scoped_temp_dir.h" 13 #include "base/files/scoped_temp_dir.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/run_loop.h" 17 #include "base/run_loop.h"
18 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
19 #include "base/threading/thread_task_runner_handle.h" 19 #include "base/threading/thread_task_runner_handle.h"
20 #include "net/base/io_buffer.h" 20 #include "net/base/io_buffer.h"
21 #include "net/base/request_priority.h" 21 #include "net/base/request_priority.h"
22 #include "net/http/http_response_headers.h"
22 #include "net/url_request/url_request.h" 23 #include "net/url_request/url_request.h"
23 #include "net/url_request/url_request_context.h" 24 #include "net/url_request/url_request_context.h"
24 #include "net/url_request/url_request_job.h" 25 #include "net/url_request/url_request_job.h"
25 #include "net/url_request/url_request_job_factory.h" 26 #include "net/url_request/url_request_job_factory.h"
26 #include "net/url_request/url_request_status.h" 27 #include "net/url_request/url_request_status.h"
27 #include "storage/browser/fileapi/file_system_context.h" 28 #include "storage/browser/fileapi/file_system_context.h"
28 #include "storage/browser/fileapi/file_system_quota_util.h" 29 #include "storage/browser/fileapi/file_system_quota_util.h"
29 #include "storage/browser/fileapi/file_writer_delegate.h" 30 #include "storage/browser/fileapi/file_writer_delegate.h"
30 #include "storage/browser/fileapi/sandbox_file_stream_writer.h" 31 #include "storage/browser/fileapi/sandbox_file_stream_writer.h"
31 #include "storage/browser/test/async_file_test_helper.h" 32 #include "storage/browser/test/async_file_test_helper.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 196
196 for (int i = 0; i < buf_size; ++i) 197 for (int i = 0; i < buf_size; ++i)
197 buf->data()[i] = content_[cursor_++]; 198 buf->data()[i] = content_[cursor_++];
198 remaining_bytes_ -= buf_size; 199 remaining_bytes_ -= buf_size;
199 200
200 return buf_size; 201 return buf_size;
201 } 202 }
202 203
203 int GetResponseCode() const override { return 200; } 204 int GetResponseCode() const override { return 200; }
204 205
206 void GetResponseInfo(net::HttpResponseInfo* info) override {
207 const char kStatus[] = "HTTP/1.1 200 OK\0";
208 const size_t kStatusLen = arraysize(kStatus);
209
210 info->headers =
211 new net::HttpResponseHeaders(std::string(kStatus, kStatusLen));
212 }
213
205 protected: 214 protected:
206 ~FileWriterDelegateTestJob() override {} 215 ~FileWriterDelegateTestJob() override {}
207 216
208 private: 217 private:
209 std::string content_; 218 std::string content_;
210 int remaining_bytes_; 219 int remaining_bytes_;
211 int cursor_; 220 int cursor_;
212 221
213 base::WeakPtrFactory<FileWriterDelegateTestJob> weak_factory_; 222 base::WeakPtrFactory<FileWriterDelegateTestJob> weak_factory_;
214 }; 223 };
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 file_writer_delegate_.reset(); 505 file_writer_delegate_.reset();
497 506
498 EXPECT_EQ(pre_write_usage + allowed_growth, usage()); 507 EXPECT_EQ(pre_write_usage + allowed_growth, usage());
499 EXPECT_EQ(GetFileSizeOnDisk("test"), usage()); 508 EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
500 EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written()); 509 EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written());
501 EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status()); 510 EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status());
502 } 511 }
503 } 512 }
504 513
505 } // namespace content 514 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698