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.h" | 8 #include "chrome/test/base/testing_pref_service.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 virtual void SetUp() { | 13 virtual void SetUp() { |
14 IncognitoModePrefs::RegisterUserPrefs(&prefs_); | 14 IncognitoModePrefs::RegisterUserPrefs(&prefs_); |
15 } | 15 } |
16 | 16 |
17 TestingPrefService prefs_; | 17 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 }, ""); | 74 }, ""); |
75 #else | 75 #else |
76 EXPECT_DEBUG_DEATH({ | 76 EXPECT_DEBUG_DEATH({ |
77 IncognitoModePrefs::Availability availability = | 77 IncognitoModePrefs::Availability availability = |
78 IncognitoModePrefs::GetAvailability(&prefs_); | 78 IncognitoModePrefs::GetAvailability(&prefs_); |
79 EXPECT_EQ(IncognitoModePrefs::ENABLED, availability); | 79 EXPECT_EQ(IncognitoModePrefs::ENABLED, availability); |
80 }, ""); | 80 }, ""); |
81 #endif | 81 #endif |
82 } | 82 } |
83 #endif // GTEST_HAS_DEATH_TEST | 83 #endif // GTEST_HAS_DEATH_TEST |
OLD | NEW |