| OLD | NEW |
| 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/prefs/incognito_mode_prefs.h" | 5 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 6 | 6 |
| 7 #include "chrome/common/pref_names.h" | 7 #include "chrome/common/pref_names.h" |
| 8 #include "chrome/test/base/testing_pref_service_syncable.h" | 8 #include "chrome/test/base/testing_pref_service_syncable.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 class IncognitoModePrefsTest : public testing::Test { | 11 class IncognitoModePrefsTest : public testing::Test { |
| 12 protected: | 12 protected: |
| 13 static void SetUpTestCase() { |
| 14 IncognitoModePrefs::InitializePlatformParentalControls(); |
| 15 } |
| 16 |
| 17 static void TearDownTestCase() { |
| 18 IncognitoModePrefs::UninitializePlatformParentalControls(); |
| 19 } |
| 20 |
| 13 void SetUp() override { | 21 void SetUp() override { |
| 14 IncognitoModePrefs::RegisterProfilePrefs(prefs_.registry()); | 22 IncognitoModePrefs::RegisterProfilePrefs(prefs_.registry()); |
| 15 } | 23 } |
| 16 | 24 |
| 17 TestingPrefServiceSyncable prefs_; | 25 TestingPrefServiceSyncable prefs_; |
| 18 }; | 26 }; |
| 19 | 27 |
| 20 TEST_F(IncognitoModePrefsTest, IntToAvailability) { | 28 TEST_F(IncognitoModePrefsTest, IntToAvailability) { |
| 21 ASSERT_EQ(0, IncognitoModePrefs::ENABLED); | 29 ASSERT_EQ(0, IncognitoModePrefs::ENABLED); |
| 22 ASSERT_EQ(1, IncognitoModePrefs::DISABLED); | 30 ASSERT_EQ(1, IncognitoModePrefs::DISABLED); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 }, ""); | 75 }, ""); |
| 68 #else | 76 #else |
| 69 EXPECT_DEBUG_DEATH({ | 77 EXPECT_DEBUG_DEATH({ |
| 70 IncognitoModePrefs::Availability availability = | 78 IncognitoModePrefs::Availability availability = |
| 71 IncognitoModePrefs::GetAvailability(&prefs_); | 79 IncognitoModePrefs::GetAvailability(&prefs_); |
| 72 EXPECT_EQ(IncognitoModePrefs::ENABLED, availability); | 80 EXPECT_EQ(IncognitoModePrefs::ENABLED, availability); |
| 73 }, ""); | 81 }, ""); |
| 74 #endif | 82 #endif |
| 75 } | 83 } |
| 76 #endif // GTEST_HAS_DEATH_TEST | 84 #endif // GTEST_HAS_DEATH_TEST |
| OLD | NEW |