OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 const ResourceLoaderOptions&, | 178 const ResourceLoaderOptions&, |
179 bool forPreload, | 179 bool forPreload, |
180 FetchRequest::OriginRestriction) const override { | 180 FetchRequest::OriginRestriction) const override { |
181 return ResourceRequestBlockedReason::None; | 181 return ResourceRequestBlockedReason::None; |
182 } | 182 } |
183 bool shouldLoadNewResource(Resource::Type) const override { return true; } | 183 bool shouldLoadNewResource(Resource::Type) const override { return true; } |
184 WebTaskRunner* loadingTaskRunner() const override { return m_runner.get(); } | 184 WebTaskRunner* loadingTaskRunner() const override { return m_runner.get(); } |
185 | 185 |
186 private: | 186 private: |
187 ImageResourceTestMockFetchContext() | 187 ImageResourceTestMockFetchContext() |
188 : m_runner(wrapUnique(new scheduler::FakeWebTaskRunner)) {} | 188 : m_runner(WTF::wrapUnique(new scheduler::FakeWebTaskRunner)) {} |
189 | 189 |
190 std::unique_ptr<scheduler::FakeWebTaskRunner> m_runner; | 190 std::unique_ptr<scheduler::FakeWebTaskRunner> m_runner; |
191 }; | 191 }; |
192 | 192 |
193 // Convenience class that registers a mocked URL load on construction, and | 193 // Convenience class that registers a mocked URL load on construction, and |
194 // unregisters it on destruction. This allows for a test to use constructs like | 194 // unregisters it on destruction. This allows for a test to use constructs like |
195 // ASSERT_TRUE() without needing to worry about unregistering the mocked URL | 195 // ASSERT_TRUE() without needing to worry about unregistering the mocked URL |
196 // load to avoid putting other tests into inconsistent states in case the | 196 // load to avoid putting other tests into inconsistent states in case the |
197 // assertion fails. | 197 // assertion fails. |
198 class ScopedRegisteredURL { | 198 class ScopedRegisteredURL { |
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 EXPECT_TRUE(client->notifyFinishedCalled()); | 1213 EXPECT_TRUE(client->notifyFinishedCalled()); |
1214 EXPECT_TRUE(cachedImage->getImage()->isBitmapImage()); | 1214 EXPECT_TRUE(cachedImage->getImage()->isBitmapImage()); |
1215 EXPECT_EQ(50, cachedImage->getImage()->width()); | 1215 EXPECT_EQ(50, cachedImage->getImage()->width()); |
1216 EXPECT_EQ(50, cachedImage->getImage()->height()); | 1216 EXPECT_EQ(50, cachedImage->getImage()->height()); |
1217 | 1217 |
1218 WTF::setTimeFunctionsForTesting(nullptr); | 1218 WTF::setTimeFunctionsForTesting(nullptr); |
1219 } | 1219 } |
1220 | 1220 |
1221 } // namespace | 1221 } // namespace |
1222 } // namespace blink | 1222 } // namespace blink |
OLD | NEW |