| Index: third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp
|
| diff --git a/third_party/WebKit/Source/core/fetch/MemoryCacheCorrectnessTest.cpp b/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp
|
| similarity index 90%
|
| rename from third_party/WebKit/Source/core/fetch/MemoryCacheCorrectnessTest.cpp
|
| rename to third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp
|
| index 5da4703dfc5e4b39c73bbf2e5ed70ff92b9e1c04..e3236e75ac8ae81a01bfe889e497b4a2f9f64447 100644
|
| --- a/third_party/WebKit/Source/core/fetch/MemoryCacheCorrectnessTest.cpp
|
| +++ b/third_party/WebKit/Source/platform/loader/fetch/MemoryCacheCorrectnessTest.cpp
|
| @@ -28,14 +28,15 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#include "core/fetch/MemoryCache.h"
|
| +#include "platform/loader/fetch/MemoryCache.h"
|
|
|
| -#include "core/fetch/FetchRequest.h"
|
| -#include "core/fetch/MemoryCacheCorrectnessTestHelper.h"
|
| -#include "core/fetch/MockResource.h"
|
| -#include "core/fetch/RawResource.h"
|
| -#include "core/fetch/Resource.h"
|
| +#include "platform/loader/fetch/FetchRequest.h"
|
| +#include "platform/loader/fetch/MemoryCacheCorrectnessTestHelper.h"
|
| +#include "platform/loader/fetch/MockResource.h"
|
| +#include "platform/loader/fetch/RawResource.h"
|
| +#include "platform/loader/fetch/Resource.h"
|
| #include "platform/network/ResourceRequest.h"
|
| +#include "platform/testing/TestingPlatformSupport.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace blink {
|
| @@ -68,6 +69,9 @@ class MemoryCacheCorrectnessTest : public MemoryCacheCorrectnessTestHelper {
|
| };
|
|
|
| TEST_F(MemoryCacheCorrectnessTest, FreshFromLastModified) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| ResourceResponse fresh200Response;
|
| fresh200Response.setHTTPStatusCode(200);
|
| fresh200Response.setHTTPHeaderField("Date", kOriginalRequestDateAsString);
|
| @@ -85,6 +89,9 @@ TEST_F(MemoryCacheCorrectnessTest, FreshFromLastModified) {
|
| }
|
|
|
| TEST_F(MemoryCacheCorrectnessTest, FreshFromExpires) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| ResourceResponse fresh200Response;
|
| fresh200Response.setHTTPStatusCode(200);
|
| fresh200Response.setHTTPHeaderField("Date", kOriginalRequestDateAsString);
|
| @@ -101,6 +108,9 @@ TEST_F(MemoryCacheCorrectnessTest, FreshFromExpires) {
|
| }
|
|
|
| TEST_F(MemoryCacheCorrectnessTest, FreshFromMaxAge) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| ResourceResponse fresh200Response;
|
| fresh200Response.setHTTPStatusCode(200);
|
| fresh200Response.setHTTPHeaderField("Date", kOriginalRequestDateAsString);
|
| @@ -119,6 +129,9 @@ TEST_F(MemoryCacheCorrectnessTest, FreshFromMaxAge) {
|
| // The strong validator causes a revalidation to be launched, and the proxy and
|
| // original resources leak because of their reference loop.
|
| TEST_F(MemoryCacheCorrectnessTest, DISABLED_ExpiredFromLastModified) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| ResourceResponse expired200Response;
|
| expired200Response.setHTTPStatusCode(200);
|
| expired200Response.setHTTPHeaderField("Date", kOriginalRequestDateAsString);
|
| @@ -135,6 +148,9 @@ TEST_F(MemoryCacheCorrectnessTest, DISABLED_ExpiredFromLastModified) {
|
| }
|
|
|
| TEST_F(MemoryCacheCorrectnessTest, ExpiredFromExpires) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| ResourceResponse expired200Response;
|
| expired200Response.setHTTPStatusCode(200);
|
| expired200Response.setHTTPHeaderField("Date", kOriginalRequestDateAsString);
|
| @@ -153,6 +169,9 @@ TEST_F(MemoryCacheCorrectnessTest, ExpiredFromExpires) {
|
| // If the resource hasn't been loaded in this "document" before, then it
|
| // shouldn't have list of available resources logic.
|
| TEST_F(MemoryCacheCorrectnessTest, NewMockResourceExpiredFromExpires) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| ResourceResponse expired200Response;
|
| expired200Response.setHTTPStatusCode(200);
|
| expired200Response.setHTTPHeaderField("Date", kOriginalRequestDateAsString);
|
| @@ -173,6 +192,9 @@ TEST_F(MemoryCacheCorrectnessTest, NewMockResourceExpiredFromExpires) {
|
| // have list of available resources logic, and so normal cache testing should be
|
| // bypassed.
|
| TEST_F(MemoryCacheCorrectnessTest, ReuseMockResourceExpiredFromExpires) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| ResourceResponse expired200Response;
|
| expired200Response.setHTTPStatusCode(200);
|
| expired200Response.setHTTPHeaderField("Date", kOriginalRequestDateAsString);
|
| @@ -196,6 +218,9 @@ TEST_F(MemoryCacheCorrectnessTest, ReuseMockResourceExpiredFromExpires) {
|
| }
|
|
|
| TEST_F(MemoryCacheCorrectnessTest, ExpiredFromMaxAge) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| ResourceResponse expired200Response;
|
| expired200Response.setHTTPStatusCode(200);
|
| expired200Response.setHTTPHeaderField("Date", kOriginalRequestDateAsString);
|
| @@ -212,6 +237,9 @@ TEST_F(MemoryCacheCorrectnessTest, ExpiredFromMaxAge) {
|
| }
|
|
|
| TEST_F(MemoryCacheCorrectnessTest, FreshButNoCache) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| ResourceResponse fresh200NocacheResponse;
|
| fresh200NocacheResponse.setHTTPStatusCode(200);
|
| fresh200NocacheResponse.setHTTPHeaderField(HTTPNames::Date,
|
| @@ -233,6 +261,9 @@ TEST_F(MemoryCacheCorrectnessTest, FreshButNoCache) {
|
| }
|
|
|
| TEST_F(MemoryCacheCorrectnessTest, RequestWithNoCahe) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| ResourceRequest noCacheRequest;
|
| noCacheRequest.setHTTPHeaderField(HTTPNames::Cache_Control, "no-cache");
|
| Resource* noCacheResource = resourceFromResourceRequest(noCacheRequest);
|
| @@ -241,6 +272,9 @@ TEST_F(MemoryCacheCorrectnessTest, RequestWithNoCahe) {
|
| }
|
|
|
| TEST_F(MemoryCacheCorrectnessTest, FreshButNoStore) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| ResourceResponse fresh200NostoreResponse;
|
| fresh200NostoreResponse.setHTTPStatusCode(200);
|
| fresh200NostoreResponse.setHTTPHeaderField(HTTPNames::Date,
|
| @@ -262,6 +296,9 @@ TEST_F(MemoryCacheCorrectnessTest, FreshButNoStore) {
|
| }
|
|
|
| TEST_F(MemoryCacheCorrectnessTest, RequestWithNoStore) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| ResourceRequest noStoreRequest;
|
| noStoreRequest.setHTTPHeaderField(HTTPNames::Cache_Control, "no-store");
|
| Resource* noStoreResource = resourceFromResourceRequest(noStoreRequest);
|
| @@ -272,6 +309,9 @@ TEST_F(MemoryCacheCorrectnessTest, RequestWithNoStore) {
|
| // FIXME: Determine if ignoring must-revalidate for blink is correct behaviour.
|
| // See crbug.com/340088 .
|
| TEST_F(MemoryCacheCorrectnessTest, DISABLED_FreshButMustRevalidate) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| ResourceResponse fresh200MustRevalidateResponse;
|
| fresh200MustRevalidateResponse.setHTTPStatusCode(200);
|
| fresh200MustRevalidateResponse.setHTTPHeaderField(
|
| @@ -293,6 +333,9 @@ TEST_F(MemoryCacheCorrectnessTest, DISABLED_FreshButMustRevalidate) {
|
| }
|
|
|
| TEST_F(MemoryCacheCorrectnessTest, FreshWithFreshRedirect) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| KURL redirectUrl(ParsedURLString, kResourceURL);
|
| const char redirectTargetUrlString[] = "http://redirect-target.com";
|
| KURL redirectTargetUrl(ParsedURLString, redirectTargetUrlString);
|
| @@ -333,6 +376,9 @@ TEST_F(MemoryCacheCorrectnessTest, FreshWithFreshRedirect) {
|
| }
|
|
|
| TEST_F(MemoryCacheCorrectnessTest, FreshWithStaleRedirect) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| KURL redirectUrl(ParsedURLString, kResourceURL);
|
| const char redirectTargetUrlString[] = "http://redirect-target.com";
|
| KURL redirectTargetUrl(ParsedURLString, redirectTargetUrlString);
|
| @@ -372,6 +418,9 @@ TEST_F(MemoryCacheCorrectnessTest, FreshWithStaleRedirect) {
|
| }
|
|
|
| TEST_F(MemoryCacheCorrectnessTest, PostToSameURLTwice) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| ResourceRequest request1(KURL(ParsedURLString, kResourceURL));
|
| request1.setHTTPMethod(HTTPNames::POST);
|
| Resource* resource1 =
|
| @@ -389,6 +438,9 @@ TEST_F(MemoryCacheCorrectnessTest, PostToSameURLTwice) {
|
| }
|
|
|
| TEST_F(MemoryCacheCorrectnessTest, 302RedirectNotImplicitlyFresh) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| KURL redirectUrl(ParsedURLString, kResourceURL);
|
| const char redirectTargetUrlString[] = "http://redirect-target.com";
|
| KURL redirectTargetUrl(ParsedURLString, redirectTargetUrlString);
|
| @@ -430,6 +482,9 @@ TEST_F(MemoryCacheCorrectnessTest, 302RedirectNotImplicitlyFresh) {
|
| }
|
|
|
| TEST_F(MemoryCacheCorrectnessTest, 302RedirectExplicitlyFreshMaxAge) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| KURL redirectUrl(ParsedURLString, kResourceURL);
|
| const char redirectTargetUrlString[] = "http://redirect-target.com";
|
| KURL redirectTargetUrl(ParsedURLString, redirectTargetUrlString);
|
| @@ -470,6 +525,9 @@ TEST_F(MemoryCacheCorrectnessTest, 302RedirectExplicitlyFreshMaxAge) {
|
| }
|
|
|
| TEST_F(MemoryCacheCorrectnessTest, 302RedirectExplicitlyFreshExpires) {
|
| + ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
|
| + platform;
|
| +
|
| KURL redirectUrl(ParsedURLString, kResourceURL);
|
| const char redirectTargetUrlString[] = "http://redirect-target.com";
|
| KURL redirectTargetUrl(ParsedURLString, redirectTargetUrlString);
|
|
|