Chromium Code Reviews| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/common/accessibility_types.h" | 10 #include "ash/common/accessibility_types.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
| 24 #include "chrome/test/base/testing_profile_manager.h" | 24 #include "chrome/test/base/testing_profile_manager.h" |
| 25 #include "components/pref_registry/pref_registry_syncable.h" | 25 #include "components/pref_registry/pref_registry_syncable.h" |
| 26 #include "components/prefs/pref_notifier_impl.h" | 26 #include "components/prefs/pref_notifier_impl.h" |
| 27 #include "components/prefs/testing_pref_store.h" | 27 #include "components/prefs/testing_pref_store.h" |
| 28 #include "components/syncable_prefs/pref_service_syncable.h" | 28 #include "components/syncable_prefs/pref_service_syncable.h" |
| 29 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 29 #include "components/syncable_prefs/testing_pref_service_syncable.h" |
| 30 #include "content/public/browser/notification_details.h" | 30 #include "content/public/browser/notification_details.h" |
| 31 #include "content/public/browser/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
| 32 #include "content/public/browser/notification_source.h" | 32 #include "content/public/browser/notification_source.h" |
| 33 #include "extensions/browser/quota_service.h" | |
| 33 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
| 34 | 35 |
| 35 namespace policy { | 36 namespace policy { |
| 36 | 37 |
| 37 namespace { | 38 namespace { |
| 38 // The amount of idle time after which recommended values are restored. | 39 // The amount of idle time after which recommended values are restored. |
| 39 const int kRestoreDelayInMs = 60 * 1000; // 1 minute. | 40 const int kRestoreDelayInMs = 60 * 1000; // 1 minute. |
| 40 } // namespace | 41 } // namespace |
| 41 | 42 |
| 42 class RecommendationRestorerTest : public testing::Test { | 43 class RecommendationRestorerTest : public testing::Test { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 62 const base::Value& expected_value) const; | 63 const base::Value& expected_value) const; |
| 63 void VerifyPrefsFollowUser() const; | 64 void VerifyPrefsFollowUser() const; |
| 64 void VerifyPrefFollowsRecommendation(const char* pref_name, | 65 void VerifyPrefFollowsRecommendation(const char* pref_name, |
| 65 const base::Value& expected_value) const; | 66 const base::Value& expected_value) const; |
| 66 void VerifyPrefsFollowRecommendations() const; | 67 void VerifyPrefsFollowRecommendations() const; |
| 67 | 68 |
| 68 void VerifyNotListeningForNotifications() const; | 69 void VerifyNotListeningForNotifications() const; |
| 69 void VerifyTimerIsStopped() const; | 70 void VerifyTimerIsStopped() const; |
| 70 void VerifyTimerIsRunning() const; | 71 void VerifyTimerIsRunning() const; |
| 71 | 72 |
| 73 extensions::QuotaService::ScopedDisablePurgeForTesting | |
|
achuithb
2016/06/30 10:06:29
ditto
| |
| 74 disable_purge_for_testing_; | |
| 75 | |
| 72 TestingPrefStore* recommended_prefs_; // Not owned. | 76 TestingPrefStore* recommended_prefs_; // Not owned. |
| 73 syncable_prefs::TestingPrefServiceSyncable* prefs_; // Not owned. | 77 syncable_prefs::TestingPrefServiceSyncable* prefs_; // Not owned. |
| 74 RecommendationRestorer* restorer_; // Not owned. | 78 RecommendationRestorer* restorer_; // Not owned. |
| 75 | 79 |
| 76 scoped_refptr<base::TestSimpleTaskRunner> runner_; | 80 scoped_refptr<base::TestSimpleTaskRunner> runner_; |
| 77 base::ThreadTaskRunnerHandle runner_handler_; | 81 base::ThreadTaskRunnerHandle runner_handler_; |
| 78 | 82 |
| 79 private: | 83 private: |
| 80 std::unique_ptr<syncable_prefs::PrefServiceSyncable> prefs_owner_; | 84 std::unique_ptr<syncable_prefs::PrefServiceSyncable> prefs_owner_; |
| 81 | 85 |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 554 | 558 |
| 555 // Fast forward until the reset timer fires. | 559 // Fast forward until the reset timer fires. |
| 556 VerifyTimerIsRunning(); | 560 VerifyTimerIsRunning(); |
| 557 runner_->RunUntilIdle(); | 561 runner_->RunUntilIdle(); |
| 558 VerifyPrefFollowsRecommendation(prefs::kAccessibilityLargeCursorEnabled, | 562 VerifyPrefFollowsRecommendation(prefs::kAccessibilityLargeCursorEnabled, |
| 559 base::FundamentalValue(false)); | 563 base::FundamentalValue(false)); |
| 560 VerifyTimerIsStopped(); | 564 VerifyTimerIsStopped(); |
| 561 } | 565 } |
| 562 | 566 |
| 563 } // namespace policy | 567 } // namespace policy |
| OLD | NEW |