Home | History | Annotate | Download | only in managed_mode
      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
      3 // found in the LICENSE file.
      4 
      5 #include "base/prefs/pref_service.h"
      6 #include "chrome/browser/managed_mode/managed_user_service.h"
      7 #include "chrome/browser/managed_mode/managed_user_service_factory.h"
      8 #include "chrome/browser/profiles/profile.h"
      9 #include "chrome/browser/ui/browser.h"
     10 #include "chrome/common/pref_names.h"
     11 #include "chrome/test/base/in_process_browser_test.h"
     12 #include "content/public/test/test_utils.h"
     13 
     14 typedef InProcessBrowserTest ManagedUserServiceTest;
     15 
     16 IN_PROC_BROWSER_TEST_F(ManagedUserServiceTest, LocalPolicies) {
     17   Profile* profile = browser()->profile();
     18   PrefService* prefs = profile->GetPrefs();
     19   EXPECT_FALSE(prefs->GetBoolean(prefs::kForceSafeSearch));
     20   EXPECT_FALSE(prefs->IsManagedPreference(prefs::kForceSafeSearch));
     21 
     22   ManagedUserService* managed_user_service =
     23        ManagedUserServiceFactory::GetForProfile(profile);
     24   managed_user_service->InitForTesting();
     25   content::RunAllPendingInMessageLoop();
     26 
     27   EXPECT_TRUE(prefs->GetBoolean(prefs::kForceSafeSearch));
     28   EXPECT_TRUE(prefs->IsManagedPreference(prefs::kForceSafeSearch));
     29 }
     30