| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 Value::CreateIntegerValue(IncognitoModePrefs::FORCED)); | 51 Value::CreateIntegerValue(IncognitoModePrefs::FORCED)); |
| 52 EXPECT_EQ(IncognitoModePrefs::FORCED, | 52 EXPECT_EQ(IncognitoModePrefs::FORCED, |
| 53 IncognitoModePrefs::GetAvailability(&prefs_)); | 53 IncognitoModePrefs::GetAvailability(&prefs_)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 typedef IncognitoModePrefsTest IncognitoModePrefsDeathTest; | 56 typedef IncognitoModePrefsTest IncognitoModePrefsDeathTest; |
| 57 | 57 |
| 58 TEST_F(IncognitoModePrefsDeathTest, GetAvailabilityBadValue) { | 58 TEST_F(IncognitoModePrefsDeathTest, GetAvailabilityBadValue) { |
| 59 prefs_.SetUserPref(prefs::kIncognitoModeAvailability, | 59 prefs_.SetUserPref(prefs::kIncognitoModeAvailability, |
| 60 Value::CreateIntegerValue(-1)); | 60 Value::CreateIntegerValue(-1)); |
| 61 #if defined(NDEBUG) && defined(DCHECK_ALWAYS_ON) |
| 62 EXPECT_DEATH({ |
| 63 IncognitoModePrefs::Availability availability = |
| 64 IncognitoModePrefs::GetAvailability(&prefs_); |
| 65 EXPECT_EQ(IncognitoModePrefs::ENABLED, availability); |
| 66 }, ""); |
| 67 #else |
| 61 EXPECT_DEBUG_DEATH({ | 68 EXPECT_DEBUG_DEATH({ |
| 62 IncognitoModePrefs::Availability availability = | 69 IncognitoModePrefs::Availability availability = |
| 63 IncognitoModePrefs::GetAvailability(&prefs_); | 70 IncognitoModePrefs::GetAvailability(&prefs_); |
| 64 EXPECT_EQ(IncognitoModePrefs::ENABLED, availability); | 71 EXPECT_EQ(IncognitoModePrefs::ENABLED, availability); |
| 65 }, ""); | 72 }, ""); |
| 73 #endif |
| 66 } | 74 } |
| OLD | NEW |