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/session_startup_pref.h" | 5 #include "chrome/browser/prefs/session_startup_pref.h" |
6 #include "chrome/common/pref_names.h" | 6 #include "chrome/common/pref_names.h" |
7 #include "chrome/test/base/testing_pref_service_syncable.h" | 7 #include "chrome/test/base/testing_pref_service_syncable.h" |
8 #include "components/user_prefs/pref_registry_syncable.h" | 8 #include "components/user_prefs/pref_registry_syncable.h" |
9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 #if defined(OS_MACOSX) | 12 #if defined(OS_MACOSX) |
13 #include "chrome/browser/ui/cocoa/window_restore_utils.h" | 13 #include "chrome/browser/ui/cocoa/window_restore_utils.h" |
14 #endif | 14 #endif |
15 | 15 |
16 // Unit tests for SessionStartupPref. | 16 // Unit tests for SessionStartupPref. |
17 class SessionStartupPrefTest : public testing::Test { | 17 class SessionStartupPrefTest : public testing::Test { |
18 public: | 18 public: |
19 virtual void SetUp() { | 19 virtual void SetUp() { |
20 pref_service_.reset(new TestingPrefServiceSyncable); | 20 pref_service_.reset(new TestingPrefServiceSyncable); |
21 SessionStartupPref::RegisterUserPrefs(registry()); | 21 SessionStartupPref::RegisterProfilePrefs(registry()); |
22 registry()->RegisterBooleanPref( | 22 registry()->RegisterBooleanPref( |
23 prefs::kHomePageIsNewTabPage, | 23 prefs::kHomePageIsNewTabPage, |
24 true, | 24 true, |
25 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 25 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
26 // Make the tests independent of the Mac startup pref migration (see | 26 // Make the tests independent of the Mac startup pref migration (see |
27 // SessionStartupPref::MigrateMacDefaultPrefIfNecessary). | 27 // SessionStartupPref::MigrateMacDefaultPrefIfNecessary). |
28 registry()->RegisterStringPref( | 28 registry()->RegisterStringPref( |
29 prefs::kProfileCreatedByVersion, | 29 prefs::kProfileCreatedByVersion, |
30 "22.0.0.0", | 30 "22.0.0.0", |
31 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 31 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 // Trigger the migration. | 195 // Trigger the migration. |
196 SessionStartupPref pref = SessionStartupPref::GetStartupPref( | 196 SessionStartupPref pref = SessionStartupPref::GetStartupPref( |
197 pref_service_.get()); | 197 pref_service_.get()); |
198 | 198 |
199 // The pref is now explicit. | 199 // The pref is now explicit. |
200 EXPECT_EQ(SessionStartupPref::LAST, pref.type); | 200 EXPECT_EQ(SessionStartupPref::LAST, pref.type); |
201 EXPECT_FALSE(SessionStartupPref::TypeIsDefault(pref_service_.get())); | 201 EXPECT_FALSE(SessionStartupPref::TypeIsDefault(pref_service_.get())); |
202 } | 202 } |
203 #endif | 203 #endif |
OLD | NEW |