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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 // checking code correctness and consistency. | 658 // checking code correctness and consistency. |
659 document->Loader()->SetLoadType(kFrameLoadTypeReload); | 659 document->Loader()->SetLoadType(kFrameLoadTypeReload); |
660 child_frame->Loader().GetDocumentLoader()->SetLoadType( | 660 child_frame->Loader().GetDocumentLoader()->SetLoadType( |
661 kFrameLoadTypeReloadBypassingCache); | 661 kFrameLoadTypeReloadBypassingCache); |
662 EXPECT_EQ(WebCachePolicy::kBypassingCache, | 662 EXPECT_EQ(WebCachePolicy::kBypassingCache, |
663 child_fetch_context->ResourceRequestCachePolicy( | 663 child_fetch_context->ResourceRequestCachePolicy( |
664 request, Resource::kMainResource, FetchParameters::kNoDefer)); | 664 request, Resource::kMainResource, FetchParameters::kNoDefer)); |
665 } | 665 } |
666 | 666 |
667 TEST_F(FrameFetchContextTest, SubResourceCachePolicy) { | 667 TEST_F(FrameFetchContextTest, SubResourceCachePolicy) { |
| 668 // Reset load event state: if the load event is finished, we ignore the |
| 669 // DocumentLoader load type. |
| 670 document->open(); |
| 671 ASSERT_FALSE(document->LoadEventFinished()); |
| 672 |
668 // Default case | 673 // Default case |
669 ResourceRequest request("http://www.example.com/mock"); | 674 ResourceRequest request("http://www.example.com/mock"); |
670 EXPECT_EQ(WebCachePolicy::kUseProtocolCachePolicy, | 675 EXPECT_EQ(WebCachePolicy::kUseProtocolCachePolicy, |
671 fetch_context->ResourceRequestCachePolicy( | 676 fetch_context->ResourceRequestCachePolicy( |
672 request, Resource::kMock, FetchParameters::kNoDefer)); | 677 request, Resource::kMock, FetchParameters::kNoDefer)); |
673 | 678 |
674 // FrameLoadTypeReload should not affect sub-resources | 679 // FrameLoadTypeReload should not affect sub-resources |
675 document->Loader()->SetLoadType(kFrameLoadTypeReload); | 680 document->Loader()->SetLoadType(kFrameLoadTypeReload); |
676 EXPECT_EQ(WebCachePolicy::kUseProtocolCachePolicy, | 681 EXPECT_EQ(WebCachePolicy::kUseProtocolCachePolicy, |
677 fetch_context->ResourceRequestCachePolicy( | 682 fetch_context->ResourceRequestCachePolicy( |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 SetFilterPolicy(WebDocumentSubresourceFilter::kWouldDisallow); | 926 SetFilterPolicy(WebDocumentSubresourceFilter::kWouldDisallow); |
922 | 927 |
923 EXPECT_EQ(ResourceRequestBlockedReason::kNone, CanRequest()); | 928 EXPECT_EQ(ResourceRequestBlockedReason::kNone, CanRequest()); |
924 EXPECT_EQ(0, GetFilteredLoadCallCount()); | 929 EXPECT_EQ(0, GetFilteredLoadCallCount()); |
925 | 930 |
926 EXPECT_EQ(ResourceRequestBlockedReason::kNone, CanRequestPreload()); | 931 EXPECT_EQ(ResourceRequestBlockedReason::kNone, CanRequestPreload()); |
927 EXPECT_EQ(0, GetFilteredLoadCallCount()); | 932 EXPECT_EQ(0, GetFilteredLoadCallCount()); |
928 } | 933 } |
929 | 934 |
930 } // namespace blink | 935 } // namespace blink |
OLD | NEW |