| 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/ResourcePtr.h" | 7 #include "core/fetch/ResourcePtr.h" |
| 8 #include "platform/network/ResourceRequest.h" | 8 #include "platform/network/ResourceRequest.h" |
| 9 #include "platform/network/ResourceResponse.h" | 9 #include "platform/network/ResourceResponse.h" |
| 10 #include "platform/testing/TestingPlatformSupport.h" | 10 #include "platform/testing/TestingPlatformSupport.h" |
| 11 #include "platform/testing/URLTestHelpers.h" | 11 #include "platform/testing/URLTestHelpers.h" |
| 12 #include "public/platform/Platform.h" | 12 #include "public/platform/Platform.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "wtf/Vector.h" | 14 #include "wtf/Vector.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 class MockPlatform final : public TestingPlatformSupport { | 20 class MockPlatform final : public TestingPlatformSupport { |
| 21 public: | 21 public: |
| 22 MockPlatform() { } | 22 MockPlatform() { } |
| 23 ~MockPlatform() override { } | 23 ~MockPlatform() override { } |
| 24 | 24 |
| 25 // From blink::Platform: | 25 // From blink::Platform: |
| 26 void cacheMetadata(const WebURL& url, int64, const char*, size_t) override | 26 void cacheMetadata(const WebURL& url, int64_t, const char*, size_t) override |
| 27 { | 27 { |
| 28 m_cachedURLs.append(url); | 28 m_cachedURLs.append(url); |
| 29 } | 29 } |
| 30 | 30 |
| 31 const Vector<WebURL>& cachedURLs() const | 31 const Vector<WebURL>& cachedURLs() const |
| 32 { | 32 { |
| 33 return m_cachedURLs; | 33 return m_cachedURLs; |
| 34 } | 34 } |
| 35 | 35 |
| 36 private: | 36 private: |
| (...skipping 30 matching lines...) Expand all Loading... |
| 67 TEST(ResourceTest, SetCachedMetadata_DoesNotSendMetadataToPlatformWhenFetchedVia
ServiceWorker) | 67 TEST(ResourceTest, SetCachedMetadata_DoesNotSendMetadataToPlatformWhenFetchedVia
ServiceWorker) |
| 68 { | 68 { |
| 69 MockPlatform mock; | 69 MockPlatform mock; |
| 70 ResourceResponse response(createTestResourceResponse()); | 70 ResourceResponse response(createTestResourceResponse()); |
| 71 response.setWasFetchedViaServiceWorker(true); | 71 response.setWasFetchedViaServiceWorker(true); |
| 72 createTestResourceAndSetCachedMetadata(response); | 72 createTestResourceAndSetCachedMetadata(response); |
| 73 EXPECT_EQ(0u, mock.cachedURLs().size()); | 73 EXPECT_EQ(0u, mock.cachedURLs().size()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace blink | 76 } // namespace blink |
| OLD | NEW |