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

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

Issue 1846733004: Rename IgnoringCacheData to ValidatingCacheData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format Created 4 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 393
394 TEST_F(FrameFetchContextTest, MainResource) 394 TEST_F(FrameFetchContextTest, MainResource)
395 { 395 {
396 // Default case 396 // Default case
397 ResourceRequest request("http://www.example.com"); 397 ResourceRequest request("http://www.example.com");
398 EXPECT_EQ(UseProtocolCachePolicy, fetchContext->resourceRequestCachePolicy(r equest, Resource::MainResource)); 398 EXPECT_EQ(UseProtocolCachePolicy, fetchContext->resourceRequestCachePolicy(r equest, Resource::MainResource));
399 399
400 // Post 400 // Post
401 ResourceRequest postRequest("http://www.example.com"); 401 ResourceRequest postRequest("http://www.example.com");
402 postRequest.setHTTPMethod("POST"); 402 postRequest.setHTTPMethod("POST");
403 EXPECT_EQ(ReloadIgnoringCacheData, fetchContext->resourceRequestCachePolicy( postRequest, Resource::MainResource)); 403 EXPECT_EQ(ValidatingCacheData, fetchContext->resourceRequestCachePolicy(post Request, Resource::MainResource));
404 404
405 // Re-post 405 // Re-post
406 document->frame()->loader().setLoadType(FrameLoadTypeBackForward); 406 document->frame()->loader().setLoadType(FrameLoadTypeBackForward);
407 EXPECT_EQ(ReturnCacheDataDontLoad, fetchContext->resourceRequestCachePolicy( postRequest, Resource::MainResource)); 407 EXPECT_EQ(ReturnCacheDataDontLoad, fetchContext->resourceRequestCachePolicy( postRequest, Resource::MainResource));
408 408
409 // Enconding overriden 409 // Enconding overriden
410 document->frame()->loader().setLoadType(FrameLoadTypeStandard); 410 document->frame()->loader().setLoadType(FrameLoadTypeStandard);
411 document->frame()->host()->setOverrideEncoding("foo"); 411 document->frame()->host()->setOverrideEncoding("foo");
412 EXPECT_EQ(ReturnCacheDataElseLoad, fetchContext->resourceRequestCachePolicy( request, Resource::MainResource)); 412 EXPECT_EQ(ReturnCacheDataElseLoad, fetchContext->resourceRequestCachePolicy( request, Resource::MainResource));
413 document->frame()->host()->setOverrideEncoding(AtomicString()); 413 document->frame()->host()->setOverrideEncoding(AtomicString());
414 414
415 // FrameLoadTypeSame 415 // FrameLoadTypeSame
416 document->frame()->loader().setLoadType(FrameLoadTypeSame); 416 document->frame()->loader().setLoadType(FrameLoadTypeSame);
417 EXPECT_EQ(ReloadIgnoringCacheData, fetchContext->resourceRequestCachePolicy( request, Resource::MainResource)); 417 EXPECT_EQ(ValidatingCacheData, fetchContext->resourceRequestCachePolicy(requ est, Resource::MainResource));
418 418
419 // Conditional request 419 // Conditional request
420 document->frame()->loader().setLoadType(FrameLoadTypeStandard); 420 document->frame()->loader().setLoadType(FrameLoadTypeStandard);
421 ResourceRequest conditional("http://www.example.com"); 421 ResourceRequest conditional("http://www.example.com");
422 conditional.setHTTPHeaderField(HTTPNames::If_Modified_Since, "foo"); 422 conditional.setHTTPHeaderField(HTTPNames::If_Modified_Since, "foo");
423 EXPECT_EQ(ReloadIgnoringCacheData, fetchContext->resourceRequestCachePolicy( conditional, Resource::MainResource)); 423 EXPECT_EQ(ValidatingCacheData, fetchContext->resourceRequestCachePolicy(cond itional, Resource::MainResource));
424 424
425 // Set up a child frame 425 // Set up a child frame
426 FrameFetchContext* childFetchContext = createChildFrame(); 426 FrameFetchContext* childFetchContext = createChildFrame();
427 427
428 // Child frame as part of back/forward 428 // Child frame as part of back/forward
429 document->frame()->loader().setLoadType(FrameLoadTypeBackForward); 429 document->frame()->loader().setLoadType(FrameLoadTypeBackForward);
430 EXPECT_EQ(ReturnCacheDataElseLoad, childFetchContext->resourceRequestCachePo licy(request, Resource::MainResource)); 430 EXPECT_EQ(ReturnCacheDataElseLoad, childFetchContext->resourceRequestCachePo licy(request, Resource::MainResource));
431 431
432 // Child frame as part of reload 432 // Child frame as part of reload
433 document->frame()->loader().setLoadType(FrameLoadTypeReload); 433 document->frame()->loader().setLoadType(FrameLoadTypeReload);
434 EXPECT_EQ(ReloadIgnoringCacheData, childFetchContext->resourceRequestCachePo licy(request, Resource::MainResource)); 434 EXPECT_EQ(ValidatingCacheData, childFetchContext->resourceRequestCachePolicy (request, Resource::MainResource));
435 435
436 // Child frame as part of end to end reload 436 // Child frame as part of end to end reload
437 document->frame()->loader().setLoadType(FrameLoadTypeReloadFromOrigin); 437 document->frame()->loader().setLoadType(FrameLoadTypeReloadFromOrigin);
438 EXPECT_EQ(ReloadBypassingCache, childFetchContext->resourceRequestCachePolic y(request, Resource::MainResource)); 438 EXPECT_EQ(BypassingCache, childFetchContext->resourceRequestCachePolicy(requ est, Resource::MainResource));
439 } 439 }
440 440
441 TEST_F(FrameFetchContextTest, ModifyPriorityForExperiments) 441 TEST_F(FrameFetchContextTest, ModifyPriorityForExperiments)
442 { 442 {
443 Settings* settings = document->frame()->settings(); 443 Settings* settings = document->frame()->settings();
444 FetchRequest request(ResourceRequest("http://www.example.com"), FetchInitiat orInfo()); 444 FetchRequest request(ResourceRequest("http://www.example.com"), FetchInitiat orInfo());
445 445
446 FetchRequest preloadRequest(ResourceRequest("http://www.example.com"), Fetch InitiatorInfo()); 446 FetchRequest preloadRequest(ResourceRequest("http://www.example.com"), Fetch InitiatorInfo());
447 preloadRequest.setForPreload(true); 447 preloadRequest.setForPreload(true);
448 448
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource ); 709 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource );
710 EXPECT_EQ(mainRequest.isExternalRequest(), test.isExternalExpectation); 710 EXPECT_EQ(mainRequest.isExternalRequest(), test.isExternalExpectation);
711 711
712 ResourceRequest subRequest(test.url); 712 ResourceRequest subRequest(test.url);
713 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource); 713 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource);
714 EXPECT_EQ(subRequest.isExternalRequest(), test.isExternalExpectation); 714 EXPECT_EQ(subRequest.isExternalRequest(), test.isExternalExpectation);
715 } 715 }
716 } 716 }
717 717
718 } // namespace blink 718 } // 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