OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/loader/resource/MockFontResourceClient.h" |
| 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 |
| 9 namespace blink { |
| 10 |
| 11 MockFontResourceClient::MockFontResourceClient(Resource* resource) |
| 12 : m_resource(resource), |
| 13 m_fontLoadShortLimitExceededCalled(false), |
| 14 m_fontLoadLongLimitExceededCalled(false) { |
| 15 ThreadState::current()->registerPreFinalizer(this); |
| 16 m_resource->addClient(this); |
| 17 } |
| 18 |
| 19 MockFontResourceClient::~MockFontResourceClient() {} |
| 20 |
| 21 void MockFontResourceClient::fontLoadShortLimitExceeded(FontResource*) { |
| 22 ASSERT_FALSE(m_fontLoadShortLimitExceededCalled); |
| 23 ASSERT_FALSE(m_fontLoadLongLimitExceededCalled); |
| 24 m_fontLoadShortLimitExceededCalled = true; |
| 25 } |
| 26 |
| 27 void MockFontResourceClient::fontLoadLongLimitExceeded(FontResource*) { |
| 28 ASSERT_TRUE(m_fontLoadShortLimitExceededCalled); |
| 29 ASSERT_FALSE(m_fontLoadLongLimitExceededCalled); |
| 30 m_fontLoadLongLimitExceededCalled = true; |
| 31 } |
| 32 |
| 33 void MockFontResourceClient::dispose() { |
| 34 if (m_resource) { |
| 35 m_resource->removeClient(this); |
| 36 m_resource = nullptr; |
| 37 } |
| 38 } |
| 39 |
| 40 } // namespace blink |
OLD | NEW |