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 "components/syncable_prefs/testing_pref_service_syncable.h" | 8 #include "components/sync_preferences/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 void SetUp() override { | 13 void SetUp() override { |
14 IncognitoModePrefs::RegisterProfilePrefs(prefs_.registry()); | 14 IncognitoModePrefs::RegisterProfilePrefs(prefs_.registry()); |
15 } | 15 } |
16 | 16 |
17 syncable_prefs::TestingPrefServiceSyncable prefs_; | 17 sync_preferences::TestingPrefServiceSyncable prefs_; |
18 }; | 18 }; |
19 | 19 |
20 TEST_F(IncognitoModePrefsTest, IntToAvailability) { | 20 TEST_F(IncognitoModePrefsTest, IntToAvailability) { |
21 ASSERT_EQ(0, IncognitoModePrefs::ENABLED); | 21 ASSERT_EQ(0, IncognitoModePrefs::ENABLED); |
22 ASSERT_EQ(1, IncognitoModePrefs::DISABLED); | 22 ASSERT_EQ(1, IncognitoModePrefs::DISABLED); |
23 ASSERT_EQ(2, IncognitoModePrefs::FORCED); | 23 ASSERT_EQ(2, IncognitoModePrefs::FORCED); |
24 | 24 |
25 IncognitoModePrefs::Availability incognito; | 25 IncognitoModePrefs::Availability incognito; |
26 EXPECT_TRUE(IncognitoModePrefs::IntToAvailability(0, &incognito)); | 26 EXPECT_TRUE(IncognitoModePrefs::IntToAvailability(0, &incognito)); |
27 EXPECT_EQ(IncognitoModePrefs::ENABLED, incognito); | 27 EXPECT_EQ(IncognitoModePrefs::ENABLED, incognito); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 }, ""); | 67 }, ""); |
68 #else | 68 #else |
69 EXPECT_DEBUG_DEATH({ | 69 EXPECT_DEBUG_DEATH({ |
70 IncognitoModePrefs::Availability availability = | 70 IncognitoModePrefs::Availability availability = |
71 IncognitoModePrefs::GetAvailability(&prefs_); | 71 IncognitoModePrefs::GetAvailability(&prefs_); |
72 EXPECT_EQ(IncognitoModePrefs::ENABLED, availability); | 72 EXPECT_EQ(IncognitoModePrefs::ENABLED, availability); |
73 }, ""); | 73 }, ""); |
74 #endif | 74 #endif |
75 } | 75 } |
76 #endif // GTEST_HAS_DEATH_TEST | 76 #endif // GTEST_HAS_DEATH_TEST |
OLD | NEW |