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

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

Issue 1987413002: Add link preload as=document support Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: crash fix Created 4 years, 3 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 public: 159 public:
160 static ImageResourceTestMockFetchContext* create() 160 static ImageResourceTestMockFetchContext* create()
161 { 161 {
162 return new ImageResourceTestMockFetchContext; 162 return new ImageResourceTestMockFetchContext;
163 } 163 }
164 164
165 virtual ~ImageResourceTestMockFetchContext() { } 165 virtual ~ImageResourceTestMockFetchContext() { }
166 166
167 bool allowImage(bool imagesEnabled, const KURL&) const override { return tru e; } 167 bool allowImage(bool imagesEnabled, const KURL&) const override { return tru e; }
168 bool canRequest(Resource::Type, const ResourceRequest&, const KURL&, const R esourceLoaderOptions&, bool forPreload, FetchRequest::OriginRestriction) const o verride { return true; } 168 bool canRequest(Resource::Type, const ResourceRequest&, const KURL&, const R esourceLoaderOptions&, bool forPreload, FetchRequest::OriginRestriction) const o verride { return true; }
169 bool shouldLoadNewResource(Resource::Type) const override { return true; } 169 bool shouldLoadNewResource(Resource::Type, const WebURLRequest::FrameType) c onst override { return true; }
170 WebTaskRunner* loadingTaskRunner() const override { return m_runner.get(); } 170 WebTaskRunner* loadingTaskRunner() const override { return m_runner.get(); }
171 171
172 private: 172 private:
173 ImageResourceTestMockFetchContext() 173 ImageResourceTestMockFetchContext()
174 : m_runner(wrapUnique(new scheduler::FakeWebTaskRunner)) 174 : m_runner(wrapUnique(new scheduler::FakeWebTaskRunner))
175 { } 175 { }
176 176
177 std::unique_ptr<scheduler::FakeWebTaskRunner> m_runner; 177 std::unique_ptr<scheduler::FakeWebTaskRunner> m_runner;
178 }; 178 };
179 179
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 ImageResource* cachedImage = ImageResource::fetch(request, fetcher); 631 ImageResource* cachedImage = ImageResource::fetch(request, fetcher);
632 Platform::current()->getURLLoaderMockFactory()->unregisterURL(testURL); 632 Platform::current()->getURLLoaderMockFactory()->unregisterURL(testURL);
633 633
634 cachedImage->loader()->didReceiveResponse(nullptr, WrappedResourceResponse(R esourceResponse(testURL, "image/jpeg", 18, nullAtom, String())), nullptr); 634 cachedImage->loader()->didReceiveResponse(nullptr, WrappedResourceResponse(R esourceResponse(testURL, "image/jpeg", 18, nullAtom, String())), nullptr);
635 cachedImage->loader()->didReceiveData(nullptr, "notactuallyanimage", 18, 18, 18); 635 cachedImage->loader()->didReceiveData(nullptr, "notactuallyanimage", 18, 18, 18);
636 EXPECT_EQ(Resource::DecodeError, cachedImage->getStatus()); 636 EXPECT_EQ(Resource::DecodeError, cachedImage->getStatus());
637 EXPECT_FALSE(cachedImage->isLoading()); 637 EXPECT_FALSE(cachedImage->isLoading());
638 } 638 }
639 639
640 } // namespace blink 640 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/FetchRequest.h ('k') | third_party/WebKit/Source/core/fetch/RawResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698