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 <memory> | 5 #include <memory> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/prefs/pref_service_syncable_util.h" | 12 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
17 #include "components/policy/core/browser/browser_policy_connector.h" | 17 #include "components/policy/core/browser/browser_policy_connector.h" |
18 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 18 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
19 #include "components/policy/core/common/policy_map.h" | 19 #include "components/policy/core/common/policy_map.h" |
20 #include "components/policy/core/common/policy_types.h" | 20 #include "components/policy/core/common/policy_types.h" |
| 21 #include "components/sync/api/attachments/attachment_id.h" |
| 22 #include "components/sync/api/fake_sync_change_processor.h" |
| 23 #include "components/sync/api/sync_change.h" |
| 24 #include "components/sync/api/sync_error_factory.h" |
| 25 #include "components/sync/api/sync_error_factory_mock.h" |
| 26 #include "components/sync/api/syncable_service.h" |
| 27 #include "components/sync/core/attachments/attachment_service_proxy_for_test.h" |
| 28 #include "components/sync/protocol/sync.pb.h" |
21 #include "components/syncable_prefs/synced_pref_change_registrar.h" | 29 #include "components/syncable_prefs/synced_pref_change_registrar.h" |
22 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 30 #include "components/syncable_prefs/testing_pref_service_syncable.h" |
23 #include "content/public/test/test_utils.h" | 31 #include "content/public/test/test_utils.h" |
24 #include "policy/policy_constants.h" | 32 #include "policy/policy_constants.h" |
25 #include "sync/api/attachments/attachment_id.h" | |
26 #include "sync/api/fake_sync_change_processor.h" | |
27 #include "sync/api/sync_change.h" | |
28 #include "sync/api/sync_error_factory.h" | |
29 #include "sync/api/sync_error_factory_mock.h" | |
30 #include "sync/api/syncable_service.h" | |
31 #include "sync/internal_api/public/attachments/attachment_service_proxy_for_test
.h" | |
32 #include "sync/protocol/sync.pb.h" | |
33 | 33 |
34 namespace { | 34 namespace { |
35 | 35 |
36 using testing::Return; | 36 using testing::Return; |
37 using testing::_; | 37 using testing::_; |
38 | 38 |
39 class SyncedPrefChangeRegistrarTest : public InProcessBrowserTest { | 39 class SyncedPrefChangeRegistrarTest : public InProcessBrowserTest { |
40 public: | 40 public: |
41 SyncedPrefChangeRegistrarTest() : next_sync_data_id_(0) {} | 41 SyncedPrefChangeRegistrarTest() : next_sync_data_id_(0) {} |
42 ~SyncedPrefChangeRegistrarTest() override {} | 42 ~SyncedPrefChangeRegistrarTest() override {} |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 policies.Set(policy::key::kShowHomeButton, policy::POLICY_LEVEL_MANDATORY, | 202 policies.Set(policy::key::kShowHomeButton, policy::POLICY_LEVEL_MANDATORY, |
203 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, | 203 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, |
204 base::WrapUnique(new base::FundamentalValue(true)), nullptr); | 204 base::WrapUnique(new base::FundamentalValue(true)), nullptr); |
205 UpdateChromePolicy(policies); | 205 UpdateChromePolicy(policies); |
206 | 206 |
207 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton)); | 207 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton)); |
208 SetBooleanPrefValueFromSync(prefs::kShowHomeButton, false); | 208 SetBooleanPrefValueFromSync(prefs::kShowHomeButton, false); |
209 EXPECT_FALSE(observer.has_been_notified); | 209 EXPECT_FALSE(observer.has_been_notified); |
210 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton)); | 210 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton)); |
211 } | 211 } |
OLD | NEW |