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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 ResourceRequestBlockedReason canRequest( | 175 ResourceRequestBlockedReason canRequest( |
176 Resource::Type, | 176 Resource::Type, |
177 const ResourceRequest&, | 177 const ResourceRequest&, |
178 const KURL&, | 178 const KURL&, |
179 const ResourceLoaderOptions&, | 179 const ResourceLoaderOptions&, |
180 bool forPreload, | 180 bool forPreload, |
181 FetchRequest::OriginRestriction) const override { | 181 FetchRequest::OriginRestriction) const override { |
182 return ResourceRequestBlockedReason::None; | 182 return ResourceRequestBlockedReason::None; |
183 } | 183 } |
184 bool shouldLoadNewResource(Resource::Type) const override { return true; } | 184 bool shouldLoadNewResource(Resource::Type) const override { return true; } |
185 WebTaskRunner* loadingTaskRunner() const override { return m_runner.get(); } | 185 RefPtr<WebTaskRunner> loadingTaskRunner() const override { return m_runner; } |
186 | 186 |
187 private: | 187 private: |
188 ImageResourceTestMockFetchContext() | 188 ImageResourceTestMockFetchContext() |
189 : m_runner(WTF::wrapUnique(new scheduler::FakeWebTaskRunner)) {} | 189 : m_runner(adoptRef(new scheduler::FakeWebTaskRunner)) {} |
190 | 190 |
191 std::unique_ptr<scheduler::FakeWebTaskRunner> m_runner; | 191 RefPtr<scheduler::FakeWebTaskRunner> m_runner; |
192 }; | 192 }; |
193 | 193 |
194 // Convenience class that registers a mocked URL load on construction, and | 194 // Convenience class that registers a mocked URL load on construction, and |
195 // unregisters it on destruction. This allows for a test to use constructs like | 195 // unregisters it on destruction. This allows for a test to use constructs like |
196 // ASSERT_TRUE() without needing to worry about unregistering the mocked URL | 196 // ASSERT_TRUE() without needing to worry about unregistering the mocked URL |
197 // load to avoid putting other tests into inconsistent states in case the | 197 // load to avoid putting other tests into inconsistent states in case the |
198 // assertion fails. | 198 // assertion fails. |
199 class ScopedRegisteredURL { | 199 class ScopedRegisteredURL { |
200 public: | 200 public: |
201 ScopedRegisteredURL(const KURL& url, | 201 ScopedRegisteredURL(const KURL& url, |
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 EXPECT_TRUE(client->notifyFinishedCalled()); | 1241 EXPECT_TRUE(client->notifyFinishedCalled()); |
1242 EXPECT_TRUE(imageResource->getContent()->getImage()->isBitmapImage()); | 1242 EXPECT_TRUE(imageResource->getContent()->getImage()->isBitmapImage()); |
1243 EXPECT_EQ(50, imageResource->getContent()->getImage()->width()); | 1243 EXPECT_EQ(50, imageResource->getContent()->getImage()->width()); |
1244 EXPECT_EQ(50, imageResource->getContent()->getImage()->height()); | 1244 EXPECT_EQ(50, imageResource->getContent()->getImage()->height()); |
1245 | 1245 |
1246 WTF::setTimeFunctionsForTesting(nullptr); | 1246 WTF::setTimeFunctionsForTesting(nullptr); |
1247 } | 1247 } |
1248 | 1248 |
1249 } // namespace | 1249 } // namespace |
1250 } // namespace blink | 1250 } // namespace blink |
OLD | NEW |