OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/test/test_timeouts.h" | 7 #include "base/test/test_timeouts.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 ASSERT_TRUE(automation()->WaitForInitialNewTabUILoad(&load_time)); | 175 ASSERT_TRUE(automation()->WaitForInitialNewTabUILoad(&load_time)); |
176 | 176 |
177 // Ensure there are some thumbnails loaded in the page. | 177 // Ensure there are some thumbnails loaded in the page. |
178 int thumbnails_count = -1; | 178 int thumbnails_count = -1; |
179 ASSERT_TRUE(tab->ExecuteAndExtractInt(L"", | 179 ASSERT_TRUE(tab->ExecuteAndExtractInt(L"", |
180 L"window.domAutomationController.send(" | 180 L"window.domAutomationController.send(" |
181 L"document.getElementsByClassName('thumbnail-container').length)", | 181 L"document.getElementsByClassName('thumbnail-container').length)", |
182 &thumbnails_count)); | 182 &thumbnails_count)); |
183 EXPECT_GT(thumbnails_count, 0); | 183 EXPECT_GT(thumbnails_count, 0); |
184 } | 184 } |
185 | |
186 // Bug 87200: Disable UpdateUserPrefsVersion for Windows | |
187 #if defined(OS_WIN) | |
188 #define MAYBE_UpdateUserPrefsVersion DISABLED_UpdateUserPrefsVersion | |
189 #else | |
190 #define MAYBE_UpdateUserPrefsVersion UpdateUserPrefsVersion | |
191 #endif | |
192 TEST_F(NewTabUITest, MAYBE_UpdateUserPrefsVersion) { | |
193 // PrefService with JSON user-pref file only, no enforced or advised prefs. | |
194 scoped_ptr<PrefService> prefs(new TestingPrefService); | |
195 | |
196 // Does the migration | |
197 NewTabUI::RegisterUserPrefs(prefs.get()); | |
198 | |
199 ASSERT_EQ(NewTabUI::current_pref_version(), | |
200 prefs->GetInteger(prefs::kNTPPrefVersion)); | |
201 | |
202 // Reset the version | |
203 prefs->ClearPref(prefs::kNTPPrefVersion); | |
204 ASSERT_EQ(0, prefs->GetInteger(prefs::kNTPPrefVersion)); | |
205 | |
206 bool migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get()); | |
207 ASSERT_TRUE(migrated); | |
208 ASSERT_EQ(NewTabUI::current_pref_version(), | |
209 prefs->GetInteger(prefs::kNTPPrefVersion)); | |
210 | |
211 migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get()); | |
212 ASSERT_FALSE(migrated); | |
213 } | |
OLD | NEW |