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

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

Issue 2837763003: Reland "Move most of FrameLoader::CheckCompleted() to Document" (Closed)
Patch Set: Fix comment typos 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
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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698