Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: third_party/WebKit/Source/core/loader/resource/ImageResourceTest.cpp

Issue 2676163002: Refactor the forPreload flag to mean speculative preload. (Closed)
Patch Set: Renamed ReportingPolicy and moved comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 virtual ~ImageResourceTestMockFetchContext() {} 176 virtual ~ImageResourceTestMockFetchContext() {}
177 177
178 bool allowImage(bool imagesEnabled, const KURL&) const override { 178 bool allowImage(bool imagesEnabled, const KURL&) const override {
179 return true; 179 return true;
180 } 180 }
181 ResourceRequestBlockedReason canRequest( 181 ResourceRequestBlockedReason canRequest(
182 Resource::Type, 182 Resource::Type,
183 const ResourceRequest&, 183 const ResourceRequest&,
184 const KURL&, 184 const KURL&,
185 const ResourceLoaderOptions&, 185 const ResourceLoaderOptions&,
186 bool forPreload, 186 SecurityViolationReportingPolicy,
187 FetchRequest::OriginRestriction) const override { 187 FetchRequest::OriginRestriction) const override {
188 return ResourceRequestBlockedReason::None; 188 return ResourceRequestBlockedReason::None;
189 } 189 }
190 bool shouldLoadNewResource(Resource::Type) const override { return true; } 190 bool shouldLoadNewResource(Resource::Type) const override { return true; }
191 RefPtr<WebTaskRunner> loadingTaskRunner() const override { return m_runner; } 191 RefPtr<WebTaskRunner> loadingTaskRunner() const override { return m_runner; }
192 192
193 private: 193 private:
194 ImageResourceTestMockFetchContext() 194 ImageResourceTestMockFetchContext()
195 : m_runner(adoptRef(new scheduler::FakeWebTaskRunner)) {} 195 : m_runner(adoptRef(new scheduler::FakeWebTaskRunner)) {}
196 196
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 EXPECT_TRUE(observer->imageNotifyFinishedCalled()); 1269 EXPECT_TRUE(observer->imageNotifyFinishedCalled());
1270 EXPECT_TRUE(imageResource->getContent()->getImage()->isBitmapImage()); 1270 EXPECT_TRUE(imageResource->getContent()->getImage()->isBitmapImage());
1271 EXPECT_EQ(50, imageResource->getContent()->getImage()->width()); 1271 EXPECT_EQ(50, imageResource->getContent()->getImage()->width());
1272 EXPECT_EQ(50, imageResource->getContent()->getImage()->height()); 1272 EXPECT_EQ(50, imageResource->getContent()->getImage()->height());
1273 1273
1274 WTF::setTimeFunctionsForTesting(nullptr); 1274 WTF::setTimeFunctionsForTesting(nullptr);
1275 } 1275 }
1276 1276
1277 } // namespace 1277 } // namespace
1278 } // namespace blink 1278 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698