| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015, Google Inc. All rights reserved. | 2 * Copyright (c) 2015, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 | 409 |
| 410 // Post | 410 // Post |
| 411 ResourceRequest postRequest("http://www.example.com"); | 411 ResourceRequest postRequest("http://www.example.com"); |
| 412 postRequest.setHTTPMethod("POST"); | 412 postRequest.setHTTPMethod("POST"); |
| 413 EXPECT_EQ(WebCachePolicy::ValidatingCacheData, fetchContext->resourceRequest
CachePolicy(postRequest, Resource::MainResource, FetchRequest::NoDefer)); | 413 EXPECT_EQ(WebCachePolicy::ValidatingCacheData, fetchContext->resourceRequest
CachePolicy(postRequest, Resource::MainResource, FetchRequest::NoDefer)); |
| 414 | 414 |
| 415 // Re-post | 415 // Re-post |
| 416 document->frame()->loader().setLoadType(FrameLoadTypeBackForward); | 416 document->frame()->loader().setLoadType(FrameLoadTypeBackForward); |
| 417 EXPECT_EQ(WebCachePolicy::ReturnCacheDataDontLoad, fetchContext->resourceReq
uestCachePolicy(postRequest, Resource::MainResource, FetchRequest::NoDefer)); | 417 EXPECT_EQ(WebCachePolicy::ReturnCacheDataDontLoad, fetchContext->resourceReq
uestCachePolicy(postRequest, Resource::MainResource, FetchRequest::NoDefer)); |
| 418 | 418 |
| 419 // Enconding overriden | |
| 420 document->frame()->loader().setLoadType(FrameLoadTypeStandard); | |
| 421 document->frame()->host()->setOverrideEncoding("foo"); | |
| 422 EXPECT_EQ(WebCachePolicy::ReturnCacheDataElseLoad, fetchContext->resourceReq
uestCachePolicy(request, Resource::MainResource, FetchRequest::NoDefer)); | |
| 423 document->frame()->host()->setOverrideEncoding(AtomicString()); | |
| 424 | |
| 425 // FrameLoadTypeReloadMainResource | 419 // FrameLoadTypeReloadMainResource |
| 426 document->frame()->loader().setLoadType(FrameLoadTypeReloadMainResource); | 420 document->frame()->loader().setLoadType(FrameLoadTypeReloadMainResource); |
| 427 EXPECT_EQ(WebCachePolicy::ValidatingCacheData, fetchContext->resourceRequest
CachePolicy(request, Resource::MainResource, FetchRequest::NoDefer)); | 421 EXPECT_EQ(WebCachePolicy::ValidatingCacheData, fetchContext->resourceRequest
CachePolicy(request, Resource::MainResource, FetchRequest::NoDefer)); |
| 428 | 422 |
| 429 // Conditional request | 423 // Conditional request |
| 430 document->frame()->loader().setLoadType(FrameLoadTypeStandard); | 424 document->frame()->loader().setLoadType(FrameLoadTypeStandard); |
| 431 ResourceRequest conditional("http://www.example.com"); | 425 ResourceRequest conditional("http://www.example.com"); |
| 432 conditional.setHTTPHeaderField(HTTPNames::If_Modified_Since, "foo"); | 426 conditional.setHTTPHeaderField(HTTPNames::If_Modified_Since, "foo"); |
| 433 EXPECT_EQ(WebCachePolicy::ValidatingCacheData, fetchContext->resourceRequest
CachePolicy(conditional, Resource::MainResource, FetchRequest::NoDefer)); | 427 EXPECT_EQ(WebCachePolicy::ValidatingCacheData, fetchContext->resourceRequest
CachePolicy(conditional, Resource::MainResource, FetchRequest::NoDefer)); |
| 434 | 428 |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource
); | 690 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource
); |
| 697 EXPECT_EQ(mainRequest.isExternalRequest(), test.isExternalExpectation); | 691 EXPECT_EQ(mainRequest.isExternalRequest(), test.isExternalExpectation); |
| 698 | 692 |
| 699 ResourceRequest subRequest(test.url); | 693 ResourceRequest subRequest(test.url); |
| 700 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource); | 694 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource); |
| 701 EXPECT_EQ(subRequest.isExternalRequest(), test.isExternalExpectation); | 695 EXPECT_EQ(subRequest.isExternalRequest(), test.isExternalExpectation); |
| 702 } | 696 } |
| 703 } | 697 } |
| 704 | 698 |
| 705 } // namespace blink | 699 } // namespace blink |
| OLD | NEW |