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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 const std::string& content) | 146 const std::string& content) |
147 : net::URLRequestJob(request), | 147 : net::URLRequestJob(request, request->context()->network_delegate()), |
148 content_(content), | 148 content_(content), |
149 remaining_bytes_(content.length()), | 149 remaining_bytes_(content.length()), |
150 cursor_(0) { | 150 cursor_(0) { |
151 } | 151 } |
152 | 152 |
153 virtual void Start() OVERRIDE { | 153 virtual void Start() OVERRIDE { |
154 MessageLoop::current()->PostTask( | 154 MessageLoop::current()->PostTask( |
155 FROM_HERE, | 155 FROM_HERE, |
156 base::Bind(&FileWriterDelegateTestJob::NotifyHeadersComplete, this)); | 156 base::Bind(&FileWriterDelegateTestJob::NotifyHeadersComplete, this)); |
157 } | 157 } |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 file_writer_delegate_.reset(); | 455 file_writer_delegate_.reset(); |
456 | 456 |
457 EXPECT_EQ(pre_write_usage + allowed_growth, | 457 EXPECT_EQ(pre_write_usage + allowed_growth, |
458 test_helper_.GetCachedOriginUsage()); | 458 test_helper_.GetCachedOriginUsage()); |
459 EXPECT_EQ(ComputeCurrentOriginUsage(), test_helper_.GetCachedOriginUsage()); | 459 EXPECT_EQ(ComputeCurrentOriginUsage(), test_helper_.GetCachedOriginUsage()); |
460 EXPECT_EQ(kOverlap + allowed_growth, result_->bytes_written()); | 460 EXPECT_EQ(kOverlap + allowed_growth, result_->bytes_written()); |
461 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, result_->status()); | 461 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, result_->status()); |
462 } | 462 } |
463 | 463 |
464 } // namespace fileapi | 464 } // namespace fileapi |
OLD | NEW |