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

Side by Side Diff: net/http/http_cache_transaction.cc

Issue 1346793002: HTTP cache: Add tests to improve coverage of AddTruncatedFlag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | net/http/http_cache_unittest.cc » ('j') | net/http/http_cache_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/http_cache_transaction.h" 5 #include "net/http/http_cache_transaction.h"
6 6
7 #include "build/build_config.h" // For OS_POSIX 7 #include "build/build_config.h" // For OS_POSIX
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 if (!cache_.get()) 1868 if (!cache_.get())
1869 return ERR_UNEXPECTED; 1869 return ERR_UNEXPECTED;
1870 1870
1871 if (result != write_len_) { 1871 if (result != write_len_) {
1872 DLOG(ERROR) << "failed to write response data to cache"; 1872 DLOG(ERROR) << "failed to write response data to cache";
1873 DoneWritingToEntry(false); 1873 DoneWritingToEntry(false);
1874 1874
1875 // We want to ignore errors writing to disk and just keep reading from 1875 // We want to ignore errors writing to disk and just keep reading from
1876 // the network. 1876 // the network.
1877 result = write_len_; 1877 result = write_len_;
1878 } else if (!done_reading_ && entry_) { 1878 } else if (!done_reading_ && entry_ && (!partial_ || truncated_)) {
asanka 2015/09/17 14:43:34 I'll note that this change doesn't affect the newl
rvargas (doing something else) 2015/09/17 20:18:37 These tests are actually a regression test for htt
1879 int current_size = entry_->disk_entry->GetDataSize(kResponseContentIndex); 1879 int current_size = entry_->disk_entry->GetDataSize(kResponseContentIndex);
1880 int64 body_size = response_.headers->GetContentLength(); 1880 int64 body_size = response_.headers->GetContentLength();
1881 if (body_size >= 0 && body_size <= current_size) 1881 if (body_size >= 0 && body_size <= current_size)
1882 done_reading_ = true; 1882 done_reading_ = true;
1883 } 1883 }
1884 1884
1885 if (partial_) { 1885 if (partial_) {
1886 // This may be the last request. 1886 // This may be the last request.
1887 if (result != 0 || truncated_ || 1887 if (result != 0 || truncated_ ||
1888 !(partial_->IsLastRange() || mode_ == WRITE)) { 1888 !(partial_->IsLastRange() || mode_ == WRITE)) {
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after
2934 default: 2934 default:
2935 NOTREACHED(); 2935 NOTREACHED();
2936 } 2936 }
2937 } 2937 }
2938 2938
2939 void HttpCache::Transaction::OnIOComplete(int result) { 2939 void HttpCache::Transaction::OnIOComplete(int result) {
2940 DoLoop(result); 2940 DoLoop(result);
2941 } 2941 }
2942 2942
2943 } // namespace net 2943 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_cache_unittest.cc » ('j') | net/http/http_cache_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698