| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef MockResourceClients_h | 31 #ifndef MockResourceClients_h |
| 32 #define MockResourceClients_h | 32 #define MockResourceClients_h |
| 33 | 33 |
| 34 #include "core/fetch/FontResource.h" | |
| 35 #include "core/fetch/ImageResourceObserver.h" | 34 #include "core/fetch/ImageResourceObserver.h" |
| 36 #include "core/fetch/Resource.h" | 35 #include "core/fetch/Resource.h" |
| 37 #include "core/fetch/ResourceClient.h" | 36 #include "core/fetch/ResourceClient.h" |
| 38 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
| 39 | 38 |
| 40 namespace blink { | 39 namespace blink { |
| 41 | 40 |
| 42 class MockResourceClient : public GarbageCollectedFinalized<MockResourceClient>, | 41 class MockResourceClient : public GarbageCollectedFinalized<MockResourceClient>, |
| 43 public ResourceClient { | 42 public ResourceClient { |
| 44 USING_PRE_FINALIZER(MockResourceClient, dispose); | 43 USING_PRE_FINALIZER(MockResourceClient, dispose); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 return m_encodedSizeOnImageNotifyFinished; | 91 return m_encodedSizeOnImageNotifyFinished; |
| 93 } | 92 } |
| 94 | 93 |
| 95 private: | 94 private: |
| 96 int m_imageChangedCount; | 95 int m_imageChangedCount; |
| 97 size_t m_encodedSizeOnLastImageChanged; | 96 size_t m_encodedSizeOnLastImageChanged; |
| 98 int m_imageNotifyFinishedCount; | 97 int m_imageNotifyFinishedCount; |
| 99 size_t m_encodedSizeOnImageNotifyFinished; | 98 size_t m_encodedSizeOnImageNotifyFinished; |
| 100 }; | 99 }; |
| 101 | 100 |
| 102 class MockFontResourceClient final | |
| 103 : public GarbageCollectedFinalized<MockFontResourceClient>, | |
| 104 public FontResourceClient { | |
| 105 USING_PRE_FINALIZER(MockFontResourceClient, dispose); | |
| 106 USING_GARBAGE_COLLECTED_MIXIN(MockFontResourceClient); | |
| 107 | |
| 108 public: | |
| 109 explicit MockFontResourceClient(Resource*); | |
| 110 ~MockFontResourceClient() override; | |
| 111 | |
| 112 void fontLoadShortLimitExceeded(FontResource*) override; | |
| 113 void fontLoadLongLimitExceeded(FontResource*) override; | |
| 114 | |
| 115 bool fontLoadShortLimitExceededCalled() const { | |
| 116 return m_fontLoadShortLimitExceededCalled; | |
| 117 } | |
| 118 | |
| 119 bool fontLoadLongLimitExceededCalled() const { | |
| 120 return m_fontLoadLongLimitExceededCalled; | |
| 121 } | |
| 122 | |
| 123 DEFINE_INLINE_TRACE() { | |
| 124 visitor->trace(m_resource); | |
| 125 FontResourceClient::trace(visitor); | |
| 126 } | |
| 127 | |
| 128 String debugName() const override { return "MockFontResourceClient"; } | |
| 129 | |
| 130 private: | |
| 131 void dispose(); | |
| 132 | |
| 133 Member<Resource> m_resource; | |
| 134 bool m_fontLoadShortLimitExceededCalled; | |
| 135 bool m_fontLoadLongLimitExceededCalled; | |
| 136 }; | |
| 137 | |
| 138 } // namespace blink | 101 } // namespace blink |
| 139 | 102 |
| 140 #endif // MockResourceClients_h | 103 #endif // MockResourceClients_h |
| OLD | NEW |