| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } // namespace | 47 } // namespace |
| 48 | 48 |
| 49 class DistilledPagePrefsTest : public testing::Test { | 49 class DistilledPagePrefsTest : public testing::Test { |
| 50 protected: | 50 protected: |
| 51 void SetUp() override { | 51 void SetUp() override { |
| 52 pref_service_.reset(new user_prefs::TestingPrefServiceSyncable()); | 52 pref_service_.reset(new user_prefs::TestingPrefServiceSyncable()); |
| 53 DistilledPagePrefs::RegisterProfilePrefs(pref_service_->registry()); | 53 DistilledPagePrefs::RegisterProfilePrefs(pref_service_->registry()); |
| 54 distilled_page_prefs_.reset(new DistilledPagePrefs(pref_service_.get())); | 54 distilled_page_prefs_.reset(new DistilledPagePrefs(pref_service_.get())); |
| 55 } | 55 } |
| 56 | 56 |
| 57 scoped_ptr<user_prefs::TestingPrefServiceSyncable> pref_service_; | 57 std::unique_ptr<user_prefs::TestingPrefServiceSyncable> pref_service_; |
| 58 scoped_ptr<DistilledPagePrefs> distilled_page_prefs_; | 58 std::unique_ptr<DistilledPagePrefs> distilled_page_prefs_; |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 base::MessageLoop message_loop_; | 61 base::MessageLoop message_loop_; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 TEST_F(DistilledPagePrefsTest, TestingOnChangeFontIsBeingCalled) { | 64 TEST_F(DistilledPagePrefsTest, TestingOnChangeFontIsBeingCalled) { |
| 65 TestingObserver obs; | 65 TestingObserver obs; |
| 66 distilled_page_prefs_->AddObserver(&obs); | 66 distilled_page_prefs_->AddObserver(&obs); |
| 67 | 67 |
| 68 distilled_page_prefs_->SetFontFamily(DistilledPagePrefs::MONOSPACE); | 68 distilled_page_prefs_->SetFontFamily(DistilledPagePrefs::MONOSPACE); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 distilled_page_prefs_->SetFontScaling(0.9f); | 166 distilled_page_prefs_->SetFontScaling(0.9f); |
| 167 base::RunLoop().RunUntilIdle(); | 167 base::RunLoop().RunUntilIdle(); |
| 168 ASSERT_FLOAT_EQ(1.3f, obs.GetFontScaling()); | 168 ASSERT_FLOAT_EQ(1.3f, obs.GetFontScaling()); |
| 169 ASSERT_FLOAT_EQ(0.9f, obs2.GetFontScaling()); | 169 ASSERT_FLOAT_EQ(0.9f, obs2.GetFontScaling()); |
| 170 | 170 |
| 171 distilled_page_prefs_->RemoveObserver(&obs2); | 171 distilled_page_prefs_->RemoveObserver(&obs2); |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace dom_distiller | 174 } // namespace dom_distiller |
| OLD | NEW |