| 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/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 namespace history { | 46 namespace history { |
| 47 | 47 |
| 48 namespace { | 48 namespace { |
| 49 | 49 |
| 50 // Used by WaitForHistory, see it for details. | 50 // Used by WaitForHistory, see it for details. |
| 51 class WaitForHistoryTask : public HistoryDBTask { | 51 class WaitForHistoryTask : public HistoryDBTask { |
| 52 public: | 52 public: |
| 53 WaitForHistoryTask() {} | 53 WaitForHistoryTask() {} |
| 54 | 54 |
| 55 virtual bool RunOnDBThread(HistoryBackend* backend, HistoryDatabase* db) { | 55 virtual bool RunOnDBThread(HistoryBackend* backend, |
| 56 HistoryDatabase* db) OVERRIDE { |
| 56 return true; | 57 return true; |
| 57 } | 58 } |
| 58 | 59 |
| 59 virtual void DoneRunOnMainThread() { | 60 virtual void DoneRunOnMainThread() OVERRIDE { |
| 60 MessageLoop::current()->Quit(); | 61 MessageLoop::current()->Quit(); |
| 61 } | 62 } |
| 62 | 63 |
| 63 private: | 64 private: |
| 64 virtual ~WaitForHistoryTask() {} | 65 virtual ~WaitForHistoryTask() {} |
| 65 | 66 |
| 66 DISALLOW_COPY_AND_ASSIGN(WaitForHistoryTask); | 67 DISALLOW_COPY_AND_ASSIGN(WaitForHistoryTask); |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 // Used for querying top sites. Either runs sequentially, or runs a nested | 70 // Used for querying top sites. Either runs sequentially, or runs a nested |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 ASSERT_NO_FATAL_FAILURE(ExecuteSQLScript( | 356 ASSERT_NO_FATAL_FAILURE(ExecuteSQLScript( |
| 356 data_path.AppendASCII("thumbnails.3.sql"), | 357 data_path.AppendASCII("thumbnails.3.sql"), |
| 357 profile()->GetPath().Append(chrome::kThumbnailsFilename))); | 358 profile()->GetPath().Append(chrome::kThumbnailsFilename))); |
| 358 | 359 |
| 359 profile()->CreateHistoryService(false, false); | 360 profile()->CreateHistoryService(false, false); |
| 360 profile()->CreateTopSites(); | 361 profile()->CreateTopSites(); |
| 361 profile()->BlockUntilTopSitesLoaded(); | 362 profile()->BlockUntilTopSitesLoaded(); |
| 362 } | 363 } |
| 363 | 364 |
| 364 // Returns true if history and top sites should be created in SetUp. | 365 // Returns true if history and top sites should be created in SetUp. |
| 365 virtual bool CreateHistoryAndTopSites() { | 366 virtual bool CreateHistoryAndTopSites() OVERRIDE { |
| 366 return false; | 367 return false; |
| 367 } | 368 } |
| 368 | 369 |
| 369 protected: | 370 protected: |
| 370 // Assertions for the migration test. This is extracted into a standalone | 371 // Assertions for the migration test. This is extracted into a standalone |
| 371 // method so that it can be invoked twice. | 372 // method so that it can be invoked twice. |
| 372 void MigrationAssertions() { | 373 void MigrationAssertions() { |
| 373 TopSitesQuerier querier; | 374 TopSitesQuerier querier; |
| 374 querier.QueryTopSites(top_sites(), false); | 375 querier.QueryTopSites(top_sites(), false); |
| 375 | 376 |
| (...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 chrome::NOTIFICATION_TOP_SITES_LOADED, | 1255 chrome::NOTIFICATION_TOP_SITES_LOADED, |
| 1255 content::Source<Profile>(profile())); | 1256 content::Source<Profile>(profile())); |
| 1256 profile()->CreateTopSites(); | 1257 profile()->CreateTopSites(); |
| 1257 HistoryServiceFactory::GetForProfile( | 1258 HistoryServiceFactory::GetForProfile( |
| 1258 profile(), Profile::EXPLICIT_ACCESS)->UnloadBackend(); | 1259 profile(), Profile::EXPLICIT_ACCESS)->UnloadBackend(); |
| 1259 profile()->BlockUntilHistoryProcessesPendingRequests(); | 1260 profile()->BlockUntilHistoryProcessesPendingRequests(); |
| 1260 observer.Wait(); | 1261 observer.Wait(); |
| 1261 } | 1262 } |
| 1262 | 1263 |
| 1263 } // namespace history | 1264 } // namespace history |
| OLD | NEW |