| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/test/ui/ui_test.h" | 5 #include "chrome/test/ui/ui_test.h" |
| 6 | 6 |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/dom_ui/new_tab_ui.h" | 8 #include "chrome/browser/dom_ui/new_tab_ui.h" |
| 9 #include "chrome/browser/prefs/pref_value_store.h" | 9 #include "chrome/browser/prefs/pref_value_store.h" |
| 10 #include "chrome/browser/sync/signin_manager.h" | 10 #include "chrome/browser/sync/signin_manager.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 ASSERT_TRUE(tab->ExecuteAndExtractInt(L"", | 124 ASSERT_TRUE(tab->ExecuteAndExtractInt(L"", |
| 125 L"window.domAutomationController.send(" | 125 L"window.domAutomationController.send(" |
| 126 L"document.getElementsByClassName('thumbnail-container').length)", | 126 L"document.getElementsByClassName('thumbnail-container').length)", |
| 127 &thumbnails_count)); | 127 &thumbnails_count)); |
| 128 EXPECT_GT(thumbnails_count, 0); | 128 EXPECT_GT(thumbnails_count, 0); |
| 129 } | 129 } |
| 130 | 130 |
| 131 // Flaky on XP bots: http://crbug.com/51726 | 131 // Flaky on XP bots: http://crbug.com/51726 |
| 132 TEST_F(NewTabUITest, FLAKY_UpdateUserPrefsVersion) { | 132 TEST_F(NewTabUITest, FLAKY_UpdateUserPrefsVersion) { |
| 133 // PrefService with JSON user-pref file only, no enforced or advised prefs. | 133 // PrefService with JSON user-pref file only, no enforced or advised prefs. |
| 134 scoped_ptr<PrefService> prefs(new TestingPrefService); | 134 scoped_ptr<PrefService> prefs(TestingPrefService::CreateTestingPrefService()); |
| 135 | 135 |
| 136 // Does the migration | 136 // Does the migration |
| 137 NewTabUI::RegisterUserPrefs(prefs.get()); | 137 NewTabUI::RegisterUserPrefs(prefs.get()); |
| 138 | 138 |
| 139 ASSERT_EQ(NewTabUI::current_pref_version(), | 139 ASSERT_EQ(NewTabUI::current_pref_version(), |
| 140 prefs->GetInteger(prefs::kNTPPrefVersion)); | 140 prefs->GetInteger(prefs::kNTPPrefVersion)); |
| 141 | 141 |
| 142 // Reset the version | 142 // Reset the version |
| 143 prefs->ClearPref(prefs::kNTPPrefVersion); | 143 prefs->ClearPref(prefs::kNTPPrefVersion); |
| 144 ASSERT_EQ(0, prefs->GetInteger(prefs::kNTPPrefVersion)); | 144 ASSERT_EQ(0, prefs->GetInteger(prefs::kNTPPrefVersion)); |
| 145 | 145 |
| 146 bool migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get()); | 146 bool migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get()); |
| 147 ASSERT_TRUE(migrated); | 147 ASSERT_TRUE(migrated); |
| 148 ASSERT_EQ(NewTabUI::current_pref_version(), | 148 ASSERT_EQ(NewTabUI::current_pref_version(), |
| 149 prefs->GetInteger(prefs::kNTPPrefVersion)); | 149 prefs->GetInteger(prefs::kNTPPrefVersion)); |
| 150 | 150 |
| 151 migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get()); | 151 migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get()); |
| 152 ASSERT_FALSE(migrated); | 152 ASSERT_FALSE(migrated); |
| 153 } | 153 } |
| OLD | NEW |