Chromium Code Reviews| 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) | |
|
hiroshige
2016/06/13 20:17:04
Could you add a comment about what this is testing
yhirano
2016/06/13 20:17:14
Can you write some comments that we don't need ASS
Nate Chapin
2016/06/13 20:51:21
Done.
| |
| 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 url.setFragmentIdentifier("bar"); | |
| 126 resource->setRevalidatingRequest(ResourceRequest(url)); | |
| 127 ResourceResponse revalidatingResponse; | |
| 128 revalidatingResponse.setURL(url); | |
| 129 revalidatingResponse.setHTTPStatusCode(304); | |
| 130 resource->responseReceived(revalidatingResponse, nullptr); | |
| 131 } | |
| 132 | |
| 115 } // namespace blink | 133 } // namespace blink |
| OLD | NEW |