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

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

Issue 10702040: Cleanup & tests for the mac startup pref migration. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: reverting protector changes Created 8 years, 5 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
« no previous file with comments | « chrome/browser/prefs/session_startup_pref.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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.h" 7 #include "chrome/test/base/testing_pref_service.h"
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // using the pref service directly. 152 // using the pref service directly.
153 pref_service_->SetInteger(prefs::kRestoreOnStartup, /*kPrefValueHomePage*/ 0); 153 pref_service_->SetInteger(prefs::kRestoreOnStartup, /*kPrefValueHomePage*/ 0);
154 pref_service_->SetString(prefs::kHomePage, "http://chromium.org/"); 154 pref_service_->SetString(prefs::kHomePage, "http://chromium.org/");
155 pref_service_->SetBoolean(prefs::kHomePageIsNewTabPage, true); 155 pref_service_->SetBoolean(prefs::kHomePageIsNewTabPage, true);
156 156
157 SessionStartupPref pref = SessionStartupPref::GetStartupPref( 157 SessionStartupPref pref = SessionStartupPref::GetStartupPref(
158 pref_service_.get()); 158 pref_service_.get());
159 159
160 EXPECT_EQ(SessionStartupPref::DEFAULT, pref.type); 160 EXPECT_EQ(SessionStartupPref::DEFAULT, pref.type);
161 } 161 }
162
163 #if defined(OS_MACOSX)
164 // See SessionStartupPref::MigrateMacDefaultPrefIfNecessary.
165 TEST_F(SessionStartupPrefTest, MacDefaultStartupPrefMigration) {
166 if (!restore_utils::IsWindowRestoreEnabled())
167 return;
168
169 // Use an old profile.
170 pref_service_->SetString(prefs::kProfileCreatedByVersion, "19.0.0.0");
171 ASSERT_TRUE(SessionStartupPref::TypeIsDefault(pref_service_.get()));
172
173 // Trigger the migration.
174 SessionStartupPref pref = SessionStartupPref::GetStartupPref(
175 pref_service_.get());
176
177 // The pref is now explicit.
178 EXPECT_EQ(SessionStartupPref::LAST, pref.type);
179 EXPECT_FALSE(SessionStartupPref::TypeIsDefault(pref_service_.get()));
180 }
181 #endif
OLDNEW
« no previous file with comments | « chrome/browser/prefs/session_startup_pref.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698