diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/css/font_face_cache_test.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/css/font_face_cache_test.cc | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/chromium/third_party/blink/renderer/core/css/font_face_cache_test.cc b/chromium/third_party/blink/renderer/core/css/font_face_cache_test.cc index 98e6ca440b3..26ca0030ab5 100644 --- a/chromium/third_party/blink/renderer/core/css/font_face_cache_test.cc +++ b/chromium/third_party/blink/renderer/core/css/font_face_cache_test.cc @@ -41,9 +41,7 @@ class FontFaceCacheTest : public PageTestBase { FontSelectionValue style, FontSelectionValue weight); - FontFaceCache cache_; - - void Trace(Visitor*) const; + Persistent<FontFaceCache> cache_; protected: const AtomicString kFontNameForTesting{"Arial"}; @@ -51,11 +49,12 @@ class FontFaceCacheTest : public PageTestBase { void FontFaceCacheTest::SetUp() { PageTestBase::SetUp(); + cache_ = MakeGarbageCollected<FontFaceCache>(); ClearCache(); } void FontFaceCacheTest::ClearCache() { - cache_.ClearAll(); + cache_->ClearAll(); } void FontFaceCacheTest::AppendTestFaceForCapabilities(const CSSValue& stretch, @@ -83,7 +82,7 @@ void FontFaceCacheTest::AppendTestFaceForCapabilities(const CSSValue& stretch, MakeGarbageCollected<StyleRuleFontFace>(font_face_descriptor); FontFace* font_face = FontFace::Create(&GetDocument(), style_rule_font_face); CHECK(font_face); - cache_.Add(style_rule_font_face, font_face); + cache_->Add(style_rule_font_face, font_face); } void FontFaceCacheTest::AppendTestFaceForCapabilities( @@ -125,7 +124,7 @@ TEST_F(FontFaceCacheTest, Instantiate) { *weight_value); AppendTestFaceForCapabilities(*stretch_value_condensed, *style_value, *weight_value); - ASSERT_EQ(cache_.GetNumSegmentedFacesForTesting(), 2ul); + ASSERT_EQ(cache_->GetNumSegmentedFacesForTesting(), 2ul); } TEST_F(FontFaceCacheTest, SimpleWidthMatch) { @@ -141,12 +140,12 @@ TEST_F(FontFaceCacheTest, SimpleWidthMatch) { *weight_value); AppendTestFaceForCapabilities(*stretch_value_condensed, *style_value, *weight_value); - ASSERT_EQ(cache_.GetNumSegmentedFacesForTesting(), 2ul); + ASSERT_EQ(cache_->GetNumSegmentedFacesForTesting(), 2ul); const FontDescription& description_condensed = FontDescriptionForRequest( CondensedWidthValue(), NormalSlopeValue(), NormalWeightValue()); CSSSegmentedFontFace* result = - cache_.Get(description_condensed, kFontNameForTesting); + cache_->Get(description_condensed, kFontNameForTesting); ASSERT_TRUE(result); FontSelectionCapabilities result_capabilities = @@ -172,12 +171,12 @@ TEST_F(FontFaceCacheTest, SimpleWeightMatch) { CSSNumericLiteralValue::Create(100, CSSPrimitiveValue::UnitType::kNumber); AppendTestFaceForCapabilities(*stretch_value, *style_value, *weight_value_thin); - ASSERT_EQ(cache_.GetNumSegmentedFacesForTesting(), 2ul); + ASSERT_EQ(cache_->GetNumSegmentedFacesForTesting(), 2ul); const FontDescription& description_bold = FontDescriptionForRequest( NormalWidthValue(), NormalSlopeValue(), BoldWeightValue()); CSSSegmentedFontFace* result = - cache_.Get(description_bold, kFontNameForTesting); + cache_->Get(description_bold, kFontNameForTesting); ASSERT_TRUE(result); FontSelectionCapabilities result_capabilities = result->GetFontSelectionCapabilities(); @@ -272,7 +271,7 @@ TEST_F(FontFaceCacheTest, DISABLED_MatchCombinations) { } for (FontDescription& test_description : test_descriptions) { CSSSegmentedFontFace* result = - cache_.Get(test_description, kFontNameForTesting); + cache_->Get(test_description, kFontNameForTesting); ASSERT_TRUE(result); FontSelectionCapabilities result_capabilities = result->GetFontSelectionCapabilities(); @@ -315,12 +314,12 @@ TEST_F(FontFaceCacheTest, WidthRangeMatching) { AppendTestFaceForCapabilities(*stretch_value, *style_value, *second_weight_list); - ASSERT_EQ(cache_.GetNumSegmentedFacesForTesting(), 2ul); + ASSERT_EQ(cache_->GetNumSegmentedFacesForTesting(), 2ul); const FontDescription& description_bold = FontDescriptionForRequest( NormalWidthValue(), NormalSlopeValue(), BoldWeightValue()); CSSSegmentedFontFace* result = - cache_.Get(description_bold, kFontNameForTesting); + cache_->Get(description_bold, kFontNameForTesting); ASSERT_TRUE(result); FontSelectionCapabilities result_capabilities = result->GetFontSelectionCapabilities(); @@ -365,14 +364,14 @@ TEST_F(FontFaceCacheTest, WidthRangeMatchingBetween400500) { *(weight_values_lower[0]), *(weight_values_upper[0])); - ASSERT_EQ(cache_.GetNumSegmentedFacesForTesting(), 1ul); + ASSERT_EQ(cache_->GetNumSegmentedFacesForTesting(), 1ul); FontSelectionValue test_weight(450); const FontDescription& description_expanded = FontDescriptionForRequest( NormalWidthValue(), NormalSlopeValue(), test_weight); CSSSegmentedFontFace* result = - cache_.Get(description_expanded, kFontNameForTesting); + cache_->Get(description_expanded, kFontNameForTesting); ASSERT_TRUE(result); ASSERT_EQ(result->GetFontSelectionCapabilities().weight.minimum, FontSelectionValue(600)); @@ -380,9 +379,9 @@ TEST_F(FontFaceCacheTest, WidthRangeMatchingBetween400500) { AppendTestFaceForCapabilities(*stretch_value, *style_value, *(weight_values_lower[1]), *(weight_values_upper[1])); - ASSERT_EQ(cache_.GetNumSegmentedFacesForTesting(), 2ul); + ASSERT_EQ(cache_->GetNumSegmentedFacesForTesting(), 2ul); - result = cache_.Get(description_expanded, kFontNameForTesting); + result = cache_->Get(description_expanded, kFontNameForTesting); ASSERT_TRUE(result); ASSERT_EQ(result->GetFontSelectionCapabilities().weight.minimum, FontSelectionValue(415)); @@ -390,9 +389,9 @@ TEST_F(FontFaceCacheTest, WidthRangeMatchingBetween400500) { AppendTestFaceForCapabilities(*stretch_value, *style_value, *(weight_values_lower[2]), *(weight_values_upper[2])); - ASSERT_EQ(cache_.GetNumSegmentedFacesForTesting(), 3ul); + ASSERT_EQ(cache_->GetNumSegmentedFacesForTesting(), 3ul); - result = cache_.Get(description_expanded, kFontNameForTesting); + result = cache_->Get(description_expanded, kFontNameForTesting); ASSERT_TRUE(result); ASSERT_EQ(result->GetFontSelectionCapabilities().weight.minimum, FontSelectionValue(475)); @@ -424,12 +423,12 @@ TEST_F(FontFaceCacheTest, StretchRangeMatching) { AppendTestFaceForCapabilities(*second_stretch_list, *style_value, *weight_value); - ASSERT_EQ(cache_.GetNumSegmentedFacesForTesting(), 2ul); + ASSERT_EQ(cache_->GetNumSegmentedFacesForTesting(), 2ul); const FontDescription& description_expanded = FontDescriptionForRequest( FontSelectionValue(105), NormalSlopeValue(), NormalWeightValue()); CSSSegmentedFontFace* result = - cache_.Get(description_expanded, kFontNameForTesting); + cache_->Get(description_expanded, kFontNameForTesting); ASSERT_TRUE(result); FontSelectionCapabilities result_capabilities = result->GetFontSelectionCapabilities(); @@ -477,12 +476,12 @@ TEST_F(FontFaceCacheTest, ObliqueRangeMatching) { AppendTestFaceForCapabilities(*stretch_value, *oblique_value_second, *weight_value); - ASSERT_EQ(cache_.GetNumSegmentedFacesForTesting(), 2ul); + ASSERT_EQ(cache_->GetNumSegmentedFacesForTesting(), 2ul); const FontDescription& description_italic = FontDescriptionForRequest( NormalWidthValue(), ItalicSlopeValue(), NormalWeightValue()); CSSSegmentedFontFace* result = - cache_.Get(description_italic, kFontNameForTesting); + cache_->Get(description_italic, kFontNameForTesting); ASSERT_TRUE(result); FontSelectionCapabilities result_capabilities = result->GetFontSelectionCapabilities(); @@ -495,8 +494,4 @@ TEST_F(FontFaceCacheTest, ObliqueRangeMatching) { FontSelectionRange({FontSelectionValue(30), FontSelectionValue(35)})); } -void FontFaceCacheTest::Trace(Visitor* visitor) const { - visitor->Trace(cache_); -} - } // namespace blink |