| 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 "net/http/mock_http_cache.h" | 5 #include "net/http/mock_http_cache.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 } | 542 } |
| 543 | 543 |
| 544 MockDiskCache* MockHttpCache::disk_cache() { | 544 MockDiskCache* MockHttpCache::disk_cache() { |
| 545 return static_cast<MockDiskCache*>(backend()); | 545 return static_cast<MockDiskCache*>(backend()); |
| 546 } | 546 } |
| 547 | 547 |
| 548 int MockHttpCache::CreateTransaction(scoped_ptr<HttpTransaction>* trans) { | 548 int MockHttpCache::CreateTransaction(scoped_ptr<HttpTransaction>* trans) { |
| 549 return http_cache_.CreateTransaction(DEFAULT_PRIORITY, trans); | 549 return http_cache_.CreateTransaction(DEFAULT_PRIORITY, trans); |
| 550 } | 550 } |
| 551 | 551 |
| 552 void MockHttpCache::BypassCacheLock() { | |
| 553 http_cache_.BypassLockForTest(); | |
| 554 } | |
| 555 | |
| 556 void MockHttpCache::FailConditionalizations() { | 552 void MockHttpCache::FailConditionalizations() { |
| 557 http_cache_.FailConditionalizationForTest(); | 553 http_cache_.FailConditionalizationForTest(); |
| 558 } | 554 } |
| 559 | 555 |
| 560 bool MockHttpCache::ReadResponseInfo(disk_cache::Entry* disk_entry, | 556 bool MockHttpCache::ReadResponseInfo(disk_cache::Entry* disk_entry, |
| 561 HttpResponseInfo* response_info, | 557 HttpResponseInfo* response_info, |
| 562 bool* response_truncated) { | 558 bool* response_truncated) { |
| 563 int size = disk_entry->GetDataSize(0); | 559 int size = disk_entry->GetDataSize(0); |
| 564 | 560 |
| 565 TestCompletionCallback cb; | 561 TestCompletionCallback cb; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 if (!callback_.is_null()) { | 663 if (!callback_.is_null()) { |
| 668 if (!fail_) | 664 if (!fail_) |
| 669 backend_->reset(new MockDiskCache()); | 665 backend_->reset(new MockDiskCache()); |
| 670 CompletionCallback cb = callback_; | 666 CompletionCallback cb = callback_; |
| 671 callback_.Reset(); | 667 callback_.Reset(); |
| 672 cb.Run(Result()); // This object can be deleted here. | 668 cb.Run(Result()); // This object can be deleted here. |
| 673 } | 669 } |
| 674 } | 670 } |
| 675 | 671 |
| 676 } // namespace net | 672 } // namespace net |
| OLD | NEW |