| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/fetch/Resource.h" | 5 #include "core/fetch/Resource.h" |
| 6 | 6 |
| 7 #include "core/fetch/MemoryCache.h" | 7 #include "core/fetch/MemoryCache.h" |
| 8 #include "platform/SharedBuffer.h" | 8 #include "platform/SharedBuffer.h" |
| 9 #include "platform/network/ResourceRequest.h" | 9 #include "platform/network/ResourceRequest.h" |
| 10 #include "platform/network/ResourceResponse.h" | 10 #include "platform/network/ResourceResponse.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 resource->finish(currentTime()); | 106 resource->finish(currentTime()); |
| 107 resource->prune(); | 107 resource->prune(); |
| 108 ASSERT_TRUE(resource->isPurgeable()); | 108 ASSERT_TRUE(resource->isPurgeable()); |
| 109 bool didLock = resource->lock(); | 109 bool didLock = resource->lock(); |
| 110 ASSERT_FALSE(didLock); | 110 ASSERT_FALSE(didLock); |
| 111 EXPECT_EQ(nullptr, resource->resourceBuffer()); | 111 EXPECT_EQ(nullptr, resource->resourceBuffer()); |
| 112 EXPECT_EQ(size_t(0), resource->encodedSize()); | 112 EXPECT_EQ(size_t(0), resource->encodedSize()); |
| 113 } | 113 } |
| 114 | 114 |
| 115 TEST(ResourceTest, RevalidateWithFragment) |
| 116 { |
| 117 KURL url(ParsedURLString, "http://127.0.0.1:8000/foo.html"); |
| 118 ResourceResponse response; |
| 119 response.setURL(url); |
| 120 response.setHTTPStatusCode(200); |
| 121 Resource* resource = Resource::create(url, Resource::Raw); |
| 122 resource->responseReceived(response, nullptr); |
| 123 resource->finish(); |
| 124 |
| 125 // Revalidating with a url that differs by only the fragment |
| 126 // shouldn't trigger a securiy check. |
| 127 url.setFragmentIdentifier("bar"); |
| 128 resource->setRevalidatingRequest(ResourceRequest(url)); |
| 129 ResourceResponse revalidatingResponse; |
| 130 revalidatingResponse.setURL(url); |
| 131 revalidatingResponse.setHTTPStatusCode(304); |
| 132 resource->responseReceived(revalidatingResponse, nullptr); |
| 133 } |
| 134 |
| 115 } // namespace blink | 135 } // namespace blink |
| OLD | NEW |