| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 "chrome/browser/signin/signin_util.h" |
| 6 |
| 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/prefs/browser_prefs.h" |
| 9 #include "chrome/common/pref_names.h" |
| 10 #include "chrome/test/base/browser_with_test_window_test.h" |
| 11 #include "chrome/test/base/testing_browser_process.h" |
| 12 #include "components/prefs/pref_service.h" |
| 13 #include "components/prefs/testing_pref_service.h" |
| 14 |
| 15 class SigninUtilTest : public BrowserWithTestWindowTest { |
| 16 public: |
| 17 void SetUp() override { |
| 18 BrowserWithTestWindowTest::SetUp(); |
| 19 |
| 20 prefs_.reset(new TestingPrefServiceSimple()); |
| 21 } |
| 22 |
| 23 void TearDown() override { BrowserWithTestWindowTest::TearDown(); } |
| 24 |
| 25 std::unique_ptr<TestingPrefServiceSimple> prefs_; |
| 26 }; |
| 27 |
| 28 TEST_F(SigninUtilTest, GetForceSigninPolicy) { |
| 29 ASSERT_FALSE(signin_util::IsForceSigninEnabled()); |
| 30 chrome::RegisterLocalState(prefs_->registry()); |
| 31 TestingBrowserProcess::GetGlobal()->SetLocalState(prefs_.get()); |
| 32 |
| 33 g_browser_process->local_state()->SetBoolean(prefs::kForceBrowserSignin, |
| 34 true); |
| 35 ASSERT_TRUE(signin_util::IsForceSigninEnabled()); |
| 36 g_browser_process->local_state()->SetBoolean(prefs::kForceBrowserSignin, |
| 37 false); |
| 38 ASSERT_TRUE(signin_util::IsForceSigninEnabled()); |
| 39 |
| 40 TestingBrowserProcess::GetGlobal()->SetLocalState(nullptr); |
| 41 } |
| OLD | NEW |