| 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" |
| 34 #include "core/fetch/ImageResourceObserver.h" | 35 #include "core/fetch/ImageResourceObserver.h" |
| 35 #include "core/fetch/Resource.h" | 36 #include "core/fetch/Resource.h" |
| 36 #include "core/fetch/ResourceClient.h" | 37 #include "core/fetch/ResourceClient.h" |
| 37 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
| 38 | 39 |
| 39 namespace blink { | 40 namespace blink { |
| 40 | 41 |
| 41 class MockResourceClient : public GarbageCollectedFinalized<MockResourceClient>, | 42 class MockResourceClient : public GarbageCollectedFinalized<MockResourceClient>, |
| 42 public ResourceClient { | 43 public ResourceClient { |
| 43 USING_PRE_FINALIZER(MockResourceClient, dispose); | 44 USING_PRE_FINALIZER(MockResourceClient, dispose); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 return m_encodedSizeOnImageNotifyFinished; | 92 return m_encodedSizeOnImageNotifyFinished; |
| 92 } | 93 } |
| 93 | 94 |
| 94 private: | 95 private: |
| 95 int m_imageChangedCount; | 96 int m_imageChangedCount; |
| 96 size_t m_encodedSizeOnLastImageChanged; | 97 size_t m_encodedSizeOnLastImageChanged; |
| 97 int m_imageNotifyFinishedCount; | 98 int m_imageNotifyFinishedCount; |
| 98 size_t m_encodedSizeOnImageNotifyFinished; | 99 size_t m_encodedSizeOnImageNotifyFinished; |
| 99 }; | 100 }; |
| 100 | 101 |
| 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 |
| 101 } // namespace blink | 138 } // namespace blink |
| 102 | 139 |
| 103 #endif // MockResourceClients_h | 140 #endif // MockResourceClients_h |
| OLD | NEW |