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

Side by Side Diff: chrome/browser/protector/prefs_backup_invalid_change_unittest.cc

Issue 10717005: Fix: PrefsBackupInvalidChangeTest.Defaults on Mac Lion. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: code review 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 | « no previous file | 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "chrome/browser/prefs/pref_service.h" 6 #include "chrome/browser/prefs/pref_service.h"
7 #include "chrome/browser/prefs/session_startup_pref.h" 7 #include "chrome/browser/prefs/session_startup_pref.h"
8 #include "chrome/browser/protector/base_setting_change.h" 8 #include "chrome/browser/protector/base_setting_change.h"
9 #include "chrome/common/pref_names.h" 9 #include "chrome/common/pref_names.h"
10 #include "chrome/test/base/testing_profile.h" 10 #include "chrome/test/base/testing_profile.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 #if defined(OS_MACOSX) 13 #if defined(OS_MACOSX)
14 #include "base/mac/mac_util.h" 14 #include "base/mac/mac_util.h"
15 #endif 15 #endif
16 16
17 namespace protector { 17 namespace protector {
18 18
19 namespace { 19 namespace {
20 20
21 const char kStartupUrl[] = "http://example.com/"; 21 const char kStartupUrl[] = "http://example.com/";
22 22
23 } // namespace 23 } // namespace
24 24
25 class PrefsBackupInvalidChangeTest : public testing::Test { 25 class PrefsBackupInvalidChangeTest : public testing::Test {
26 protected: 26 protected:
27 virtual void SetUp() OVERRIDE {
28 // Make the tests independent of the Mac startup pref migration (see
29 // SessionStartupPref::MigrateMacDefaultPrefIfNecessary).
30 PrefService* prefs = profile_.GetPrefs();
31 prefs->SetString(prefs::kProfileCreatedByVersion, "22.0.0.0.0");
32 }
33
27 TestingProfile profile_; 34 TestingProfile profile_;
28 }; 35 };
29 36
30 // Test that correct default values are applied by Init. 37 // Test that correct default values are applied by Init.
31 TEST_F(PrefsBackupInvalidChangeTest, Defaults) { 38 TEST_F(PrefsBackupInvalidChangeTest, Defaults) {
32 #if defined(OS_MACOSX)
33 if (base::mac::IsOSLionOrLater())
34 FAIL() << "Broken after r142958; http://crbug.com/134186";
35 #endif
36 SessionStartupPref startup_pref(SessionStartupPref::URLS); 39 SessionStartupPref startup_pref(SessionStartupPref::URLS);
37 startup_pref.urls.push_back(GURL(kStartupUrl)); 40 startup_pref.urls.push_back(GURL(kStartupUrl));
38 SessionStartupPref::SetStartupPref(&profile_, startup_pref); 41 SessionStartupPref::SetStartupPref(&profile_, startup_pref);
39 42
40 scoped_ptr<BaseSettingChange> change(CreatePrefsBackupInvalidChange()); 43 scoped_ptr<BaseSettingChange> change(CreatePrefsBackupInvalidChange());
41 change->Init(&profile_); 44 change->Init(&profile_);
42 45
43 SessionStartupPref new_startup_pref = 46 SessionStartupPref new_startup_pref =
44 SessionStartupPref::GetStartupPref(&profile_); 47 SessionStartupPref::GetStartupPref(&profile_);
45 // Startup type should be reset to default. 48 // Startup type should be reset to default.
(...skipping 19 matching lines...) Expand all
65 68
66 SessionStartupPref new_startup_pref = 69 SessionStartupPref new_startup_pref =
67 SessionStartupPref::GetStartupPref(&profile_); 70 SessionStartupPref::GetStartupPref(&profile_);
68 // Both startup type and startup URLs should be left unchanged. 71 // Both startup type and startup URLs should be left unchanged.
69 EXPECT_EQ(SessionStartupPref::LAST, new_startup_pref.type); 72 EXPECT_EQ(SessionStartupPref::LAST, new_startup_pref.type);
70 EXPECT_EQ(1UL, new_startup_pref.urls.size()); 73 EXPECT_EQ(1UL, new_startup_pref.urls.size());
71 EXPECT_EQ(std::string(kStartupUrl), new_startup_pref.urls[0].spec()); 74 EXPECT_EQ(std::string(kStartupUrl), new_startup_pref.urls[0].spec());
72 } 75 }
73 76
74 } // namespace protector 77 } // namespace protector
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698