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

Side by Side Diff: third_party/WebKit/Source/core/fetch/MockResourceClients.cpp

Issue 2453813004: WebFonts cache-aware timeout adaptation (Closed)
Patch Set: rebase Created 4 years, 1 month 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/fetch/MockResourceClients.h" 5 #include "core/fetch/MockResourceClients.h"
6 6
7 #include "core/fetch/ImageResource.h" 7 #include "core/fetch/ImageResource.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 m_imageNotifyFinishedCount++; 75 m_imageNotifyFinishedCount++;
76 m_encodedSizeOnImageNotifyFinished = image->encodedSize(); 76 m_encodedSizeOnImageNotifyFinished = image->encodedSize();
77 } 77 }
78 78
79 bool MockImageResourceClient::notifyFinishedCalled() const { 79 bool MockImageResourceClient::notifyFinishedCalled() const {
80 EXPECT_EQ(m_notifyFinishedCalled ? 1 : 0, m_imageNotifyFinishedCount); 80 EXPECT_EQ(m_notifyFinishedCalled ? 1 : 0, m_imageNotifyFinishedCount);
81 81
82 return m_notifyFinishedCalled; 82 return m_notifyFinishedCalled;
83 } 83 }
84 84
85 MockFontResourceClient::MockFontResourceClient(Resource* resource)
86 : m_resource(resource),
87 m_fontLoadShortLimitExceededCalled(false),
88 m_fontLoadLongLimitExceededCalled(false) {
89 ThreadState::current()->registerPreFinalizer(this);
90 m_resource->addClient(this);
91 }
92
93 MockFontResourceClient::~MockFontResourceClient() {}
94
95 void MockFontResourceClient::fontLoadShortLimitExceeded(FontResource*) {
96 ASSERT_FALSE(m_fontLoadShortLimitExceededCalled);
97 ASSERT_FALSE(m_fontLoadLongLimitExceededCalled);
98 m_fontLoadShortLimitExceededCalled = true;
99 }
100
101 void MockFontResourceClient::fontLoadLongLimitExceeded(FontResource*) {
102 ASSERT_TRUE(m_fontLoadShortLimitExceededCalled);
103 ASSERT_FALSE(m_fontLoadLongLimitExceededCalled);
104 m_fontLoadLongLimitExceededCalled = true;
105 }
106
107 void MockFontResourceClient::dispose() {
108 if (m_resource) {
109 m_resource->removeClient(this);
110 m_resource = nullptr;
111 }
112 }
113
85 } // namespace blink 114 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698