| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chromeos/policy/recommendation_restorer.h" | 5 #include "chrome/browser/chromeos/policy/recommendation_restorer.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/macros.h" | 9 #include "base/macros.h" |
| 8 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/prefs/pref_notifier_impl.h" | 11 #include "base/prefs/pref_notifier_impl.h" |
| 10 #include "base/prefs/testing_pref_store.h" | 12 #include "base/prefs/testing_pref_store.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/test/test_simple_task_runner.h" | 14 #include "base/test/test_simple_task_runner.h" |
| 13 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
| 14 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 15 #include "base/values.h" | 17 #include "base/values.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 18 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 prefs_->SetBoolean(prefs::kAccessibilityHighContrastEnabled, true); | 131 prefs_->SetBoolean(prefs::kAccessibilityHighContrastEnabled, true); |
| 130 prefs_->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled, true); | 132 prefs_->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled, true); |
| 131 prefs_->SetInteger(prefs::kAccessibilityScreenMagnifierType, | 133 prefs_->SetInteger(prefs::kAccessibilityScreenMagnifierType, |
| 132 ui::MAGNIFIER_FULL); | 134 ui::MAGNIFIER_FULL); |
| 133 prefs_->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled, true); | 135 prefs_->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled, true); |
| 134 } | 136 } |
| 135 | 137 |
| 136 void RecommendationRestorerTest::CreateLoginProfile() { | 138 void RecommendationRestorerTest::CreateLoginProfile() { |
| 137 ASSERT_FALSE(restorer_); | 139 ASSERT_FALSE(restorer_); |
| 138 TestingProfile* profile = profile_manager_.CreateTestingProfile( | 140 TestingProfile* profile = profile_manager_.CreateTestingProfile( |
| 139 chrome::kInitialProfile, prefs_owner_.Pass(), | 141 chrome::kInitialProfile, std::move(prefs_owner_), |
| 140 base::UTF8ToUTF16(chrome::kInitialProfile), 0, std::string(), | 142 base::UTF8ToUTF16(chrome::kInitialProfile), 0, std::string(), |
| 141 TestingProfile::TestingFactories()); | 143 TestingProfile::TestingFactories()); |
| 142 restorer_ = RecommendationRestorerFactory::GetForProfile(profile); | 144 restorer_ = RecommendationRestorerFactory::GetForProfile(profile); |
| 143 EXPECT_TRUE(restorer_); | 145 EXPECT_TRUE(restorer_); |
| 144 } | 146 } |
| 145 | 147 |
| 146 void RecommendationRestorerTest::CreateUserProfile() { | 148 void RecommendationRestorerTest::CreateUserProfile() { |
| 147 ASSERT_FALSE(restorer_); | 149 ASSERT_FALSE(restorer_); |
| 148 TestingProfile* profile = profile_manager_.CreateTestingProfile( | 150 TestingProfile* profile = profile_manager_.CreateTestingProfile( |
| 149 "user", prefs_owner_.Pass(), base::UTF8ToUTF16("user"), 0, std::string(), | 151 "user", std::move(prefs_owner_), base::UTF8ToUTF16("user"), 0, |
| 150 TestingProfile::TestingFactories()); | 152 std::string(), TestingProfile::TestingFactories()); |
| 151 restorer_ = RecommendationRestorerFactory::GetForProfile(profile); | 153 restorer_ = RecommendationRestorerFactory::GetForProfile(profile); |
| 152 EXPECT_TRUE(restorer_); | 154 EXPECT_TRUE(restorer_); |
| 153 } | 155 } |
| 154 | 156 |
| 155 void RecommendationRestorerTest::NotifyOfSessionStart() { | 157 void RecommendationRestorerTest::NotifyOfSessionStart() { |
| 156 ASSERT_TRUE(restorer_); | 158 ASSERT_TRUE(restorer_); |
| 157 restorer_->Observe(chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 159 restorer_->Observe(chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
| 158 content::Source<RecommendationRestorerTest>(this), | 160 content::Source<RecommendationRestorerTest>(this), |
| 159 content::NotificationService::NoDetails()); | 161 content::NotificationService::NoDetails()); |
| 160 } | 162 } |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 | 554 |
| 553 // Fast forward until the reset timer fires. | 555 // Fast forward until the reset timer fires. |
| 554 VerifyTimerIsRunning(); | 556 VerifyTimerIsRunning(); |
| 555 runner_->RunUntilIdle(); | 557 runner_->RunUntilIdle(); |
| 556 VerifyPrefFollowsRecommendation(prefs::kAccessibilityLargeCursorEnabled, | 558 VerifyPrefFollowsRecommendation(prefs::kAccessibilityLargeCursorEnabled, |
| 557 base::FundamentalValue(false)); | 559 base::FundamentalValue(false)); |
| 558 VerifyTimerIsStopped(); | 560 VerifyTimerIsStopped(); |
| 559 } | 561 } |
| 560 | 562 |
| 561 } // namespace policy | 563 } // namespace policy |
| OLD | NEW |