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 "components/dom_distiller/core/distilled_page_prefs.h" | 5 #include "components/dom_distiller/core/distilled_page_prefs.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "components/pref_registry/testing_pref_service_syncable.h" | 9 #include "components/pref_registry/testing_pref_service_syncable.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 private: | 34 private: |
35 DistilledPagePrefs::FontFamily font_; | 35 DistilledPagePrefs::FontFamily font_; |
36 DistilledPagePrefs::Theme theme_; | 36 DistilledPagePrefs::Theme theme_; |
37 }; | 37 }; |
38 | 38 |
39 } // namespace | 39 } // namespace |
40 | 40 |
41 class DistilledPagePrefsTest : public testing::Test { | 41 class DistilledPagePrefsTest : public testing::Test { |
42 protected: | 42 protected: |
43 virtual void SetUp() override { | 43 void SetUp() override { |
44 pref_service_.reset(new user_prefs::TestingPrefServiceSyncable()); | 44 pref_service_.reset(new user_prefs::TestingPrefServiceSyncable()); |
45 DistilledPagePrefs::RegisterProfilePrefs(pref_service_->registry()); | 45 DistilledPagePrefs::RegisterProfilePrefs(pref_service_->registry()); |
46 distilled_page_prefs_.reset(new DistilledPagePrefs(pref_service_.get())); | 46 distilled_page_prefs_.reset(new DistilledPagePrefs(pref_service_.get())); |
47 } | 47 } |
48 | 48 |
49 scoped_ptr<user_prefs::TestingPrefServiceSyncable> pref_service_; | 49 scoped_ptr<user_prefs::TestingPrefServiceSyncable> pref_service_; |
50 scoped_ptr<DistilledPagePrefs> distilled_page_prefs_; | 50 scoped_ptr<DistilledPagePrefs> distilled_page_prefs_; |
51 | 51 |
52 private: | 52 private: |
53 base::MessageLoop message_loop_; | 53 base::MessageLoop message_loop_; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 EXPECT_EQ(DistilledPagePrefs::SEPIA, obs2.GetTheme()); | 107 EXPECT_EQ(DistilledPagePrefs::SEPIA, obs2.GetTheme()); |
108 distilled_page_prefs_->RemoveObserver(&obs); | 108 distilled_page_prefs_->RemoveObserver(&obs); |
109 distilled_page_prefs_->SetTheme(DistilledPagePrefs::LIGHT); | 109 distilled_page_prefs_->SetTheme(DistilledPagePrefs::LIGHT); |
110 base::RunLoop().RunUntilIdle(); | 110 base::RunLoop().RunUntilIdle(); |
111 EXPECT_EQ(DistilledPagePrefs::SEPIA, obs.GetTheme()); | 111 EXPECT_EQ(DistilledPagePrefs::SEPIA, obs.GetTheme()); |
112 EXPECT_EQ(DistilledPagePrefs::LIGHT, obs2.GetTheme()); | 112 EXPECT_EQ(DistilledPagePrefs::LIGHT, obs2.GetTheme()); |
113 distilled_page_prefs_->RemoveObserver(&obs2); | 113 distilled_page_prefs_->RemoveObserver(&obs2); |
114 } | 114 } |
115 | 115 |
116 } // namespace dom_distiller | 116 } // namespace dom_distiller |
OLD | NEW |