OLD | NEW |
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 const char* FileWriterDelegateTest::content_ = NULL; | 141 const char* FileWriterDelegateTest::content_ = NULL; |
142 | 142 |
143 namespace { | 143 namespace { |
144 | 144 |
145 static std::string g_content; | 145 static std::string g_content; |
146 | 146 |
147 class FileWriterDelegateTestJob : public net::URLRequestJob { | 147 class FileWriterDelegateTestJob : public net::URLRequestJob { |
148 public: | 148 public: |
149 FileWriterDelegateTestJob(net::URLRequest* request, | 149 FileWriterDelegateTestJob(net::URLRequest* request, |
150 const std::string& content) | 150 const std::string& content) |
151 : net::URLRequestJob(request), | 151 : net::URLRequestJob(request, request->context()->network_delegate()), |
152 content_(content), | 152 content_(content), |
153 remaining_bytes_(content.length()), | 153 remaining_bytes_(content.length()), |
154 cursor_(0) { | 154 cursor_(0) { |
155 } | 155 } |
156 | 156 |
157 virtual void Start() OVERRIDE { | 157 virtual void Start() OVERRIDE { |
158 MessageLoop::current()->PostTask( | 158 MessageLoop::current()->PostTask( |
159 FROM_HERE, | 159 FROM_HERE, |
160 base::Bind(&FileWriterDelegateTestJob::NotifyHeadersComplete, this)); | 160 base::Bind(&FileWriterDelegateTestJob::NotifyHeadersComplete, this)); |
161 } | 161 } |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 file_writer_delegate_.reset(); | 459 file_writer_delegate_.reset(); |
460 | 460 |
461 EXPECT_EQ(pre_write_usage + allowed_growth, | 461 EXPECT_EQ(pre_write_usage + allowed_growth, |
462 test_helper_.GetCachedOriginUsage()); | 462 test_helper_.GetCachedOriginUsage()); |
463 EXPECT_EQ(ComputeCurrentOriginUsage(), test_helper_.GetCachedOriginUsage()); | 463 EXPECT_EQ(ComputeCurrentOriginUsage(), test_helper_.GetCachedOriginUsage()); |
464 EXPECT_EQ(kOverlap + allowed_growth, result_->bytes_written()); | 464 EXPECT_EQ(kOverlap + allowed_growth, result_->bytes_written()); |
465 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, result_->status()); | 465 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, result_->status()); |
466 } | 466 } |
467 | 467 |
468 } // namespace fileapi | 468 } // namespace fileapi |
OLD | NEW |