OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "public/platform/WebDocumentSubresourceFilter.h" | 5 #include "public/platform/WebDocumentSubresourceFilter.h" |
6 | 6 |
7 #include "core/dom/Element.h" | 7 #include "core/dom/Element.h" |
8 #include "core/html/HTMLImageElement.h" | 8 #include "core/html/HTMLImageElement.h" |
9 #include "platform/testing/URLTestHelpers.h" | 9 #include "platform/testing/URLTestHelpers.h" |
10 #include "platform/testing/UnitTestHelpers.h" | 10 #include "platform/testing/UnitTestHelpers.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 ::testing::ElementsAre("/white-1x1.png")); | 128 ::testing::ElementsAre("/white-1x1.png")); |
129 } | 129 } |
130 | 130 |
131 TEST_F(WebDocumentSubresourceFilterTest, DisallowedSubresource) { | 131 TEST_F(WebDocumentSubresourceFilterTest, DisallowedSubresource) { |
132 loadDocument(false /* allowSubresources */); | 132 loadDocument(false /* allowSubresources */); |
133 expectSubresourceWasLoaded(false); | 133 expectSubresourceWasLoaded(false); |
134 } | 134 } |
135 | 135 |
136 TEST_F(WebDocumentSubresourceFilterTest, FilteringDecisionIsMadeLoadByLoad) { | 136 TEST_F(WebDocumentSubresourceFilterTest, FilteringDecisionIsMadeLoadByLoad) { |
137 for (const bool allowSubresources : {false, true}) { | 137 for (const bool allowSubresources : {false, true}) { |
138 SCOPED_TRACE(::testing::Message() << "First load allows subresources = " | 138 SCOPED_TRACE(::testing::Message() |
139 << allowSubresources); | 139 << "First load allows subresources = " << allowSubresources); |
140 | 140 |
141 loadDocument(allowSubresources); | 141 loadDocument(allowSubresources); |
142 expectSubresourceWasLoaded(allowSubresources); | 142 expectSubresourceWasLoaded(allowSubresources); |
143 | 143 |
144 loadDocument(!allowSubresources); | 144 loadDocument(!allowSubresources); |
145 expectSubresourceWasLoaded(!allowSubresources); | 145 expectSubresourceWasLoaded(!allowSubresources); |
146 EXPECT_THAT(queriedSubresourcePaths(), | 146 EXPECT_THAT(queriedSubresourcePaths(), |
147 ::testing::ElementsAre("/white-1x1.png")); | 147 ::testing::ElementsAre("/white-1x1.png")); |
148 | 148 |
149 WebCache::clear(); | 149 WebCache::clear(); |
150 } | 150 } |
151 } | 151 } |
152 | 152 |
153 } // namespace blink | 153 } // namespace blink |
OLD | NEW |