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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
630 // checking code correctness and consistency. | 630 // checking code correctness and consistency. |
631 document->Loader()->SetLoadType(kFrameLoadTypeReload); | 631 document->Loader()->SetLoadType(kFrameLoadTypeReload); |
632 child_frame->Loader().GetDocumentLoader()->SetLoadType( | 632 child_frame->Loader().GetDocumentLoader()->SetLoadType( |
633 kFrameLoadTypeReloadBypassingCache); | 633 kFrameLoadTypeReloadBypassingCache); |
634 EXPECT_EQ(WebCachePolicy::kBypassingCache, | 634 EXPECT_EQ(WebCachePolicy::kBypassingCache, |
635 child_fetch_context->ResourceRequestCachePolicy( | 635 child_fetch_context->ResourceRequestCachePolicy( |
636 request, Resource::kMainResource, FetchRequest::kNoDefer)); | 636 request, Resource::kMainResource, FetchRequest::kNoDefer)); |
637 } | 637 } |
638 | 638 |
639 TEST_F(FrameFetchContextTest, SubResourceCachePolicy) { | 639 TEST_F(FrameFetchContextTest, SubResourceCachePolicy) { |
640 // Reset load event state: if the load event is finished, we ignore the | |
641 // DocumentLoader load type. | |
642 document->open(); | |
Nate Chapin
2017/04/11 23:25:50
This is needed because Document::CancelParsing() n
| |
643 ASSERT_FALSE(document->LoadEventFinished()); | |
644 | |
640 // Default case | 645 // Default case |
641 ResourceRequest request("http://www.example.com/mock"); | 646 ResourceRequest request("http://www.example.com/mock"); |
642 EXPECT_EQ(WebCachePolicy::kUseProtocolCachePolicy, | 647 EXPECT_EQ(WebCachePolicy::kUseProtocolCachePolicy, |
643 fetch_context->ResourceRequestCachePolicy(request, Resource::kMock, | 648 fetch_context->ResourceRequestCachePolicy(request, Resource::kMock, |
644 FetchRequest::kNoDefer)); | 649 FetchRequest::kNoDefer)); |
645 | 650 |
646 // FrameLoadTypeReload should not affect sub-resources | 651 // FrameLoadTypeReload should not affect sub-resources |
647 document->Loader()->SetLoadType(kFrameLoadTypeReload); | 652 document->Loader()->SetLoadType(kFrameLoadTypeReload); |
648 EXPECT_EQ(WebCachePolicy::kUseProtocolCachePolicy, | 653 EXPECT_EQ(WebCachePolicy::kUseProtocolCachePolicy, |
649 fetch_context->ResourceRequestCachePolicy(request, Resource::kMock, | 654 fetch_context->ResourceRequestCachePolicy(request, Resource::kMock, |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1023 SetFilterPolicy(WebDocumentSubresourceFilter::kWouldDisallow); | 1028 SetFilterPolicy(WebDocumentSubresourceFilter::kWouldDisallow); |
1024 | 1029 |
1025 EXPECT_EQ(ResourceRequestBlockedReason::kNone, CanRequest()); | 1030 EXPECT_EQ(ResourceRequestBlockedReason::kNone, CanRequest()); |
1026 EXPECT_EQ(0, GetFilteredLoadCallCount()); | 1031 EXPECT_EQ(0, GetFilteredLoadCallCount()); |
1027 | 1032 |
1028 EXPECT_EQ(ResourceRequestBlockedReason::kNone, CanRequestPreload()); | 1033 EXPECT_EQ(ResourceRequestBlockedReason::kNone, CanRequestPreload()); |
1029 EXPECT_EQ(0, GetFilteredLoadCallCount()); | 1034 EXPECT_EQ(0, GetFilteredLoadCallCount()); |
1030 } | 1035 } |
1031 | 1036 |
1032 } // namespace blink | 1037 } // namespace blink |
OLD | NEW |