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

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

Issue 1975753006: Pull to refresh: Use new reload type RELOAD_MAIN_RESOURCE (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review #14 and #16 Created 4 years, 7 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 // Re-post 406 // Re-post
407 document->frame()->loader().setLoadType(FrameLoadTypeBackForward); 407 document->frame()->loader().setLoadType(FrameLoadTypeBackForward);
408 EXPECT_EQ(WebCachePolicy::ReturnCacheDataDontLoad, fetchContext->resourceReq uestCachePolicy(postRequest, Resource::MainResource, FetchRequest::NoDefer)); 408 EXPECT_EQ(WebCachePolicy::ReturnCacheDataDontLoad, fetchContext->resourceReq uestCachePolicy(postRequest, Resource::MainResource, FetchRequest::NoDefer));
409 409
410 // Enconding overriden 410 // Enconding overriden
411 document->frame()->loader().setLoadType(FrameLoadTypeStandard); 411 document->frame()->loader().setLoadType(FrameLoadTypeStandard);
412 document->frame()->host()->setOverrideEncoding("foo"); 412 document->frame()->host()->setOverrideEncoding("foo");
413 EXPECT_EQ(WebCachePolicy::ReturnCacheDataElseLoad, fetchContext->resourceReq uestCachePolicy(request, Resource::MainResource, FetchRequest::NoDefer)); 413 EXPECT_EQ(WebCachePolicy::ReturnCacheDataElseLoad, fetchContext->resourceReq uestCachePolicy(request, Resource::MainResource, FetchRequest::NoDefer));
414 document->frame()->host()->setOverrideEncoding(AtomicString()); 414 document->frame()->host()->setOverrideEncoding(AtomicString());
415 415
416 // FrameLoadTypeSame 416 // FrameLoadTypeReloadMainResource
417 document->frame()->loader().setLoadType(FrameLoadTypeSame); 417 document->frame()->loader().setLoadType(FrameLoadTypeReloadMainResource);
418 EXPECT_EQ(WebCachePolicy::ValidatingCacheData, fetchContext->resourceRequest CachePolicy(request, Resource::MainResource, FetchRequest::NoDefer)); 418 EXPECT_EQ(WebCachePolicy::ValidatingCacheData, fetchContext->resourceRequest CachePolicy(request, Resource::MainResource, FetchRequest::NoDefer));
419 419
420 // Conditional request 420 // Conditional request
421 document->frame()->loader().setLoadType(FrameLoadTypeStandard); 421 document->frame()->loader().setLoadType(FrameLoadTypeStandard);
422 ResourceRequest conditional("http://www.example.com"); 422 ResourceRequest conditional("http://www.example.com");
423 conditional.setHTTPHeaderField(HTTPNames::If_Modified_Since, "foo"); 423 conditional.setHTTPHeaderField(HTTPNames::If_Modified_Since, "foo");
424 EXPECT_EQ(WebCachePolicy::ValidatingCacheData, fetchContext->resourceRequest CachePolicy(conditional, Resource::MainResource, FetchRequest::NoDefer)); 424 EXPECT_EQ(WebCachePolicy::ValidatingCacheData, fetchContext->resourceRequest CachePolicy(conditional, Resource::MainResource, FetchRequest::NoDefer));
425 425
426 // Set up a child frame 426 // Set up a child frame
427 FrameFetchContext* childFetchContext = createChildFrame(); 427 FrameFetchContext* childFetchContext = createChildFrame();
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource ); 710 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource );
711 EXPECT_EQ(mainRequest.isExternalRequest(), test.isExternalExpectation); 711 EXPECT_EQ(mainRequest.isExternalRequest(), test.isExternalExpectation);
712 712
713 ResourceRequest subRequest(test.url); 713 ResourceRequest subRequest(test.url);
714 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource); 714 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource);
715 EXPECT_EQ(subRequest.isExternalRequest(), test.isExternalExpectation); 715 EXPECT_EQ(subRequest.isExternalRequest(), test.isExternalExpectation);
716 } 716 }
717 } 717 }
718 718
719 } // namespace blink 719 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.cpp ('k') | third_party/WebKit/Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698