OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014, Google Inc. All rights reserved. | 2 * Copyright (c) 2014, 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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 request1.setHTTPMethod("POST"); | 453 request1.setHTTPMethod("POST"); |
454 ResourcePtr<Resource> resource1 = new Resource(ResourceRequest(request1.url(
)), Resource::Raw); | 454 ResourcePtr<Resource> resource1 = new Resource(ResourceRequest(request1.url(
)), Resource::Raw); |
455 resource1->setLoading(true); | 455 resource1->setLoading(true); |
456 memoryCache()->add(resource1.get()); | 456 memoryCache()->add(resource1.get()); |
457 | 457 |
458 ResourceRequest request2(KURL(ParsedURLString, kResourceURL)); | 458 ResourceRequest request2(KURL(ParsedURLString, kResourceURL)); |
459 request2.setHTTPMethod("POST"); | 459 request2.setHTTPMethod("POST"); |
460 FetchRequest fetch2(request2, FetchInitiatorInfo()); | 460 FetchRequest fetch2(request2, FetchInitiatorInfo()); |
461 ResourcePtr<Resource> resource2 = fetcher()->fetchSynchronously(fetch2); | 461 ResourcePtr<Resource> resource2 = fetcher()->fetchSynchronously(fetch2); |
462 | 462 |
463 EXPECT_EQ(resource2, memoryCache()->resourceForURL(request2.url())); | 463 EXPECT_EQ(resource2, memoryCache()->resourceForURL(MemoryCache::defaultCache
Identifier(), request2.url())); |
464 EXPECT_NE(resource1, resource2); | 464 EXPECT_NE(resource1, resource2); |
465 } | 465 } |
466 | 466 |
467 TEST_F(CachingCorrectnessTest, 302RedirectNotImplicitlyFresh) | 467 TEST_F(CachingCorrectnessTest, 302RedirectNotImplicitlyFresh) |
468 { | 468 { |
469 KURL redirectUrl(ParsedURLString, kResourceURL); | 469 KURL redirectUrl(ParsedURLString, kResourceURL); |
470 const char redirectTargetUrlString[] = "http://redirect-target.com"; | 470 const char redirectTargetUrlString[] = "http://redirect-target.com"; |
471 KURL redirectTargetUrl(ParsedURLString, redirectTargetUrlString); | 471 KURL redirectTargetUrl(ParsedURLString, redirectTargetUrlString); |
472 | 472 |
473 ResourcePtr<Resource> firstResource = new Resource(ResourceRequest(redirectU
rl), Resource::Raw); | 473 ResourcePtr<Resource> firstResource = new Resource(ResourceRequest(redirectU
rl), Resource::Raw); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 firstResource->setResponse(fresh200Response); | 563 firstResource->setResponse(fresh200Response); |
564 memoryCache()->add(firstResource.get()); | 564 memoryCache()->add(firstResource.get()); |
565 | 565 |
566 advanceClock(500.); | 566 advanceClock(500.); |
567 | 567 |
568 ResourcePtr<Resource> fetched = fetch(); | 568 ResourcePtr<Resource> fetched = fetch(); |
569 EXPECT_EQ(firstResource, fetched); | 569 EXPECT_EQ(firstResource, fetched); |
570 } | 570 } |
571 | 571 |
572 } // namespace | 572 } // namespace |
OLD | NEW |