| Index: net/http/http_cache_unittest.cc
|
| diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
|
| index b64ebbfd735fc437c0f33b79848951098e4ee1b8..3bb546f5099dfa9c7749c74091031110d59e81a4 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 |= net::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);
|
| - net::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 |= net::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 = net::ERR_NAME_NOT_RESOLVED;
|
| - AddMockTransaction(&transaction);
|
| -
|
| - MockHttpRequest request(transaction);
|
| - net::TestCompletionCallback callback;
|
| - scoped_ptr<net::HttpTransaction> trans;
|
| - ASSERT_EQ(net::OK, cache.CreateTransaction(&trans));
|
| - int rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
|
| - EXPECT_EQ(net::OK, callback.GetResult(rv));
|
| -
|
| - const net::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 |= net::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 = net::ERR_PROXY_CONNECTION_FAILED;
|
| - AddMockTransaction(&transaction);
|
| -
|
| - net::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) {
|
|
|