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

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

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « net/http/http_cache_transaction.cc ('k') | net/http/http_network_session.h » ('j') | no next file with comments »
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.h" 5 #include "net/http/http_cache.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 3151 matching lines...) Expand 10 before | Expand all | Expand 10 after
3162 transaction.url = kRangeGET_TransactionOK.url; 3162 transaction.url = kRangeGET_TransactionOK.url;
3163 transaction.method = "HEAD"; 3163 transaction.method = "HEAD";
3164 transaction.data = ""; 3164 transaction.data = "";
3165 AddMockTransaction(&transaction); 3165 AddMockTransaction(&transaction);
3166 std::string headers; 3166 std::string headers;
3167 3167
3168 // Load from cache. 3168 // Load from cache.
3169 RunTransactionTestWithResponse(cache.http_cache(), transaction, &headers); 3169 RunTransactionTestWithResponse(cache.http_cache(), transaction, &headers);
3170 3170
3171 EXPECT_NE(std::string::npos, headers.find("HTTP/1.1 200 OK\n")); 3171 EXPECT_NE(std::string::npos, headers.find("HTTP/1.1 200 OK\n"));
3172 EXPECT_EQ(std::string::npos, headers.find("Content-Length")); 3172 EXPECT_NE(std::string::npos, headers.find("Content-Length: 80\n"));
3173 EXPECT_EQ(std::string::npos, headers.find("Content-Range")); 3173 EXPECT_EQ(std::string::npos, headers.find("Content-Range"));
3174 EXPECT_EQ(1, cache.network_layer()->transaction_count()); 3174 EXPECT_EQ(1, cache.network_layer()->transaction_count());
3175 EXPECT_EQ(1, cache.disk_cache()->open_count()); 3175 EXPECT_EQ(1, cache.disk_cache()->open_count());
3176 EXPECT_EQ(1, cache.disk_cache()->create_count()); 3176 EXPECT_EQ(1, cache.disk_cache()->create_count());
3177 RemoveMockTransaction(&transaction); 3177 RemoveMockTransaction(&transaction);
3178 } 3178 }
3179 3179
3180 // Tests that a HEAD request can be served from a truncated resource. 3180 // Tests that a HEAD request can be served from a truncated resource.
3181 TEST(HttpCache, SimpleHEAD_WithTruncatedEntry) { 3181 TEST(HttpCache, SimpleHEAD_WithTruncatedEntry) {
3182 MockHttpCache cache; 3182 MockHttpCache cache;
(...skipping 4586 matching lines...) Expand 10 before | Expand all | Expand 10 after
7769 7769
7770 // Here the second transaction proceeds without reading the first body. 7770 // Here the second transaction proceeds without reading the first body.
7771 EXPECT_EQ(net::LOAD_STATE_WAITING_FOR_CACHE, second->trans->GetLoadState()); 7771 EXPECT_EQ(net::LOAD_STATE_WAITING_FOR_CACHE, second->trans->GetLoadState());
7772 base::MessageLoop::current()->RunUntilIdle(); 7772 base::MessageLoop::current()->RunUntilIdle();
7773 EXPECT_EQ(net::LOAD_STATE_IDLE, second->trans->GetLoadState()); 7773 EXPECT_EQ(net::LOAD_STATE_IDLE, second->trans->GetLoadState());
7774 ASSERT_TRUE(second->trans->GetResponseInfo()); 7774 ASSERT_TRUE(second->trans->GetResponseInfo());
7775 EXPECT_TRUE(second->trans->GetResponseInfo()->headers->HasHeaderValue( 7775 EXPECT_TRUE(second->trans->GetResponseInfo()->headers->HasHeaderValue(
7776 "Cache-Control", "no-store")); 7776 "Cache-Control", "no-store"));
7777 ReadAndVerifyTransaction(second->trans.get(), kSimpleGET_Transaction); 7777 ReadAndVerifyTransaction(second->trans.get(), kSimpleGET_Transaction);
7778 } 7778 }
OLDNEW
« no previous file with comments | « net/http/http_cache_transaction.cc ('k') | net/http/http_network_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698