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

Side by Side Diff: chrome/browser/font_family_cache_unittest.cc

Issue 1305213009: Componentize PrefSyncableService and support classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pref_service_syncable
Patch Set: Add missing dependency on //sync:test_support_sync_api for unit tests with gn Created 5 years, 3 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 "chrome/browser/font_family_cache.h" 5 #include "chrome/browser/font_family_cache.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/test/base/testing_pref_service_syncable.h"
9 #include "chrome/test/base/testing_profile.h" 8 #include "chrome/test/base/testing_profile.h"
9 #include "components/syncable_prefs/testing_pref_service_syncable.h"
10 #include "content/public/test/test_browser_thread_bundle.h" 10 #include "content/public/test/test_browser_thread_bundle.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace { 13 namespace {
14 14
15 class TestingFontFamilyCache : public FontFamilyCache { 15 class TestingFontFamilyCache : public FontFamilyCache {
16 public: 16 public:
17 explicit TestingFontFamilyCache(Profile* profile) 17 explicit TestingFontFamilyCache(Profile* profile)
18 : FontFamilyCache(profile), fetch_font_count_(0) {} 18 : FontFamilyCache(profile), fetch_font_count_(0) {}
19 ~TestingFontFamilyCache() override {} 19 ~TestingFontFamilyCache() override {}
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 EXPECT_EQ(font1, result); 68 EXPECT_EQ(font1, result);
69 EXPECT_EQ(1, cache.fetch_font_count_); 69 EXPECT_EQ(1, cache.fetch_font_count_);
70 70
71 // Changing the preferences invalidates the cache. 71 // Changing the preferences invalidates the cache.
72 prefs->SetString(pref_name.c_str(), font2.c_str()); 72 prefs->SetString(pref_name.c_str(), font2.c_str());
73 result = base::UTF16ToUTF8( 73 result = base::UTF16ToUTF8(
74 cache.FetchAndCacheFont(script.c_str(), map_name.c_str())); 74 cache.FetchAndCacheFont(script.c_str(), map_name.c_str()));
75 EXPECT_EQ(font2, result); 75 EXPECT_EQ(font2, result);
76 EXPECT_EQ(2, cache.fetch_font_count_); 76 EXPECT_EQ(2, cache.fetch_font_count_);
77 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698