Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp

Issue 2767413002: FrameFetchContext should respect BypassingCache for main resources (Closed)
Patch Set: merge master Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 document->loader()->setLoadType(FrameLoadTypeReload); 595 document->loader()->setLoadType(FrameLoadTypeReload);
596 EXPECT_EQ(WebCachePolicy::UseProtocolCachePolicy, 596 EXPECT_EQ(WebCachePolicy::UseProtocolCachePolicy,
597 childFetchContext->resourceRequestCachePolicy( 597 childFetchContext->resourceRequestCachePolicy(
598 request, Resource::MainResource, FetchRequest::NoDefer)); 598 request, Resource::MainResource, FetchRequest::NoDefer));
599 599
600 // Child frame as part of reload bypassing cache 600 // Child frame as part of reload bypassing cache
601 document->loader()->setLoadType(FrameLoadTypeReloadBypassingCache); 601 document->loader()->setLoadType(FrameLoadTypeReloadBypassingCache);
602 EXPECT_EQ(WebCachePolicy::BypassingCache, 602 EXPECT_EQ(WebCachePolicy::BypassingCache,
603 childFetchContext->resourceRequestCachePolicy( 603 childFetchContext->resourceRequestCachePolicy(
604 request, Resource::MainResource, FetchRequest::NoDefer)); 604 request, Resource::MainResource, FetchRequest::NoDefer));
605
606 // Per-frame bypassing reload, but parent load type is different.
607 // This is not the case users can trigger through user interfaces, but for
608 // checking code correctness and consistency.
609 document->loader()->setLoadType(FrameLoadTypeReload);
610 childFrame->loader().documentLoader()->setLoadType(
611 FrameLoadTypeReloadBypassingCache);
612 EXPECT_EQ(WebCachePolicy::BypassingCache,
613 childFetchContext->resourceRequestCachePolicy(
614 request, Resource::MainResource, FetchRequest::NoDefer));
605 } 615 }
606 616
607 TEST_F(FrameFetchContextTest, SetFirstPartyCookieAndRequestorOrigin) { 617 TEST_F(FrameFetchContextTest, SetFirstPartyCookieAndRequestorOrigin) {
608 struct TestCase { 618 struct TestCase {
609 const char* documentURL; 619 const char* documentURL;
610 bool documentSandboxed; 620 bool documentSandboxed;
611 const char* requestorOrigin; // "" => unique origin 621 const char* requestorOrigin; // "" => unique origin
612 WebURLRequest::FrameType frameType; 622 WebURLRequest::FrameType frameType;
613 const char* serializedOrigin; // "" => unique origin 623 const char* serializedOrigin; // "" => unique origin
614 } cases[] = { 624 } cases[] = {
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 setFilterPolicy(WebDocumentSubresourceFilter::WouldDisallow); 941 setFilterPolicy(WebDocumentSubresourceFilter::WouldDisallow);
932 942
933 EXPECT_EQ(ResourceRequestBlockedReason::None, canRequest()); 943 EXPECT_EQ(ResourceRequestBlockedReason::None, canRequest());
934 EXPECT_EQ(0, getFilteredLoadCallCount()); 944 EXPECT_EQ(0, getFilteredLoadCallCount());
935 945
936 EXPECT_EQ(ResourceRequestBlockedReason::None, canRequestPreload()); 946 EXPECT_EQ(ResourceRequestBlockedReason::None, canRequestPreload());
937 EXPECT_EQ(0, getFilteredLoadCallCount()); 947 EXPECT_EQ(0, getFilteredLoadCallCount());
938 } 948 }
939 949
940 } // namespace blink 950 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698