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

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

Issue 1476123002: Bounce all requests off the cache lock after 25ms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mmenke comments Created 5 years 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/mock_http_cache.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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 1670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 1681
1682 EXPECT_EQ(5, cache.network_layer()->transaction_count()); 1682 EXPECT_EQ(5, cache.network_layer()->transaction_count());
1683 EXPECT_EQ(0, cache.disk_cache()->open_count()); 1683 EXPECT_EQ(0, cache.disk_cache()->open_count());
1684 EXPECT_EQ(5, cache.disk_cache()->create_count()); 1684 EXPECT_EQ(5, cache.disk_cache()->create_count());
1685 1685
1686 for (int i = 0; i < kNumTransactions; ++i) { 1686 for (int i = 0; i < kNumTransactions; ++i) {
1687 delete context_list[i]; 1687 delete context_list[i];
1688 } 1688 }
1689 } 1689 }
1690 1690
1691 // Tests that a (simulated) timeout allows transactions waiting on the cache 1691 // Tests that a short timeout allows transactions waiting on the cache lock to
1692 // lock to continue. 1692 // continue.
1693 TEST(HttpCache, SimpleGET_WriterTimeout) { 1693 TEST(HttpCache, SimpleGET_WriterTimeout) {
1694 MockHttpCache cache; 1694 MockHttpCache cache;
1695 cache.BypassCacheLock();
1696 1695
1697 MockHttpRequest request(kSimpleGET_Transaction); 1696 MockHttpRequest request(kSimpleGET_Transaction);
1698 Context c1, c2; 1697 Context c1, c2;
1699 ASSERT_EQ(OK, cache.CreateTransaction(&c1.trans)); 1698 ASSERT_EQ(OK, cache.CreateTransaction(&c1.trans));
1700 ASSERT_EQ(ERR_IO_PENDING, 1699 ASSERT_EQ(ERR_IO_PENDING,
1701 c1.trans->Start(&request, c1.callback.callback(), BoundNetLog())); 1700 c1.trans->Start(&request, c1.callback.callback(), BoundNetLog()));
1702 ASSERT_EQ(OK, cache.CreateTransaction(&c2.trans)); 1701 ASSERT_EQ(OK, cache.CreateTransaction(&c2.trans));
1703 ASSERT_EQ(ERR_IO_PENDING, 1702 ASSERT_EQ(ERR_IO_PENDING,
1704 c2.trans->Start(&request, c2.callback.callback(), BoundNetLog())); 1703 c2.trans->Start(&request, c2.callback.callback(), BoundNetLog()));
1705 1704
(...skipping 6012 matching lines...) Expand 10 before | Expand all | Expand 10 after
7718 EXPECT_EQ(1, cache.disk_cache()->open_count()); 7717 EXPECT_EQ(1, cache.disk_cache()->open_count());
7719 EXPECT_EQ(1, cache.disk_cache()->create_count()); 7718 EXPECT_EQ(1, cache.disk_cache()->create_count());
7720 EXPECT_TRUE(response_info.was_cached); 7719 EXPECT_TRUE(response_info.was_cached);
7721 7720
7722 // The new SSL state is reported. 7721 // The new SSL state is reported.
7723 EXPECT_EQ(status2, response_info.ssl_info.connection_status); 7722 EXPECT_EQ(status2, response_info.ssl_info.connection_status);
7724 EXPECT_TRUE(cert2->Equals(response_info.ssl_info.cert.get())); 7723 EXPECT_TRUE(cert2->Equals(response_info.ssl_info.cert.get()));
7725 } 7724 }
7726 7725
7727 } // namespace net 7726 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_cache_transaction.cc ('k') | net/http/mock_http_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698