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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 // checking code correctness and consistency. | 635 // checking code correctness and consistency. |
636 document->Loader()->SetLoadType(kFrameLoadTypeReload); | 636 document->Loader()->SetLoadType(kFrameLoadTypeReload); |
637 child_frame->Loader().GetDocumentLoader()->SetLoadType( | 637 child_frame->Loader().GetDocumentLoader()->SetLoadType( |
638 kFrameLoadTypeReloadBypassingCache); | 638 kFrameLoadTypeReloadBypassingCache); |
639 EXPECT_EQ(WebCachePolicy::kBypassingCache, | 639 EXPECT_EQ(WebCachePolicy::kBypassingCache, |
640 child_fetch_context->ResourceRequestCachePolicy( | 640 child_fetch_context->ResourceRequestCachePolicy( |
641 request, Resource::kMainResource, FetchParameters::kNoDefer)); | 641 request, Resource::kMainResource, FetchParameters::kNoDefer)); |
642 } | 642 } |
643 | 643 |
644 TEST_F(FrameFetchContextTest, SubResourceCachePolicy) { | 644 TEST_F(FrameFetchContextTest, SubResourceCachePolicy) { |
645 // Reset load event state: if the load event is finished, we ignore the | |
646 // DocumentLoader load type. | |
647 document->open(); | |
648 ASSERT_FALSE(document->LoadEventFinished()); | |
649 | |
650 // Default case | 645 // Default case |
651 ResourceRequest request("http://www.example.com/mock"); | 646 ResourceRequest request("http://www.example.com/mock"); |
652 EXPECT_EQ(WebCachePolicy::kUseProtocolCachePolicy, | 647 EXPECT_EQ(WebCachePolicy::kUseProtocolCachePolicy, |
653 fetch_context->ResourceRequestCachePolicy( | 648 fetch_context->ResourceRequestCachePolicy( |
654 request, Resource::kMock, FetchParameters::kNoDefer)); | 649 request, Resource::kMock, FetchParameters::kNoDefer)); |
655 | 650 |
656 // FrameLoadTypeReload should not affect sub-resources | 651 // FrameLoadTypeReload should not affect sub-resources |
657 document->Loader()->SetLoadType(kFrameLoadTypeReload); | 652 document->Loader()->SetLoadType(kFrameLoadTypeReload); |
658 EXPECT_EQ(WebCachePolicy::kUseProtocolCachePolicy, | 653 EXPECT_EQ(WebCachePolicy::kUseProtocolCachePolicy, |
659 fetch_context->ResourceRequestCachePolicy( | 654 fetch_context->ResourceRequestCachePolicy( |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 SetFilterPolicy(WebDocumentSubresourceFilter::kWouldDisallow); | 898 SetFilterPolicy(WebDocumentSubresourceFilter::kWouldDisallow); |
904 | 899 |
905 EXPECT_EQ(ResourceRequestBlockedReason::kNone, CanRequest()); | 900 EXPECT_EQ(ResourceRequestBlockedReason::kNone, CanRequest()); |
906 EXPECT_EQ(0, GetFilteredLoadCallCount()); | 901 EXPECT_EQ(0, GetFilteredLoadCallCount()); |
907 | 902 |
908 EXPECT_EQ(ResourceRequestBlockedReason::kNone, CanRequestPreload()); | 903 EXPECT_EQ(ResourceRequestBlockedReason::kNone, CanRequestPreload()); |
909 EXPECT_EQ(0, GetFilteredLoadCallCount()); | 904 EXPECT_EQ(0, GetFilteredLoadCallCount()); |
910 } | 905 } |
911 | 906 |
912 } // namespace blink | 907 } // namespace blink |
OLD | NEW |