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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/prefs/testing_pref_store.h" | 8 #include "base/prefs/testing_pref_store.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "chrome/browser/managed_mode/managed_user_settings_service.h" | 10 #include "chrome/browser/managed_mode/managed_user_settings_service.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 // testing::Test overrides: | 121 // testing::Test overrides: |
122 virtual void SetUp() OVERRIDE { | 122 virtual void SetUp() OVERRIDE { |
123 TestingPrefStore* pref_store = new TestingPrefStore; | 123 TestingPrefStore* pref_store = new TestingPrefStore; |
124 settings_service_.Init(pref_store); | 124 settings_service_.Init(pref_store); |
125 settings_service_.Subscribe( | 125 settings_service_.Subscribe( |
126 base::Bind(&ManagedUserSettingsServiceTest::OnNewSettingsAvailable, | 126 base::Bind(&ManagedUserSettingsServiceTest::OnNewSettingsAvailable, |
127 base::Unretained(this))); | 127 base::Unretained(this))); |
128 pref_store->SetInitializationCompleted(); | 128 pref_store->SetInitializationCompleted(); |
129 ASSERT_FALSE(settings_); | 129 ASSERT_FALSE(settings_); |
130 settings_service_.Activate(); | 130 settings_service_.SetActive(true); |
131 ASSERT_TRUE(settings_); | 131 ASSERT_TRUE(settings_); |
132 } | 132 } |
133 | 133 |
134 virtual void TearDown() OVERRIDE { | 134 virtual void TearDown() OVERRIDE { |
135 settings_service_.Shutdown(); | 135 settings_service_.Shutdown(); |
136 } | 136 } |
137 | 137 |
138 base::DictionaryValue split_items_; | 138 base::DictionaryValue split_items_; |
139 scoped_ptr<base::Value> atomic_setting_value_; | 139 scoped_ptr<base::Value> atomic_setting_value_; |
140 ManagedUserSettingsService settings_service_; | 140 ManagedUserSettingsService settings_service_; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // The uploaded items should not show up as settings. | 290 // The uploaded items should not show up as settings. |
291 const base::Value* value = NULL; | 291 const base::Value* value = NULL; |
292 EXPECT_FALSE(settings_->GetWithoutPathExpansion(kAtomicItemName, &value)); | 292 EXPECT_FALSE(settings_->GetWithoutPathExpansion(kAtomicItemName, &value)); |
293 EXPECT_FALSE(settings_->GetWithoutPathExpansion(kSplitItemName, &value)); | 293 EXPECT_FALSE(settings_->GetWithoutPathExpansion(kSplitItemName, &value)); |
294 | 294 |
295 // Restarting sync should not create any new changes. | 295 // Restarting sync should not create any new changes. |
296 settings_service_.StopSyncing(syncer::MANAGED_USER_SETTINGS); | 296 settings_service_.StopSyncing(syncer::MANAGED_USER_SETTINGS); |
297 StartSyncing(sync_data); | 297 StartSyncing(sync_data); |
298 ASSERT_EQ(0u, sync_processor_->changes().size()); | 298 ASSERT_EQ(0u, sync_processor_->changes().size()); |
299 } | 299 } |
OLD | NEW |