Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: chrome/browser/prefs/incognito_mode_prefs_unittest.cc

Issue 2630963002: Migrate tests to use EXPECT_DCHECK_DEATH instead of EXPECT_DEATH. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/test/gtest_util.h"
7 #include "chrome/common/pref_names.h" 8 #include "chrome/common/pref_names.h"
8 #include "components/sync_preferences/testing_pref_service_syncable.h" 9 #include "components/sync_preferences/testing_pref_service_syncable.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 11
11 class IncognitoModePrefsTest : public testing::Test { 12 class IncognitoModePrefsTest : public testing::Test {
12 protected: 13 protected:
13 void SetUp() override { 14 void SetUp() override {
14 IncognitoModePrefs::RegisterProfilePrefs(prefs_.registry()); 15 IncognitoModePrefs::RegisterProfilePrefs(prefs_.registry());
15 } 16 }
16 17
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 IncognitoModePrefs::GetAvailability(&prefs_)); 49 IncognitoModePrefs::GetAvailability(&prefs_));
49 50
50 prefs_.SetUserPref(prefs::kIncognitoModeAvailability, 51 prefs_.SetUserPref(prefs::kIncognitoModeAvailability,
51 new base::FundamentalValue(IncognitoModePrefs::FORCED)); 52 new base::FundamentalValue(IncognitoModePrefs::FORCED));
52 EXPECT_EQ(IncognitoModePrefs::FORCED, 53 EXPECT_EQ(IncognitoModePrefs::FORCED,
53 IncognitoModePrefs::GetAvailability(&prefs_)); 54 IncognitoModePrefs::GetAvailability(&prefs_));
54 } 55 }
55 56
56 typedef IncognitoModePrefsTest IncognitoModePrefsDeathTest; 57 typedef IncognitoModePrefsTest IncognitoModePrefsDeathTest;
57 58
58 #if GTEST_HAS_DEATH_TEST
59 TEST_F(IncognitoModePrefsDeathTest, GetAvailabilityBadValue) { 59 TEST_F(IncognitoModePrefsDeathTest, GetAvailabilityBadValue) {
60 prefs_.SetUserPref(prefs::kIncognitoModeAvailability, 60 prefs_.SetUserPref(prefs::kIncognitoModeAvailability,
61 new base::FundamentalValue(-1)); 61 new base::FundamentalValue(-1));
62 #if defined(NDEBUG) && defined(DCHECK_ALWAYS_ON) 62 EXPECT_DCHECK_DEATH({
63 EXPECT_DEATH({
64 IncognitoModePrefs::Availability availability = 63 IncognitoModePrefs::Availability availability =
65 IncognitoModePrefs::GetAvailability(&prefs_); 64 IncognitoModePrefs::GetAvailability(&prefs_);
66 EXPECT_EQ(IncognitoModePrefs::ENABLED, availability); 65 EXPECT_EQ(IncognitoModePrefs::ENABLED, availability);
67 }, ""); 66 });
68 #else
69 EXPECT_DEBUG_DEATH({
70 IncognitoModePrefs::Availability availability =
71 IncognitoModePrefs::GetAvailability(&prefs_);
72 EXPECT_EQ(IncognitoModePrefs::ENABLED, availability);
73 }, "");
74 #endif
75 } 67 }
76 #endif // GTEST_HAS_DEATH_TEST
OLDNEW
« no previous file with comments | « base/task/cancelable_task_tracker_unittest.cc ('k') | chrome/test/chromedriver/net/timeout_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698