| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/renderer_host/resource_dispatcher_host.h" | 5 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 // (CANCELLED, ERR_INSUFFICIENT_RESOURCES). | 961 // (CANCELLED, ERR_INSUFFICIENT_RESOURCES). |
| 962 int request_id; | 962 int request_id; |
| 963 net::URLRequestStatus status; | 963 net::URLRequestStatus status; |
| 964 | 964 |
| 965 void* iter = NULL; | 965 void* iter = NULL; |
| 966 EXPECT_TRUE(IPC::ReadParam(&msgs[index][0], &iter, &request_id)); | 966 EXPECT_TRUE(IPC::ReadParam(&msgs[index][0], &iter, &request_id)); |
| 967 EXPECT_TRUE(IPC::ReadParam(&msgs[index][0], &iter, &status)); | 967 EXPECT_TRUE(IPC::ReadParam(&msgs[index][0], &iter, &status)); |
| 968 | 968 |
| 969 EXPECT_EQ(index + 1, request_id); | 969 EXPECT_EQ(index + 1, request_id); |
| 970 EXPECT_EQ(net::URLRequestStatus::CANCELED, status.status()); | 970 EXPECT_EQ(net::URLRequestStatus::CANCELED, status.status()); |
| 971 EXPECT_EQ(net::ERR_INSUFFICIENT_RESOURCES, status.os_error()); | 971 EXPECT_EQ(net::ERR_INSUFFICIENT_RESOURCES, status.error()); |
| 972 } | 972 } |
| 973 | 973 |
| 974 // The final 2 requests should have succeeded. | 974 // The final 2 requests should have succeeded. |
| 975 CheckSuccessfulRequest(msgs[kMaxRequests + 2], | 975 CheckSuccessfulRequest(msgs[kMaxRequests + 2], |
| 976 net::URLRequestTestJob::test_data_2()); | 976 net::URLRequestTestJob::test_data_2()); |
| 977 CheckSuccessfulRequest(msgs[kMaxRequests + 3], | 977 CheckSuccessfulRequest(msgs[kMaxRequests + 3], |
| 978 net::URLRequestTestJob::test_data_2()); | 978 net::URLRequestTestJob::test_data_2()); |
| 979 } | 979 } |
| 980 | 980 |
| 981 // Tests that we sniff the mime type for a simple request. | 981 // Tests that we sniff the mime type for a simple request. |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 // (CANCELED, ERR_FILE_NOT_FOUND). | 1125 // (CANCELED, ERR_FILE_NOT_FOUND). |
| 1126 int request_id; | 1126 int request_id; |
| 1127 net::URLRequestStatus status; | 1127 net::URLRequestStatus status; |
| 1128 | 1128 |
| 1129 void* iter = NULL; | 1129 void* iter = NULL; |
| 1130 EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &request_id)); | 1130 EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &request_id)); |
| 1131 EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &status)); | 1131 EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &status)); |
| 1132 | 1132 |
| 1133 EXPECT_EQ(1, request_id); | 1133 EXPECT_EQ(1, request_id); |
| 1134 EXPECT_EQ(net::URLRequestStatus::CANCELED, status.status()); | 1134 EXPECT_EQ(net::URLRequestStatus::CANCELED, status.status()); |
| 1135 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, status.os_error()); | 1135 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, status.error()); |
| 1136 } | 1136 } |
| 1137 | 1137 |
| 1138 namespace { | 1138 namespace { |
| 1139 DownloadId MockNextDownloadId() { | 1139 DownloadId MockNextDownloadId() { |
| 1140 return DownloadId(reinterpret_cast<DownloadManager*>(0xFFFFFFFF), 0); | 1140 return DownloadId(reinterpret_cast<DownloadManager*>(0xFFFFFFFF), 0); |
| 1141 } | 1141 } |
| 1142 } | 1142 } |
| 1143 | 1143 |
| 1144 // Test for http://crbug.com/76202 . We don't want to destroy a | 1144 // Test for http://crbug.com/76202 . We don't want to destroy a |
| 1145 // download request prematurely when processing a cancellation from | 1145 // download request prematurely when processing a cancellation from |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 EXPECT_EQ(1, host_.pending_requests()); | 1215 EXPECT_EQ(1, host_.pending_requests()); |
| 1216 | 1216 |
| 1217 // Cancelling by other methods shouldn't work either. | 1217 // Cancelling by other methods shouldn't work either. |
| 1218 host_.CancelRequestsForProcess(render_view_id); | 1218 host_.CancelRequestsForProcess(render_view_id); |
| 1219 EXPECT_EQ(1, host_.pending_requests()); | 1219 EXPECT_EQ(1, host_.pending_requests()); |
| 1220 | 1220 |
| 1221 // Cancelling by context should work. | 1221 // Cancelling by context should work. |
| 1222 host_.CancelRequestsForContext(&filter_->resource_context()); | 1222 host_.CancelRequestsForContext(&filter_->resource_context()); |
| 1223 EXPECT_EQ(0, host_.pending_requests()); | 1223 EXPECT_EQ(0, host_.pending_requests()); |
| 1224 } | 1224 } |
| OLD | NEW |