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/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 Loading... |
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(new WaitForHistoryTask(), | 184 history_service()->ScheduleDBTask( |
185 &history_tracker_); | 185 scoped_ptr<history::HistoryDBTask>(new WaitForHistoryTask()), |
| 186 &history_tracker_); |
186 base::MessageLoop::current()->Run(); | 187 base::MessageLoop::current()->Run(); |
187 } | 188 } |
188 | 189 |
189 // Waits for top sites to finish processing a task. This is useful if you need | 190 // Waits for top sites to finish processing a task. This is useful if you need |
190 // to wait until top sites finishes processing a task. | 191 // to wait until top sites finishes processing a task. |
191 void WaitForTopSites() { | 192 void WaitForTopSites() { |
192 top_sites()->backend_->DoEmptyRequest( | 193 top_sites()->backend_->DoEmptyRequest( |
193 base::Bind(&TopSitesImplTest::QuitCallback, base::Unretained(this)), | 194 base::Bind(&TopSitesImplTest::QuitCallback, base::Unretained(this)), |
194 &top_sites_tracker_); | 195 &top_sites_tracker_); |
195 base::MessageLoop::current()->Run(); | 196 base::MessageLoop::current()->Run(); |
(...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 ASSERT_EQ(orig_thumbnail.getSize(), thumbnail.getSize()); | 1567 ASSERT_EQ(orig_thumbnail.getSize(), thumbnail.getSize()); |
1567 orig_thumbnail.lockPixels(); | 1568 orig_thumbnail.lockPixels(); |
1568 thumbnail.lockPixels(); | 1569 thumbnail.lockPixels(); |
1569 EXPECT_EQ(0, memcmp(orig_thumbnail.getPixels(), thumbnail.getPixels(), | 1570 EXPECT_EQ(0, memcmp(orig_thumbnail.getPixels(), thumbnail.getPixels(), |
1570 orig_thumbnail.getSize())); | 1571 orig_thumbnail.getSize())); |
1571 thumbnail.unlockPixels(); | 1572 thumbnail.unlockPixels(); |
1572 orig_thumbnail.unlockPixels(); | 1573 orig_thumbnail.unlockPixels(); |
1573 } | 1574 } |
1574 | 1575 |
1575 } // namespace history | 1576 } // namespace history |
OLD | NEW |