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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 TEST_F(TopSitesTest, CreateTopSitesThenHistory) { | 1179 TEST_F(TopSitesTest, CreateTopSitesThenHistory) { |
1180 profile()->DestroyTopSites(); | 1180 profile()->DestroyTopSites(); |
1181 profile()->DestroyHistoryService(); | 1181 profile()->DestroyHistoryService(); |
1182 | 1182 |
1183 // Remove the TopSites file. This forces TopSites to wait until history loads | 1183 // Remove the TopSites file. This forces TopSites to wait until history loads |
1184 // before TopSites is considered loaded. | 1184 // before TopSites is considered loaded. |
1185 file_util::Delete(profile()->GetPath().Append(chrome::kTopSitesFilename), | 1185 file_util::Delete(profile()->GetPath().Append(chrome::kTopSitesFilename), |
1186 false); | 1186 false); |
1187 | 1187 |
1188 // Create TopSites, but not History. | 1188 // Create TopSites, but not History. |
1189 HistoryServiceFactory::GetInstance()->SetTestingFactory(profile(), NULL); | |
1190 profile()->CreateTopSites(); | 1189 profile()->CreateTopSites(); |
1191 WaitForTopSites(); | 1190 WaitForTopSites(); |
1192 EXPECT_FALSE(IsTopSitesLoaded()); | 1191 EXPECT_FALSE(IsTopSitesLoaded()); |
1193 | 1192 |
1194 // Load history, which should make TopSites finish loading too. | 1193 // Load history, which should make TopSites finish loading too. |
1195 profile()->CreateHistoryService(false, false); | 1194 profile()->CreateHistoryService(false, false); |
1196 profile()->BlockUntilTopSitesLoaded(); | 1195 profile()->BlockUntilTopSitesLoaded(); |
1197 EXPECT_TRUE(IsTopSitesLoaded()); | 1196 EXPECT_TRUE(IsTopSitesLoaded()); |
1198 } | 1197 } |
1199 | 1198 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 chrome::NOTIFICATION_TOP_SITES_LOADED, | 1242 chrome::NOTIFICATION_TOP_SITES_LOADED, |
1244 content::Source<Profile>(profile())); | 1243 content::Source<Profile>(profile())); |
1245 profile()->CreateTopSites(); | 1244 profile()->CreateTopSites(); |
1246 HistoryServiceFactory::GetForProfile( | 1245 HistoryServiceFactory::GetForProfile( |
1247 profile(), Profile::EXPLICIT_ACCESS)->UnloadBackend(); | 1246 profile(), Profile::EXPLICIT_ACCESS)->UnloadBackend(); |
1248 profile()->BlockUntilHistoryProcessesPendingRequests(); | 1247 profile()->BlockUntilHistoryProcessesPendingRequests(); |
1249 observer.Wait(); | 1248 observer.Wait(); |
1250 } | 1249 } |
1251 | 1250 |
1252 } // namespace history | 1251 } // namespace history |
OLD | NEW |