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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |