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/string_util.h" | 9 #include "base/string_util.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 | 1081 |
1082 scoped_ptr<net::HttpTransaction> trans( | 1082 scoped_ptr<net::HttpTransaction> trans( |
1083 cache.http_cache()->CreateTransaction()); | 1083 cache.http_cache()->CreateTransaction()); |
1084 ASSERT_TRUE(trans.get()); | 1084 ASSERT_TRUE(trans.get()); |
1085 | 1085 |
1086 int rv = trans->Start(&request, &callback); | 1086 int rv = trans->Start(&request, &callback); |
1087 if (rv == net::ERR_IO_PENDING) | 1087 if (rv == net::ERR_IO_PENDING) |
1088 rv = callback.WaitForResult(); | 1088 rv = callback.WaitForResult(); |
1089 ASSERT_EQ(net::ERR_CACHE_MISS, rv); | 1089 ASSERT_EQ(net::ERR_CACHE_MISS, rv); |
1090 } | 1090 } |
| 1091 |
| 1092 // Ensure that we don't crash by if left-behind transactions. |
| 1093 TEST(HttpCache, OutlivedTransactions) { |
| 1094 MockHttpCache* cache = new MockHttpCache; |
| 1095 |
| 1096 net::HttpTransaction* trans = cache->http_cache()->CreateTransaction(); |
| 1097 delete cache; |
| 1098 delete trans; |
| 1099 } |
OLD | NEW |