OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 4085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4096 | 4096 |
4097 RunTransactionTest(cache.http_cache(), transaction); | 4097 RunTransactionTest(cache.http_cache(), transaction); |
4098 | 4098 |
4099 EXPECT_EQ(2, cache.network_layer()->transaction_count()); | 4099 EXPECT_EQ(2, cache.network_layer()->transaction_count()); |
4100 EXPECT_EQ(1, cache.disk_cache()->open_count()); | 4100 EXPECT_EQ(1, cache.disk_cache()->open_count()); |
4101 EXPECT_EQ(1, cache.disk_cache()->create_count()); | 4101 EXPECT_EQ(1, cache.disk_cache()->create_count()); |
4102 | 4102 |
4103 RemoveMockTransaction(&transaction); | 4103 RemoveMockTransaction(&transaction); |
4104 } | 4104 } |
4105 | 4105 |
4106 #ifdef NDEBUG | 4106 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) |
4107 // This test hits a NOTREACHED so it is a release mode only test. | 4107 // This test hits a NOTREACHED so it is a release mode only test. |
4108 TEST(HttpCache, RangeGET_OK_LoadOnlyFromCache) { | 4108 TEST(HttpCache, RangeGET_OK_LoadOnlyFromCache) { |
4109 MockHttpCache cache; | 4109 MockHttpCache cache; |
4110 AddMockTransaction(&kRangeGET_TransactionOK); | 4110 AddMockTransaction(&kRangeGET_TransactionOK); |
4111 | 4111 |
4112 // Write to the cache (40-49). | 4112 // Write to the cache (40-49). |
4113 RunTransactionTest(cache.http_cache(), kRangeGET_TransactionOK); | 4113 RunTransactionTest(cache.http_cache(), kRangeGET_TransactionOK); |
4114 EXPECT_EQ(1, cache.network_layer()->transaction_count()); | 4114 EXPECT_EQ(1, cache.network_layer()->transaction_count()); |
4115 EXPECT_EQ(0, cache.disk_cache()->open_count()); | 4115 EXPECT_EQ(0, cache.disk_cache()->open_count()); |
4116 EXPECT_EQ(1, cache.disk_cache()->create_count()); | 4116 EXPECT_EQ(1, cache.disk_cache()->create_count()); |
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5213 new net::DiskCacheBasedSSLHostInfo("https://www.verisign.com", ssl_config, | 5213 new net::DiskCacheBasedSSLHostInfo("https://www.verisign.com", ssl_config, |
5214 &cert_verifier, cache.http_cache()); | 5214 &cert_verifier, cache.http_cache()); |
5215 ssl_host_info->Start(); | 5215 ssl_host_info->Start(); |
5216 DeleteSSLHostInfoCompletionCallback callback(ssl_host_info); | 5216 DeleteSSLHostInfoCompletionCallback callback(ssl_host_info); |
5217 int rv = ssl_host_info->WaitForDataReady(&callback); | 5217 int rv = ssl_host_info->WaitForDataReady(&callback); |
5218 EXPECT_EQ(net::ERR_IO_PENDING, rv); | 5218 EXPECT_EQ(net::ERR_IO_PENDING, rv); |
5219 // Now complete the backend creation and let the callback run. | 5219 // Now complete the backend creation and let the callback run. |
5220 factory->FinishCreation(); | 5220 factory->FinishCreation(); |
5221 EXPECT_EQ(net::OK, callback.GetResult(rv)); | 5221 EXPECT_EQ(net::OK, callback.GetResult(rv)); |
5222 } | 5222 } |
OLD | NEW |