Index: third_party/WebKit/Source/core/fetch/MockResourceClients.h |
diff --git a/third_party/WebKit/Source/core/fetch/MockResourceClients.h b/third_party/WebKit/Source/core/fetch/MockResourceClients.h |
index f5a6313c81af8c16740fc0b35c9dc3581e35827d..b6c9c723cdfd8dd4f5f34db71e99a4cfd0e20da8 100644 |
--- a/third_party/WebKit/Source/core/fetch/MockResourceClients.h |
+++ b/third_party/WebKit/Source/core/fetch/MockResourceClients.h |
@@ -31,6 +31,7 @@ |
#ifndef MockResourceClients_h |
#define MockResourceClients_h |
+#include "core/fetch/FontResource.h" |
#include "core/fetch/ImageResourceObserver.h" |
#include "core/fetch/Resource.h" |
#include "core/fetch/ResourceClient.h" |
@@ -98,6 +99,43 @@ class MockImageResourceClient final : public MockResourceClient, |
size_t m_encodedSizeOnImageNotifyFinished; |
}; |
+class MockFontResourceClient final |
+ : public GarbageCollectedFinalized<MockFontResourceClient>, |
+ public FontResourceClient { |
+ USING_PRE_FINALIZER(MockFontResourceClient, dispose); |
+ USING_GARBAGE_COLLECTED_MIXIN(MockFontResourceClient); |
+ |
+ public: |
+ explicit MockFontResourceClient(Resource*); |
+ ~MockFontResourceClient() override; |
+ |
+ void fontLoadShortLimitExceeded(FontResource*) override; |
+ void fontLoadLongLimitExceeded(FontResource*) override; |
+ |
+ bool fontLoadShortLimitExceededCalled() const { |
+ return m_fontLoadShortLimitExceededCalled; |
+ } |
+ |
+ bool fontLoadLongLimitExceededCalled() const { |
+ return m_fontLoadLongLimitExceededCalled; |
+ } |
+ |
+ void removeAsClient(); |
yhirano
2016/11/09 07:29:52
The only caller is dispose(). Can you remove this
Shao-Chuan Lee
2016/11/09 08:04:31
Done.
|
+ void dispose(); |
yhirano
2016/11/09 07:29:52
Can this function be private?
Shao-Chuan Lee
2016/11/09 08:04:31
Done. Didn't notice pre-finalizers can be private.
|
+ |
+ DEFINE_INLINE_TRACE() { |
+ visitor->trace(m_resource); |
+ FontResourceClient::trace(visitor); |
+ } |
+ |
+ String debugName() const override { return "MockFontResourceClient"; } |
+ |
+ protected: |
yhirano
2016/11/09 07:29:52
private
Shao-Chuan Lee
2016/11/09 08:04:31
Done.
|
+ Member<Resource> m_resource; |
+ bool m_fontLoadShortLimitExceededCalled; |
+ bool m_fontLoadLongLimitExceededCalled; |
+}; |
+ |
} // namespace blink |
#endif // MockResourceClients_h |