OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/platform_file.h" | 9 #include "base/platform_file.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1256 net::HttpTransaction* trans = cache->http_cache()->CreateTransaction(); | 1256 net::HttpTransaction* trans = cache->http_cache()->CreateTransaction(); |
1257 delete cache; | 1257 delete cache; |
1258 delete trans; | 1258 delete trans; |
1259 } | 1259 } |
1260 | 1260 |
1261 // Make sure Entry::UseExternalFile is called when a new entry is created in | 1261 // Make sure Entry::UseExternalFile is called when a new entry is created in |
1262 // a HttpCache with MEDIA type. Also make sure Entry::GetPlatformFile is called | 1262 // a HttpCache with MEDIA type. Also make sure Entry::GetPlatformFile is called |
1263 // when an entry is loaded from a HttpCache with MEDIA type. Also confirm we | 1263 // when an entry is loaded from a HttpCache with MEDIA type. Also confirm we |
1264 // will receive a file handle in ResponseInfo from a media cache. | 1264 // will receive a file handle in ResponseInfo from a media cache. |
1265 TEST(HttpCache, SimpleGET_MediaCache) { | 1265 TEST(HttpCache, SimpleGET_MediaCache) { |
1266 // Initialize the HttpCache with MEDIA type. | 1266 // Initialize the HttpCache with MEDIA_CACHE type. |
1267 MockHttpCache cache; | 1267 MockHttpCache cache; |
1268 cache.http_cache()->set_type(net::HttpCache::MEDIA); | 1268 cache.http_cache()->set_type(net::MEDIA_CACHE); |
1269 | 1269 |
1270 // Define some fake file handles for testing. | 1270 // Define some fake file handles for testing. |
1271 base::PlatformFile kFakePlatformFile1, kFakePlatformFile2; | 1271 base::PlatformFile kFakePlatformFile1, kFakePlatformFile2; |
1272 #if defined(OS_WIN) | 1272 #if defined(OS_WIN) |
1273 kFakePlatformFile1 = reinterpret_cast<base::PlatformFile>(1); | 1273 kFakePlatformFile1 = reinterpret_cast<base::PlatformFile>(1); |
1274 kFakePlatformFile2 = reinterpret_cast<base::PlatformFile>(2); | 1274 kFakePlatformFile2 = reinterpret_cast<base::PlatformFile>(2); |
1275 #else | 1275 #else |
1276 kFakePlatformFile1 = 1; | 1276 kFakePlatformFile1 = 1; |
1277 kFakePlatformFile2 = 2; | 1277 kFakePlatformFile2 = 2; |
1278 #endif | 1278 #endif |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 | 1326 |
1327 const net::HttpResponseInfo* response = trans->GetResponseInfo(); | 1327 const net::HttpResponseInfo* response = trans->GetResponseInfo(); |
1328 ASSERT_TRUE(response); | 1328 ASSERT_TRUE(response); |
1329 | 1329 |
1330 // Make sure we get the same file handle as in the first request. | 1330 // Make sure we get the same file handle as in the first request. |
1331 ASSERT_EQ(kFakePlatformFile1, response->response_data_file); | 1331 ASSERT_EQ(kFakePlatformFile1, response->response_data_file); |
1332 | 1332 |
1333 ReadAndVerifyTransaction(trans.get(), trans_info); | 1333 ReadAndVerifyTransaction(trans.get(), trans_info); |
1334 } | 1334 } |
1335 } | 1335 } |
OLD | NEW |