Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: trunk/src/chrome/browser/history/top_sites_impl_unittest.cc

Issue 416543006: Revert 284958 "Make HistoryDBTask not refcounted, and ensure it'..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/memory/weak_ptr.h" 6 #include "base/memory/weak_ptr.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/task/cancelable_task_tracker.h" 10 #include "base/task/cancelable_task_tracker.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // loaded from the db. 174 // loaded from the db.
175 void RefreshTopSitesAndRecreate() { 175 void RefreshTopSitesAndRecreate() {
176 StartQueryForMostVisited(); 176 StartQueryForMostVisited();
177 WaitForHistory(); 177 WaitForHistory();
178 RecreateTopSitesAndBlock(); 178 RecreateTopSitesAndBlock();
179 } 179 }
180 180
181 // Blocks the caller until history processes a task. This is useful if you 181 // Blocks the caller until history processes a task. This is useful if you
182 // need to wait until you know history has processed a task. 182 // need to wait until you know history has processed a task.
183 void WaitForHistory() { 183 void WaitForHistory() {
184 history_service()->ScheduleDBTask( 184 history_service()->ScheduleDBTask(new WaitForHistoryTask(),
185 scoped_ptr<history::HistoryDBTask>(new WaitForHistoryTask()), 185 &history_tracker_);
186 &history_tracker_);
187 base::MessageLoop::current()->Run(); 186 base::MessageLoop::current()->Run();
188 } 187 }
189 188
190 // Waits for top sites to finish processing a task. This is useful if you need 189 // Waits for top sites to finish processing a task. This is useful if you need
191 // to wait until top sites finishes processing a task. 190 // to wait until top sites finishes processing a task.
192 void WaitForTopSites() { 191 void WaitForTopSites() {
193 top_sites()->backend_->DoEmptyRequest( 192 top_sites()->backend_->DoEmptyRequest(
194 base::Bind(&TopSitesImplTest::QuitCallback, base::Unretained(this)), 193 base::Bind(&TopSitesImplTest::QuitCallback, base::Unretained(this)),
195 &top_sites_tracker_); 194 &top_sites_tracker_);
196 base::MessageLoop::current()->Run(); 195 base::MessageLoop::current()->Run();
(...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 ASSERT_EQ(orig_thumbnail.getSize(), thumbnail.getSize()); 1566 ASSERT_EQ(orig_thumbnail.getSize(), thumbnail.getSize());
1568 orig_thumbnail.lockPixels(); 1567 orig_thumbnail.lockPixels();
1569 thumbnail.lockPixels(); 1568 thumbnail.lockPixels();
1570 EXPECT_EQ(0, memcmp(orig_thumbnail.getPixels(), thumbnail.getPixels(), 1569 EXPECT_EQ(0, memcmp(orig_thumbnail.getPixels(), thumbnail.getPixels(),
1571 orig_thumbnail.getSize())); 1570 orig_thumbnail.getSize()));
1572 thumbnail.unlockPixels(); 1571 thumbnail.unlockPixels();
1573 orig_thumbnail.unlockPixels(); 1572 orig_thumbnail.unlockPixels();
1574 } 1573 }
1575 1574
1576 } // namespace history 1575 } // namespace history
OLDNEW
« no previous file with comments | « trunk/src/chrome/browser/history/in_memory_url_index.cc ('k') | trunk/src/chrome/browser/history/url_index_private_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698