| 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 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 base::PlatformFile kFakePlatformFile1, kFakePlatformFile2; | 1220 base::PlatformFile kFakePlatformFile1, kFakePlatformFile2; |
| 1221 #if defined(OS_WIN) | 1221 #if defined(OS_WIN) |
| 1222 kFakePlatformFile1 = reinterpret_cast<base::PlatformFile>(1); | 1222 kFakePlatformFile1 = reinterpret_cast<base::PlatformFile>(1); |
| 1223 kFakePlatformFile2 = reinterpret_cast<base::PlatformFile>(2); | 1223 kFakePlatformFile2 = reinterpret_cast<base::PlatformFile>(2); |
| 1224 #else | 1224 #else |
| 1225 kFakePlatformFile1 = 1; | 1225 kFakePlatformFile1 = 1; |
| 1226 kFakePlatformFile2 = 2; | 1226 kFakePlatformFile2 = 2; |
| 1227 #endif | 1227 #endif |
| 1228 | 1228 |
| 1229 ScopedMockTransaction trans_info(kSimpleGET_Transaction); | 1229 ScopedMockTransaction trans_info(kSimpleGET_Transaction); |
| 1230 trans_info.load_flags |= net::LOAD_ENABLE_DOWNLOAD_FILE; |
| 1230 TestCompletionCallback callback; | 1231 TestCompletionCallback callback; |
| 1231 | 1232 |
| 1232 { | 1233 { |
| 1233 // Set the fake file handle to MockDiskEntry so cache is written with an | 1234 // Set the fake file handle to MockDiskEntry so cache is written with an |
| 1234 // entry created with our fake file handle. | 1235 // entry created with our fake file handle. |
| 1235 MockDiskEntry::set_global_platform_file(kFakePlatformFile1); | 1236 MockDiskEntry::set_global_platform_file(kFakePlatformFile1); |
| 1236 | 1237 |
| 1237 scoped_ptr<net::HttpTransaction> trans( | 1238 scoped_ptr<net::HttpTransaction> trans( |
| 1238 cache.http_cache()->CreateTransaction()); | 1239 cache.http_cache()->CreateTransaction()); |
| 1239 ASSERT_TRUE(trans.get()); | 1240 ASSERT_TRUE(trans.get()); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1274 | 1275 |
| 1275 const net::HttpResponseInfo* response = trans->GetResponseInfo(); | 1276 const net::HttpResponseInfo* response = trans->GetResponseInfo(); |
| 1276 ASSERT_TRUE(response); | 1277 ASSERT_TRUE(response); |
| 1277 | 1278 |
| 1278 // Make sure we get the same file handle as in the first request. | 1279 // Make sure we get the same file handle as in the first request. |
| 1279 ASSERT_EQ(kFakePlatformFile1, response->response_data_file); | 1280 ASSERT_EQ(kFakePlatformFile1, response->response_data_file); |
| 1280 | 1281 |
| 1281 ReadAndVerifyTransaction(trans.get(), trans_info); | 1282 ReadAndVerifyTransaction(trans.get(), trans_info); |
| 1282 } | 1283 } |
| 1283 } | 1284 } |
| OLD | NEW |