| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/gfx/font_fallback_win.h" | 5 #include "ui/gfx/font_fallback_win.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 | 7 |
| 8 namespace gfx { | 8 namespace gfx { |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| 11 | 11 |
| 12 // Subclass of LinkedFontsIterator for testing that allows mocking the linked | 12 // Subclass of LinkedFontsIterator for testing that allows mocking the linked |
| 13 // fonts vector. | 13 // fonts vector. |
| 14 class TestLinkedFontsIterator : public internal::LinkedFontsIterator { | 14 class TestLinkedFontsIterator : public internal::LinkedFontsIterator { |
| 15 public: | 15 public: |
| 16 explicit TestLinkedFontsIterator(Font font) : LinkedFontsIterator(font) { | 16 explicit TestLinkedFontsIterator(Font font) : LinkedFontsIterator(font) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 virtual ~TestLinkedFontsIterator() { | 19 virtual ~TestLinkedFontsIterator() { |
| 20 } | 20 } |
| 21 | 21 |
| 22 // Add a linked font to the mocked vector of linked fonts. | 22 // Add a linked font to the mocked vector of linked fonts. |
| 23 void AddLinkedFontForTesting(Font font) { | 23 void AddLinkedFontForTesting(Font font) { |
| 24 test_linked_fonts.push_back(font); | 24 test_linked_fonts.push_back(font); |
| 25 } | 25 } |
| 26 | 26 |
| 27 virtual const std::vector<Font>* GetLinkedFonts() const OVERRIDE { | 27 virtual const std::vector<Font>* GetLinkedFonts() const override { |
| 28 return &test_linked_fonts; | 28 return &test_linked_fonts; |
| 29 } | 29 } |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 std::vector<Font> test_linked_fonts; | 32 std::vector<Font> test_linked_fonts; |
| 33 | 33 |
| 34 DISALLOW_COPY_AND_ASSIGN(TestLinkedFontsIterator); | 34 DISALLOW_COPY_AND_ASSIGN(TestLinkedFontsIterator); |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 } // namespace | 37 } // namespace |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 EXPECT_TRUE(iterator.NextFont(&font)); | 108 EXPECT_TRUE(iterator.NextFont(&font)); |
| 109 ASSERT_EQ("Tahoma", font.GetFontName()); | 109 ASSERT_EQ("Tahoma", font.GetFontName()); |
| 110 | 110 |
| 111 EXPECT_TRUE(iterator.NextFont(&font)); | 111 EXPECT_TRUE(iterator.NextFont(&font)); |
| 112 ASSERT_EQ("Times New Roman", font.GetFontName()); | 112 ASSERT_EQ("Times New Roman", font.GetFontName()); |
| 113 | 113 |
| 114 EXPECT_FALSE(iterator.NextFont(&font)); | 114 EXPECT_FALSE(iterator.NextFont(&font)); |
| 115 } | 115 } |
| 116 | 116 |
| 117 } // namespace gfx | 117 } // namespace gfx |
| OLD | NEW |