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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp

Issue 2341893002: Don't attempt to revalidate a Resource with a 304 response. (Closed)
Patch Set: Fix comment issues Created 4 years, 2 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/fetch/ResourceFetcher.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) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, 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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 Platform::current()->getURLLoaderMockFactory()->unregisterURL(url); 654 Platform::current()->getURLLoaderMockFactory()->unregisterURL(url);
655 EXPECT_TRUE(memoryCache()->contains(resource)); 655 EXPECT_TRUE(memoryCache()->contains(resource));
656 EXPECT_TRUE(resource->isPreloaded()); 656 EXPECT_TRUE(resource->isPreloaded());
657 657
658 // DCL reached on second fetcher 658 // DCL reached on second fetcher
659 fetcher2->clearPreloads(ResourceFetcher::ClearSpeculativeMarkupPreloads); 659 fetcher2->clearPreloads(ResourceFetcher::ClearSpeculativeMarkupPreloads);
660 EXPECT_TRUE(memoryCache()->contains(resource)); 660 EXPECT_TRUE(memoryCache()->contains(resource));
661 EXPECT_FALSE(resource->isPreloaded()); 661 EXPECT_FALSE(resource->isPreloaded());
662 } 662 }
663 663
664 TEST_F(ResourceFetcherTest, Revalidate304)
665 {
666 KURL url(ParsedURLString, "http://127.0.0.1:8000/foo.html");
667 Resource* resource = Resource::create(url, Resource::Raw);
668 memoryCache()->add(resource);
669 ResourceResponse response;
670 response.setURL(url);
671 response.setHTTPStatusCode(304);
672 response.setHTTPHeaderField("etag", "1234567890");
673 resource->responseReceived(response, nullptr);
674 resource->finish();
675
676 ResourceFetcher* fetcher = ResourceFetcher::create(ResourceFetcherTestMockFe tchContext::create());
677 FetchRequest fetchRequest = FetchRequest(url, FetchInitiatorInfo());
678 Platform::current()->getURLLoaderMockFactory()->registerURL(url, WebURLRespo nse(), "");
679 Resource* newResource = fetcher->requestResource(fetchRequest, TestResourceF actory(Resource::Raw));
680 fetcher->stopFetching();
681 Platform::current()->getURLLoaderMockFactory()->unregisterURL(url);
682
683 EXPECT_NE(resource, newResource);
684 }
685
664 } // namespace blink 686 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698