Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: third_party/WebKit/Source/core/loader/resource/MockFontResourceClient.cpp

Issue 2556683003: Reland: WebFonts cache-aware timeout adaptation (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698