| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 imageResource->finish(); | 152 imageResource->finish(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 class MockTaskRunner : public blink::WebTaskRunner { | 155 class MockTaskRunner : public blink::WebTaskRunner { |
| 156 void postTask(const WebTraceLocation&, Task*) override { } | 156 void postTask(const WebTraceLocation&, Task*) override { } |
| 157 void postDelayedTask(const WebTraceLocation&, Task*, double) override { } | 157 void postDelayedTask(const WebTraceLocation&, Task*, double) override { } |
| 158 bool runsTasksOnCurrentThread() override { return true; } | 158 bool runsTasksOnCurrentThread() override { return true; } |
| 159 std::unique_ptr<WebTaskRunner> clone() override { return nullptr; } | 159 std::unique_ptr<WebTaskRunner> clone() override { return nullptr; } |
| 160 double virtualTimeSeconds() const override { return 0.0; } | 160 double virtualTimeSeconds() const override { return 0.0; } |
| 161 double monotonicallyIncreasingVirtualTimeSeconds() const override { return 0
.0; } | 161 double monotonicallyIncreasingVirtualTimeSeconds() const override { return 0
.0; } |
| 162 SingleThreadTaskRunner* taskRunner() override { return nullptr; } |
| 162 }; | 163 }; |
| 163 | 164 |
| 164 } | 165 } |
| 165 | 166 |
| 166 class ImageResourceTestMockFetchContext : public FetchContext { | 167 class ImageResourceTestMockFetchContext : public FetchContext { |
| 167 public: | 168 public: |
| 168 static ImageResourceTestMockFetchContext* create() | 169 static ImageResourceTestMockFetchContext* create() |
| 169 { | 170 { |
| 170 return new ImageResourceTestMockFetchContext; | 171 return new ImageResourceTestMockFetchContext; |
| 171 } | 172 } |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 ImageResource* cachedImage = ImageResource::fetch(request, fetcher); | 640 ImageResource* cachedImage = ImageResource::fetch(request, fetcher); |
| 640 Platform::current()->getURLLoaderMockFactory()->unregisterURL(testURL); | 641 Platform::current()->getURLLoaderMockFactory()->unregisterURL(testURL); |
| 641 | 642 |
| 642 cachedImage->loader()->didReceiveResponse(nullptr, WrappedResourceResponse(R
esourceResponse(testURL, "image/jpeg", 18, nullAtom, String())), nullptr); | 643 cachedImage->loader()->didReceiveResponse(nullptr, WrappedResourceResponse(R
esourceResponse(testURL, "image/jpeg", 18, nullAtom, String())), nullptr); |
| 643 cachedImage->loader()->didReceiveData(nullptr, "notactuallyanimage", 18, 18,
18); | 644 cachedImage->loader()->didReceiveData(nullptr, "notactuallyanimage", 18, 18,
18); |
| 644 EXPECT_EQ(Resource::DecodeError, cachedImage->getStatus()); | 645 EXPECT_EQ(Resource::DecodeError, cachedImage->getStatus()); |
| 645 EXPECT_FALSE(cachedImage->isLoading()); | 646 EXPECT_FALSE(cachedImage->isLoading()); |
| 646 } | 647 } |
| 647 | 648 |
| 648 } // namespace blink | 649 } // namespace blink |
| OLD | NEW |