OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <set> | 5 #include <set> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 210 |
211 test_contents()->Start(); | 211 test_contents()->Start(); |
212 RunEvents(); | 212 RunEvents(); |
213 | 213 |
214 // Fake a request. | 214 // Fake a request. |
215 net::TestURLRequestContext url_request_context; | 215 net::TestURLRequestContext url_request_context; |
216 DeferredRedirectDelegate delegate; | 216 DeferredRedirectDelegate delegate; |
217 scoped_ptr<net::URLRequest> request(url_request_context.CreateRequest( | 217 scoped_ptr<net::URLRequest> request(url_request_context.CreateRequest( |
218 net::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)), | 218 net::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)), |
219 net::DEFAULT_PRIORITY, | 219 net::DEFAULT_PRIORITY, |
220 &delegate, | 220 &delegate)); |
221 NULL)); | |
222 content::ResourceRequestInfo::AllocateForTesting( | 221 content::ResourceRequestInfo::AllocateForTesting( |
223 request.get(), | 222 request.get(), |
224 content::RESOURCE_TYPE_IMAGE, | 223 content::RESOURCE_TYPE_IMAGE, |
225 NULL, | 224 NULL, |
226 kDefaultChildId, | 225 kDefaultChildId, |
227 kDefaultRouteId, | 226 kDefaultRouteId, |
228 MSG_ROUTING_NONE, | 227 MSG_ROUTING_NONE, |
229 false, // is_main_frame | 228 false, // is_main_frame |
230 false, // parent_is_main_frame | 229 false, // parent_is_main_frame |
231 true, // allow_download | 230 true, // allow_download |
(...skipping 25 matching lines...) Expand all Loading... |
257 | 256 |
258 test_contents()->Start(); | 257 test_contents()->Start(); |
259 RunEvents(); | 258 RunEvents(); |
260 | 259 |
261 // Fake a request. | 260 // Fake a request. |
262 net::TestURLRequestContext url_request_context; | 261 net::TestURLRequestContext url_request_context; |
263 DeferredRedirectDelegate delegate; | 262 DeferredRedirectDelegate delegate; |
264 scoped_ptr<net::URLRequest> request(url_request_context.CreateRequest( | 263 scoped_ptr<net::URLRequest> request(url_request_context.CreateRequest( |
265 net::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)), | 264 net::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)), |
266 net::DEFAULT_PRIORITY, | 265 net::DEFAULT_PRIORITY, |
267 &delegate, | 266 &delegate)); |
268 NULL)); | |
269 content::ResourceRequestInfo::AllocateForTesting( | 267 content::ResourceRequestInfo::AllocateForTesting( |
270 request.get(), | 268 request.get(), |
271 content::RESOURCE_TYPE_MAIN_FRAME, | 269 content::RESOURCE_TYPE_MAIN_FRAME, |
272 NULL, | 270 NULL, |
273 kDefaultChildId, | 271 kDefaultChildId, |
274 kDefaultRouteId, | 272 kDefaultRouteId, |
275 MSG_ROUTING_NONE, | 273 MSG_ROUTING_NONE, |
276 true, // is_main_frame | 274 true, // is_main_frame |
277 false, // parent_is_main_frame | 275 false, // parent_is_main_frame |
278 true, // allow_download | 276 true, // allow_download |
(...skipping 23 matching lines...) Expand all Loading... |
302 | 300 |
303 test_contents()->Start(); | 301 test_contents()->Start(); |
304 RunEvents(); | 302 RunEvents(); |
305 | 303 |
306 // Fake a request. | 304 // Fake a request. |
307 net::TestURLRequestContext url_request_context; | 305 net::TestURLRequestContext url_request_context; |
308 DeferredRedirectDelegate delegate; | 306 DeferredRedirectDelegate delegate; |
309 scoped_ptr<net::URLRequest> request(url_request_context.CreateRequest( | 307 scoped_ptr<net::URLRequest> request(url_request_context.CreateRequest( |
310 net::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)), | 308 net::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kRedirectPath)), |
311 net::DEFAULT_PRIORITY, | 309 net::DEFAULT_PRIORITY, |
312 &delegate, | 310 &delegate)); |
313 NULL)); | |
314 content::ResourceRequestInfo::AllocateForTesting( | 311 content::ResourceRequestInfo::AllocateForTesting( |
315 request.get(), | 312 request.get(), |
316 content::RESOURCE_TYPE_XHR, | 313 content::RESOURCE_TYPE_XHR, |
317 NULL, | 314 NULL, |
318 kDefaultChildId, | 315 kDefaultChildId, |
319 kDefaultRouteId, | 316 kDefaultRouteId, |
320 MSG_ROUTING_NONE, | 317 MSG_ROUTING_NONE, |
321 false, // is_main_frame | 318 false, // is_main_frame |
322 false, // parent_is_main_frame | 319 false, // parent_is_main_frame |
323 true, // allow_download | 320 true, // allow_download |
(...skipping 12 matching lines...) Expand all Loading... |
336 // We should have cancelled the prerender. | 333 // We should have cancelled the prerender. |
337 EXPECT_EQ(FINAL_STATUS_BAD_DEFERRED_REDIRECT, | 334 EXPECT_EQ(FINAL_STATUS_BAD_DEFERRED_REDIRECT, |
338 test_contents()->final_status()); | 335 test_contents()->final_status()); |
339 | 336 |
340 // Cleanup work so the prerender is gone. | 337 // Cleanup work so the prerender is gone. |
341 test_contents()->Cancel(); | 338 test_contents()->Cancel(); |
342 RunEvents(); | 339 RunEvents(); |
343 } | 340 } |
344 | 341 |
345 } // namespace prerender | 342 } // namespace prerender |
OLD | NEW |