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

Unified Diff: chrome/browser/chromeos/ownership/owner_settings_service_chromeos_unittest.cc

Issue 985093002: Fix up Owner settings on first load (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: modify protobuf directly Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/ownership/owner_settings_service_chromeos_unittest.cc
diff --git a/chrome/browser/chromeos/ownership/owner_settings_service_chromeos_unittest.cc b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos_unittest.cc
index a06337e392af313fa0a01d4d4800c38b49a320ff..d36349b49f63d3c6be5340f4743284bde66cf784 100644
--- a/chrome/browser/chromeos/ownership/owner_settings_service_chromeos_unittest.cc
+++ b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos_unittest.cc
@@ -123,6 +123,7 @@ class OwnerSettingsServiceChromeOSTest : public DeviceSettingsTestBase {
management_settings_set_ = success;
}
+ protected:
OwnerSettingsServiceChromeOS* service_;
ScopedTestingLocalState local_state_;
scoped_ptr<DeviceSettingsProvider> provider_;
@@ -294,6 +295,24 @@ TEST_F(OwnerSettingsServiceChromeOSTest, SetManagementSettingsSuccess) {
EXPECT_EQ("fake_device_id", policy_data->device_id());
}
+namespace {
+bool FindInListValue(const std::string& needle, const base::Value* haystack) {
Mattias Nissler (ping if slow) 2015/03/18 08:36:42 int: We'd usually put these helpers in the anonymo
Chris Masone 2015/03/24 20:53:37 Done.
+ const base::ListValue* list;
+ if (!haystack->GetAsList(&list))
+ return false;
+ return list->end() != list->Find(base::StringValue(needle));
+}
+} // namespace
+
+TEST_F(OwnerSettingsServiceChromeOSTest, ForceWhitelist) {
+ EXPECT_FALSE(FindInListValue(device_policy_.policy_data().username(),
+ provider_->Get(kAccountsPrefUsers)));
+ // Force a settings write.
+ TestSingleSet(service_, kReleaseChannel, base::StringValue("dev-channel"));
+ EXPECT_TRUE(FindInListValue(device_policy_.policy_data().username(),
+ provider_->Get(kAccountsPrefUsers)));
+}
Mattias Nissler (ping if slow) 2015/03/18 08:36:42 Would be good to have an additional test case that
Chris Masone 2015/03/20 19:13:11 ANy pointers on how to drive that transition in a
Mattias Nissler (ping if slow) 2015/03/24 12:03:11 OwnerSettingsServiceChromeOSTest::Setup() above ca
+
class OwnerSettingsServiceChromeOSNoOwnerTest
: public OwnerSettingsServiceChromeOSTest {
public:

Powered by Google App Engine
This is Rietveld 408576698