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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/FontCacheTest.cpp

Issue 2588403002: TestingPlatformSupport: register Platform instance correctly (Closed)
Patch Set: review #32 Created 3 years, 11 months 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "platform/fonts/FontCache.h" 5 #include "platform/fonts/FontCache.h"
6 6
7 #include "platform/fonts/FontDescription.h" 7 #include "platform/fonts/FontDescription.h"
8 #include "platform/fonts/SimpleFontData.h" 8 #include "platform/fonts/SimpleFontData.h"
9 #include "platform/testing/TestingPlatformSupport.h" 9 #include "platform/testing/TestingPlatformSupport.h"
10 #include "public/platform/Platform.h" 10 #include "public/platform/Platform.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class EmptyPlatform : public TestingPlatformSupport {
16 public:
17 EmptyPlatform() {}
18 ~EmptyPlatform() override {}
19 };
20
21 TEST(FontCache, getLastResortFallbackFont) { 15 TEST(FontCache, getLastResortFallbackFont) {
22 FontCache* fontCache = FontCache::fontCache(); 16 FontCache* fontCache = FontCache::fontCache();
23 ASSERT_TRUE(fontCache); 17 ASSERT_TRUE(fontCache);
24 18
25 EmptyPlatform platform;
26
27 FontDescription fontDescription; 19 FontDescription fontDescription;
28 fontDescription.setGenericFamily(FontDescription::StandardFamily); 20 fontDescription.setGenericFamily(FontDescription::StandardFamily);
29 RefPtr<SimpleFontData> fontData = 21 RefPtr<SimpleFontData> fontData =
30 fontCache->getLastResortFallbackFont(fontDescription, Retain); 22 fontCache->getLastResortFallbackFont(fontDescription, Retain);
31 EXPECT_TRUE(fontData); 23 EXPECT_TRUE(fontData);
32 24
33 fontDescription.setGenericFamily(FontDescription::SansSerifFamily); 25 fontDescription.setGenericFamily(FontDescription::SansSerifFamily);
34 fontData = fontCache->getLastResortFallbackFont(fontDescription, Retain); 26 fontData = fontCache->getLastResortFallbackFont(fontDescription, Retain);
35 EXPECT_TRUE(fontData); 27 EXPECT_TRUE(fontData);
36 } 28 }
(...skipping 12 matching lines...) Expand all
49 41
50 EXPECT_EQ("not exist", 42 EXPECT_EQ("not exist",
51 FontCache::firstAvailableOrFirst("not exist, not exist 2")); 43 FontCache::firstAvailableOrFirst("not exist, not exist 2"));
52 44
53 EXPECT_EQ("Arial", FontCache::firstAvailableOrFirst(", not exist, Arial")); 45 EXPECT_EQ("Arial", FontCache::firstAvailableOrFirst(", not exist, Arial"));
54 EXPECT_EQ("not exist", 46 EXPECT_EQ("not exist",
55 FontCache::firstAvailableOrFirst(", not exist, not exist")); 47 FontCache::firstAvailableOrFirst(", not exist, not exist"));
56 } 48 }
57 49
58 } // namespace blink 50 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698