Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: chrome/browser/chromeos/settings/stub_cros_settings_provider_unittest.cc

Issue 228553002: Preference dis/allowing supervised users creation is now available as owner setting, not only as de… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Unnecessary callback removed. Patch applied for failing tests. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/settings/stub_cros_settings_provider.h" 5 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 ASSERT_TRUE(provider_->HandlesSetting(kDeviceOwner)); 62 ASSERT_TRUE(provider_->HandlesSetting(kDeviceOwner));
63 ASSERT_FALSE(provider_->HandlesSetting("no.such.setting")); 63 ASSERT_FALSE(provider_->HandlesSetting("no.such.setting"));
64 } 64 }
65 65
66 TEST_F(StubCrosSettingsProviderTest, Defaults) { 66 TEST_F(StubCrosSettingsProviderTest, Defaults) {
67 // Verify default values. 67 // Verify default values.
68 const base::FundamentalValue kTrueValue(true); 68 const base::FundamentalValue kTrueValue(true);
69 AssertPref(kAccountsPrefAllowGuest, &kTrueValue); 69 AssertPref(kAccountsPrefAllowGuest, &kTrueValue);
70 AssertPref(kAccountsPrefAllowNewUser, &kTrueValue); 70 AssertPref(kAccountsPrefAllowNewUser, &kTrueValue);
71 AssertPref(kAccountsPrefShowUserNamesOnSignIn, &kTrueValue); 71 AssertPref(kAccountsPrefShowUserNamesOnSignIn, &kTrueValue);
72 AssertPref(kAccountsPrefSupervisedUsersEnabled, &kTrueValue);
72 } 73 }
73 74
74 TEST_F(StubCrosSettingsProviderTest, Set) { 75 TEST_F(StubCrosSettingsProviderTest, Set) {
75 // Setting value and reading it afterwards returns the same value. 76 // Setting value and reading it afterwards returns the same value.
76 base::StringValue owner_value("me@owner"); 77 base::StringValue owner_value("me@owner");
77 provider_->Set(kDeviceOwner, owner_value); 78 provider_->Set(kDeviceOwner, owner_value);
78 AssertPref(kDeviceOwner, &owner_value); 79 AssertPref(kDeviceOwner, &owner_value);
79 ExpectObservers(kDeviceOwner, 1); 80 ExpectObservers(kDeviceOwner, 1);
80 } 81 }
81 82
82 TEST_F(StubCrosSettingsProviderTest, SetMissing) { 83 TEST_F(StubCrosSettingsProviderTest, SetMissing) {
83 // Setting is missing initially but is added by |Set|. 84 // Setting is missing initially but is added by |Set|.
84 base::StringValue pref_value("testing"); 85 base::StringValue pref_value("testing");
85 ASSERT_FALSE(provider_->Get(kReleaseChannel)); 86 ASSERT_FALSE(provider_->Get(kReleaseChannel));
86 provider_->Set(kReleaseChannel, pref_value); 87 provider_->Set(kReleaseChannel, pref_value);
87 AssertPref(kReleaseChannel, &pref_value); 88 AssertPref(kReleaseChannel, &pref_value);
88 ExpectObservers(kReleaseChannel, 1); 89 ExpectObservers(kReleaseChannel, 1);
89 } 90 }
90 91
91 TEST_F(StubCrosSettingsProviderTest, PrepareTrustedValues) { 92 TEST_F(StubCrosSettingsProviderTest, PrepareTrustedValues) {
92 // Should return immediately without invoking the callback. 93 // Should return immediately without invoking the callback.
93 CrosSettingsProvider::TrustedStatus trusted = 94 CrosSettingsProvider::TrustedStatus trusted =
94 provider_->PrepareTrustedValues(base::Bind(&Fail)); 95 provider_->PrepareTrustedValues(base::Bind(&Fail));
95 EXPECT_EQ(CrosSettingsProvider::TRUSTED, trusted); 96 EXPECT_EQ(CrosSettingsProvider::TRUSTED, trusted);
96 } 97 }
97 98
98 } // namespace chromeos 99 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698