Index: net/http/http_cache_unittest.cc |
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc |
index 1da77d8d96e27b5298194f3882af074ae1330d17..5f855a7996a28f7477b38d9d2ee022a401e5a2e4 100644 |
--- a/net/http/http_cache_unittest.cc |
+++ b/net/http/http_cache_unittest.cc |
@@ -952,106 +952,6 @@ TEST(HttpCache, SimpleGET_LoadPreferringCache_VaryMismatch) { |
RemoveMockTransaction(&transaction); |
} |
-// Tests that LOAD_FROM_CACHE_IF_OFFLINE returns proper response on |
-// network success |
-TEST(HttpCache, SimpleGET_CacheOverride_Network) { |
- MockHttpCache cache; |
- |
- // Prime cache. |
- MockTransaction transaction(kSimpleGET_Transaction); |
- transaction.load_flags |= LOAD_FROM_CACHE_IF_OFFLINE; |
- transaction.response_headers = "Cache-Control: no-cache\n"; |
- |
- AddMockTransaction(&transaction); |
- RunTransactionTest(cache.http_cache(), transaction); |
- EXPECT_EQ(1, cache.network_layer()->transaction_count()); |
- EXPECT_EQ(1, cache.disk_cache()->create_count()); |
- RemoveMockTransaction(&transaction); |
- |
- // Re-run transaction; make sure the result came from the network, |
- // not the cache. |
- transaction.data = "Changed data."; |
- AddMockTransaction(&transaction); |
- HttpResponseInfo response_info; |
- RunTransactionTestWithResponseInfo(cache.http_cache(), transaction, |
- &response_info); |
- |
- EXPECT_EQ(2, cache.network_layer()->transaction_count()); |
- EXPECT_FALSE(response_info.server_data_unavailable); |
- EXPECT_TRUE(response_info.network_accessed); |
- |
- RemoveMockTransaction(&transaction); |
-} |
- |
-// Tests that LOAD_FROM_CACHE_IF_OFFLINE returns proper response on |
-// offline failure |
-TEST(HttpCache, SimpleGET_CacheOverride_Offline) { |
- MockHttpCache cache; |
- |
- // Prime cache. |
- MockTransaction transaction(kSimpleGET_Transaction); |
- transaction.load_flags |= LOAD_FROM_CACHE_IF_OFFLINE; |
- transaction.response_headers = "Cache-Control: no-cache\n"; |
- |
- AddMockTransaction(&transaction); |
- RunTransactionTest(cache.http_cache(), transaction); |
- EXPECT_EQ(1, cache.network_layer()->transaction_count()); |
- EXPECT_EQ(1, cache.disk_cache()->create_count()); |
- RemoveMockTransaction(&transaction); |
- |
- // Network failure with offline error; should return cache entry above + |
- // flag signalling stale data. |
- transaction.return_code = ERR_NAME_NOT_RESOLVED; |
- AddMockTransaction(&transaction); |
- |
- MockHttpRequest request(transaction); |
- TestCompletionCallback callback; |
- scoped_ptr<HttpTransaction> trans; |
- ASSERT_EQ(OK, cache.CreateTransaction(&trans)); |
- int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
- EXPECT_EQ(OK, callback.GetResult(rv)); |
- |
- const HttpResponseInfo* response_info = trans->GetResponseInfo(); |
- ASSERT_TRUE(response_info); |
- EXPECT_TRUE(response_info->server_data_unavailable); |
- EXPECT_TRUE(response_info->was_cached); |
- EXPECT_FALSE(response_info->network_accessed); |
- ReadAndVerifyTransaction(trans.get(), transaction); |
- EXPECT_EQ(2, cache.network_layer()->transaction_count()); |
- |
- RemoveMockTransaction(&transaction); |
-} |
- |
-// Tests that LOAD_FROM_CACHE_IF_OFFLINE returns proper response on |
-// non-offline failure. |
-TEST(HttpCache, SimpleGET_CacheOverride_NonOffline) { |
- MockHttpCache cache; |
- |
- // Prime cache. |
- MockTransaction transaction(kSimpleGET_Transaction); |
- transaction.load_flags |= LOAD_FROM_CACHE_IF_OFFLINE; |
- transaction.response_headers = "Cache-Control: no-cache\n"; |
- |
- AddMockTransaction(&transaction); |
- RunTransactionTest(cache.http_cache(), transaction); |
- EXPECT_EQ(1, cache.network_layer()->transaction_count()); |
- EXPECT_EQ(1, cache.disk_cache()->create_count()); |
- RemoveMockTransaction(&transaction); |
- |
- // Network failure with non-offline error; should fail with that error. |
- transaction.return_code = ERR_PROXY_CONNECTION_FAILED; |
- AddMockTransaction(&transaction); |
- |
- HttpResponseInfo response_info2; |
- RunTransactionTestWithResponseInfo(cache.http_cache(), transaction, |
- &response_info2); |
- |
- EXPECT_EQ(2, cache.network_layer()->transaction_count()); |
- EXPECT_FALSE(response_info2.server_data_unavailable); |
- |
- RemoveMockTransaction(&transaction); |
-} |
- |
// Tests that was_cached was set properly on a failure, even if the cached |
// response wasn't returned. |
TEST(HttpCache, SimpleGET_CacheSignal_Failure) { |