| 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.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 Loading... |
| 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 |
| OLD | NEW |