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

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

Issue 7649006: more changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix another typo Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
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 20 matching lines...) Expand all
31 EXPECT_EQ(IncognitoModePrefs::FORCED, incognito); 31 EXPECT_EQ(IncognitoModePrefs::FORCED, incognito);
32 32
33 EXPECT_FALSE(IncognitoModePrefs::IntToAvailability(10, &incognito)); 33 EXPECT_FALSE(IncognitoModePrefs::IntToAvailability(10, &incognito));
34 EXPECT_EQ(IncognitoModePrefs::ENABLED, incognito); 34 EXPECT_EQ(IncognitoModePrefs::ENABLED, incognito);
35 EXPECT_FALSE(IncognitoModePrefs::IntToAvailability(-1, &incognito)); 35 EXPECT_FALSE(IncognitoModePrefs::IntToAvailability(-1, &incognito));
36 EXPECT_EQ(IncognitoModePrefs::ENABLED, incognito); 36 EXPECT_EQ(IncognitoModePrefs::ENABLED, incognito);
37 } 37 }
38 38
39 TEST_F(IncognitoModePrefsTest, GetAvailability) { 39 TEST_F(IncognitoModePrefsTest, GetAvailability) {
40 prefs_.SetUserPref(prefs::kIncognitoModeAvailability, 40 prefs_.SetUserPref(prefs::kIncognitoModeAvailability,
41 Value::CreateIntegerValue(IncognitoModePrefs::ENABLED)); 41 base::NumberValue::New(IncognitoModePrefs::ENABLED));
42 EXPECT_EQ(IncognitoModePrefs::ENABLED, 42 EXPECT_EQ(IncognitoModePrefs::ENABLED,
43 IncognitoModePrefs::GetAvailability(&prefs_)); 43 IncognitoModePrefs::GetAvailability(&prefs_));
44 44
45 prefs_.SetUserPref(prefs::kIncognitoModeAvailability, 45 prefs_.SetUserPref(prefs::kIncognitoModeAvailability,
46 Value::CreateIntegerValue(IncognitoModePrefs::DISABLED)); 46 base::NumberValue::New(IncognitoModePrefs::DISABLED));
47 EXPECT_EQ(IncognitoModePrefs::DISABLED, 47 EXPECT_EQ(IncognitoModePrefs::DISABLED,
48 IncognitoModePrefs::GetAvailability(&prefs_)); 48 IncognitoModePrefs::GetAvailability(&prefs_));
49 49
50 prefs_.SetUserPref(prefs::kIncognitoModeAvailability, 50 prefs_.SetUserPref(prefs::kIncognitoModeAvailability,
51 Value::CreateIntegerValue(IncognitoModePrefs::FORCED)); 51 base::NumberValue::New(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 base::NumberValue::New(-1));
61 EXPECT_DEBUG_DEATH({ 61 EXPECT_DEBUG_DEATH({
62 IncognitoModePrefs::Availability availability = 62 IncognitoModePrefs::Availability availability =
63 IncognitoModePrefs::GetAvailability(&prefs_); 63 IncognitoModePrefs::GetAvailability(&prefs_);
64 EXPECT_EQ(IncognitoModePrefs::ENABLED, availability); 64 EXPECT_EQ(IncognitoModePrefs::ENABLED, availability);
65 }, ""); 65 }, "");
66 } 66 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/command_line_pref_store.cc ('k') | chrome/browser/prefs/incognito_user_pref_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698