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 "core/fetch/RawResource.h" | 8 #include "core/fetch/RawResource.h" |
9 #include "platform/SharedBuffer.h" | 9 #include "platform/SharedBuffer.h" |
10 #include "platform/network/ResourceRequest.h" | 10 #include "platform/network/ResourceRequest.h" |
11 #include "platform/network/ResourceResponse.h" | 11 #include "platform/network/ResourceResponse.h" |
12 #include "platform/testing/TestingPlatformSupport.h" | 12 #include "platform/testing/TestingPlatformSupport.h" |
13 #include "platform/testing/URLTestHelpers.h" | 13 #include "platform/testing/URLTestHelpers.h" |
14 #include "public/platform/Platform.h" | 14 #include "public/platform/Platform.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "wtf/Vector.h" | 16 #include "wtf/Vector.h" |
17 | 17 |
18 namespace blink { | 18 namespace blink { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 class MockPlatform final : public TestingPlatformSupport { | 22 class MockPlatform final : public TestingPlatformSupport { |
23 public: | 23 public: |
24 MockPlatform() {} | 24 MockPlatform() {} |
25 ~MockPlatform() override {} | 25 ~MockPlatform() override {} |
26 | 26 |
27 // From blink::Platform: | 27 // From blink::Platform: |
28 void cacheMetadata(const WebURL& url, int64_t, const char*, size_t) override { | 28 void cacheMetadata(const WebURL& url, int64_t, const char*, size_t) override { |
29 m_cachedURLs.append(url); | 29 m_cachedURLs.push_back(url); |
30 } | 30 } |
31 | 31 |
32 const Vector<WebURL>& cachedURLs() const { return m_cachedURLs; } | 32 const Vector<WebURL>& cachedURLs() const { return m_cachedURLs; } |
33 | 33 |
34 private: | 34 private: |
35 Vector<WebURL> m_cachedURLs; | 35 Vector<WebURL> m_cachedURLs; |
36 }; | 36 }; |
37 | 37 |
38 ResourceResponse createTestResourceResponse() { | 38 ResourceResponse createTestResourceResponse() { |
39 ResourceResponse response; | 39 ResourceResponse response; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // shouldn't trigger a securiy check. | 84 // shouldn't trigger a securiy check. |
85 url.setFragmentIdentifier("bar"); | 85 url.setFragmentIdentifier("bar"); |
86 resource->setRevalidatingRequest(ResourceRequest(url)); | 86 resource->setRevalidatingRequest(ResourceRequest(url)); |
87 ResourceResponse revalidatingResponse; | 87 ResourceResponse revalidatingResponse; |
88 revalidatingResponse.setURL(url); | 88 revalidatingResponse.setURL(url); |
89 revalidatingResponse.setHTTPStatusCode(304); | 89 revalidatingResponse.setHTTPStatusCode(304); |
90 resource->responseReceived(revalidatingResponse, nullptr); | 90 resource->responseReceived(revalidatingResponse, nullptr); |
91 } | 91 } |
92 | 92 |
93 } // namespace blink | 93 } // namespace blink |
OLD | NEW |