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

Unified Diff: net/http/http_cache_unittest.cc

Issue 1080673004: Remove network load flags not used in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed errors due to missing changes. Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_cache_transaction.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « net/http/http_cache_transaction.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698