1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "base/prefs/pref_service.h" 6 #include "base/values.h" 7 #include "chrome/browser/managed_mode/managed_user_service.h" 8 #include "chrome/browser/managed_mode/managed_user_service_factory.h" 9 #include "chrome/browser/policy/managed_mode_policy_provider.h" 10 #include "chrome/browser/policy/profile_policy_connector.h" 11 #include "chrome/browser/policy/profile_policy_connector_factory.h" 12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/sync/profile_sync_service_harness.h" 14 #include "chrome/browser/sync/test/integration/sync_test.h" 15 #include "policy/policy_constants.h" 16 17 class SingleClientManagedUserSettingsSyncTest : public SyncTest { 18 public: 19 SingleClientManagedUserSettingsSyncTest() : SyncTest(SINGLE_CLIENT) {} 20 21 virtual ~SingleClientManagedUserSettingsSyncTest() {} 22 }; 23 24 // TODO(pavely): Fix this test. 25 IN_PROC_BROWSER_TEST_F(SingleClientManagedUserSettingsSyncTest, 26 DISABLED_Sanity) { 27 ASSERT_TRUE(SetupClients()); 28 for (int i = 0; i < num_clients(); ++i) { 29 Profile* profile = GetProfile(i); 30 ManagedUserServiceFactory::GetForProfile(profile)->InitForTesting(); 31 // Managed users are prohibited from signing into the browser. Currently 32 // that means they're also unable to sync anything, so override that for 33 // this test. 34 // TODO(pamg): Remove this override (and the several #includes it requires) 35 // once sync and signin are properly separated for managed users. See 36 // http://crbug.com/239785. 37 policy::ProfilePolicyConnector* connector = 38 policy::ProfilePolicyConnectorFactory::GetForProfile(profile); 39 policy::ManagedModePolicyProvider* policy_provider = 40 connector->managed_mode_policy_provider(); 41 scoped_ptr<base::Value> allow_signin(new base::FundamentalValue(true)); 42 policy_provider->SetLocalPolicyForTesting(policy::key::kSigninAllowed, 43 allow_signin.Pass()); 44 45 // The user should not be signed in. 46 std::string username; 47 // ProfileSyncServiceHarness sets the password, which can't be empty. 48 std::string password = "password"; 49 GetClient(i)->SetCredentials(username, password); 50 } 51 ASSERT_TRUE(SetupSync()); 52 } 53