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

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

Issue 119189: Add two small features to the HttpCache for benchmarking/debugging.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_cache.cc ('k') | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/hash_tables.h" 7 #include "base/hash_tables.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 } 1232 }
1233 1233
1234 // Ensure that we don't crash by if left-behind transactions. 1234 // Ensure that we don't crash by if left-behind transactions.
1235 TEST(HttpCache, OutlivedTransactions) { 1235 TEST(HttpCache, OutlivedTransactions) {
1236 MockHttpCache* cache = new MockHttpCache; 1236 MockHttpCache* cache = new MockHttpCache;
1237 1237
1238 net::HttpTransaction* trans = cache->http_cache()->CreateTransaction(); 1238 net::HttpTransaction* trans = cache->http_cache()->CreateTransaction();
1239 delete cache; 1239 delete cache;
1240 delete trans; 1240 delete trans;
1241 } 1241 }
1242
1243 // Test that the disabled mode works.
1244 TEST(HttpCache, CacheDisabledMode) {
1245 MockHttpCache cache;
1246
1247 // write to the cache
1248 RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
1249
1250 // go into disabled mode
1251 cache.http_cache()->set_mode(net::HttpCache::DISABLE);
1252
1253 // force this transaction to write to the cache again
1254 MockTransaction transaction(kSimpleGET_Transaction);
1255
1256 RunTransactionTest(cache.http_cache(), transaction);
1257
1258 EXPECT_EQ(2, cache.network_layer()->transaction_count());
1259 EXPECT_EQ(0, cache.disk_cache()->open_count());
1260 EXPECT_EQ(1, cache.disk_cache()->create_count());
1261 }
OLDNEW
« no previous file with comments | « net/http/http_cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698