OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/file_path.h" | 7 #include "base/file_path.h" |
8 #include "chrome/app/chrome_dll_resource.h" | 8 #include "chrome/app/chrome_dll_resource.h" |
9 #include "chrome/browser/dom_ui/new_tab_ui.h" | 9 #include "chrome/browser/dom_ui/new_tab_ui.h" |
10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 &filler_thumbnails_count)); | 53 &filler_thumbnails_count)); |
54 if (filler_thumbnails_count == 0) | 54 if (filler_thumbnails_count == 0) |
55 break; | 55 break; |
56 PlatformThread::Sleep(kWaitDuration); | 56 PlatformThread::Sleep(kWaitDuration); |
57 wait_time -= kWaitDuration; | 57 wait_time -= kWaitDuration; |
58 } | 58 } |
59 EXPECT_EQ(0, filler_thumbnails_count); | 59 EXPECT_EQ(0, filler_thumbnails_count); |
60 } | 60 } |
61 | 61 |
62 TEST_F(NewTabUITest, UpdateUserPrefsVersion) { | 62 TEST_F(NewTabUITest, UpdateUserPrefsVersion) { |
63 PrefService prefs(FilePath(), NULL); | 63 PrefService prefs((FilePath())); |
64 | 64 |
65 // Does the migration | 65 // Does the migration |
66 NewTabUI::RegisterUserPrefs(&prefs); | 66 NewTabUI::RegisterUserPrefs(&prefs); |
67 | 67 |
68 ASSERT_EQ(NewTabUI::current_pref_version(), | 68 ASSERT_EQ(NewTabUI::current_pref_version(), |
69 prefs.GetInteger(prefs::kNTPPrefVersion)); | 69 prefs.GetInteger(prefs::kNTPPrefVersion)); |
70 | 70 |
71 // Reset the version | 71 // Reset the version |
72 prefs.ClearPref(prefs::kNTPPrefVersion); | 72 prefs.ClearPref(prefs::kNTPPrefVersion); |
73 ASSERT_EQ(0, prefs.GetInteger(prefs::kNTPPrefVersion)); | 73 ASSERT_EQ(0, prefs.GetInteger(prefs::kNTPPrefVersion)); |
74 | 74 |
75 bool migrated = NewTabUI::UpdateUserPrefsVersion(&prefs); | 75 bool migrated = NewTabUI::UpdateUserPrefsVersion(&prefs); |
76 ASSERT_TRUE(migrated); | 76 ASSERT_TRUE(migrated); |
77 ASSERT_EQ(NewTabUI::current_pref_version(), | 77 ASSERT_EQ(NewTabUI::current_pref_version(), |
78 prefs.GetInteger(prefs::kNTPPrefVersion)); | 78 prefs.GetInteger(prefs::kNTPPrefVersion)); |
79 | 79 |
80 migrated = NewTabUI::UpdateUserPrefsVersion(&prefs); | 80 migrated = NewTabUI::UpdateUserPrefsVersion(&prefs); |
81 ASSERT_FALSE(migrated); | 81 ASSERT_FALSE(migrated); |
82 } | 82 } |
OLD | NEW |