| OLD | NEW |
| 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 "chrome/browser/font_family_cache.h" | 5 #include "chrome/browser/font_family_cache.h" |
| 6 | 6 |
| 7 #include "base/macros.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
| 9 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 10 #include "components/syncable_prefs/testing_pref_service_syncable.h" |
| 10 #include "content/public/test/test_browser_thread_bundle.h" | 11 #include "content/public/test/test_browser_thread_bundle.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 13 namespace { | 14 namespace { |
| 14 | 15 |
| 15 class TestingFontFamilyCache : public FontFamilyCache { | 16 class TestingFontFamilyCache : public FontFamilyCache { |
| 16 public: | 17 public: |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 EXPECT_EQ(font1, result); | 70 EXPECT_EQ(font1, result); |
| 70 EXPECT_EQ(1, cache.fetch_font_count_); | 71 EXPECT_EQ(1, cache.fetch_font_count_); |
| 71 | 72 |
| 72 // Changing the preferences invalidates the cache. | 73 // Changing the preferences invalidates the cache. |
| 73 prefs->SetString(pref_name.c_str(), font2.c_str()); | 74 prefs->SetString(pref_name.c_str(), font2.c_str()); |
| 74 result = base::UTF16ToUTF8( | 75 result = base::UTF16ToUTF8( |
| 75 cache.FetchAndCacheFont(script.c_str(), map_name.c_str())); | 76 cache.FetchAndCacheFont(script.c_str(), map_name.c_str())); |
| 76 EXPECT_EQ(font2, result); | 77 EXPECT_EQ(font2, result); |
| 77 EXPECT_EQ(2, cache.fetch_font_count_); | 78 EXPECT_EQ(2, cache.fetch_font_count_); |
| 78 } | 79 } |
| OLD | NEW |