| Index: third_party/WebKit/Source/core/fetch/MockResourceClients.cpp
|
| diff --git a/third_party/WebKit/Source/core/fetch/MockResourceClients.cpp b/third_party/WebKit/Source/core/fetch/MockResourceClients.cpp
|
| index bc597055ccb2065913e9e3ca1638d540cc52aeb5..61e59250079cac379a8740ad6edd588b0ba2a988 100644
|
| --- a/third_party/WebKit/Source/core/fetch/MockResourceClients.cpp
|
| +++ b/third_party/WebKit/Source/core/fetch/MockResourceClients.cpp
|
| @@ -82,4 +82,36 @@ bool MockImageResourceClient::notifyFinishedCalled() const {
|
| return m_notifyFinishedCalled;
|
| }
|
|
|
| +MockFontResourceClient::MockFontResourceClient(Resource* resource)
|
| + : m_resource(resource),
|
| + m_fontLoadShortLimitExceededCalled(false),
|
| + m_fontLoadLongLimitExceededCalled(false) {
|
| + ThreadState::current()->registerPreFinalizer(this);
|
| + m_resource->addClient(this);
|
| +}
|
| +
|
| +MockFontResourceClient::~MockFontResourceClient() {}
|
| +
|
| +void MockFontResourceClient::fontLoadShortLimitExceeded(FontResource*) {
|
| + ASSERT_FALSE(m_fontLoadShortLimitExceededCalled);
|
| + ASSERT_FALSE(m_fontLoadLongLimitExceededCalled);
|
| + m_fontLoadShortLimitExceededCalled = true;
|
| +}
|
| +
|
| +void MockFontResourceClient::fontLoadLongLimitExceeded(FontResource*) {
|
| + ASSERT_TRUE(m_fontLoadShortLimitExceededCalled);
|
| + ASSERT_FALSE(m_fontLoadLongLimitExceededCalled);
|
| + m_fontLoadLongLimitExceededCalled = true;
|
| +}
|
| +
|
| +void MockFontResourceClient::removeAsClient() {
|
| + m_resource->removeClient(this);
|
| + m_resource = nullptr;
|
| +}
|
| +
|
| +void MockFontResourceClient::dispose() {
|
| + if (m_resource)
|
| + removeAsClient();
|
| +}
|
| +
|
| } // namespace blink
|
|
|