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/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/task/cancelable_task_tracker.h" | 9 #include "base/task/cancelable_task_tracker.h" |
10 #include "chrome/browser/history/history_service_factory.h" | 10 #include "chrome/browser/history/history_service_factory.h" |
11 #include "chrome/browser/history/top_sites.h" | 11 #include "chrome/browser/history/top_sites.h" |
| 12 #include "chrome/browser/history/top_sites_factory.h" |
12 #include "chrome/browser/history/top_sites_impl.h" | 13 #include "chrome/browser/history/top_sites_impl.h" |
13 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
14 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
15 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
16 #include "components/history/core/browser/history_db_task.h" | 17 #include "components/history/core/browser/history_db_task.h" |
17 #include "components/history/core/browser/history_types.h" | 18 #include "components/history/core/browser/history_types.h" |
18 #include "components/history/core/browser/top_sites_cache.h" | 19 #include "components/history/core/browser/top_sites_cache.h" |
19 #include "components/history/core/test/history_unittest_base.h" | 20 #include "components/history/core/test/history_unittest_base.h" |
20 #include "content/public/test/test_browser_thread.h" | 21 #include "content/public/test/test_browser_thread.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // Waits for top sites to finish processing a task. This is useful if you need | 188 // Waits for top sites to finish processing a task. This is useful if you need |
188 // to wait until top sites finishes processing a task. | 189 // to wait until top sites finishes processing a task. |
189 void WaitForTopSites() { | 190 void WaitForTopSites() { |
190 top_sites()->backend_->DoEmptyRequest( | 191 top_sites()->backend_->DoEmptyRequest( |
191 base::Bind(&TopSitesImplTest::QuitCallback, base::Unretained(this)), | 192 base::Bind(&TopSitesImplTest::QuitCallback, base::Unretained(this)), |
192 &top_sites_tracker_); | 193 &top_sites_tracker_); |
193 base::MessageLoop::current()->Run(); | 194 base::MessageLoop::current()->Run(); |
194 } | 195 } |
195 | 196 |
196 TopSitesImpl* top_sites() { | 197 TopSitesImpl* top_sites() { |
197 return static_cast<TopSitesImpl*>(profile_->GetTopSites()); | 198 return static_cast<TopSitesImpl*>( |
| 199 TopSitesFactory::GetForProfile(profile_.get()).get()); |
198 } | 200 } |
199 TestingProfile* profile() {return profile_.get();} | 201 TestingProfile* profile() {return profile_.get();} |
200 HistoryService* history_service() { | 202 HistoryService* history_service() { |
201 return HistoryServiceFactory::GetForProfile( | 203 return HistoryServiceFactory::GetForProfile( |
202 profile_.get(), ServiceAccessType::EXPLICIT_ACCESS); | 204 profile_.get(), ServiceAccessType::EXPLICIT_ACCESS); |
203 } | 205 } |
204 | 206 |
205 MostVisitedURLList GetPrepopulatePages() { | 207 MostVisitedURLList GetPrepopulatePages() { |
206 return top_sites()->GetPrepopulatePages(); | 208 return top_sites()->GetPrepopulatePages(); |
207 } | 209 } |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1632 ASSERT_EQ(orig_thumbnail.getSize(), thumbnail.getSize()); | 1634 ASSERT_EQ(orig_thumbnail.getSize(), thumbnail.getSize()); |
1633 orig_thumbnail.lockPixels(); | 1635 orig_thumbnail.lockPixels(); |
1634 thumbnail.lockPixels(); | 1636 thumbnail.lockPixels(); |
1635 EXPECT_EQ(0, memcmp(orig_thumbnail.getPixels(), thumbnail.getPixels(), | 1637 EXPECT_EQ(0, memcmp(orig_thumbnail.getPixels(), thumbnail.getPixels(), |
1636 orig_thumbnail.getSize())); | 1638 orig_thumbnail.getSize())); |
1637 thumbnail.unlockPixels(); | 1639 thumbnail.unlockPixels(); |
1638 orig_thumbnail.unlockPixels(); | 1640 orig_thumbnail.unlockPixels(); |
1639 } | 1641 } |
1640 | 1642 |
1641 } // namespace history | 1643 } // namespace history |
OLD | NEW |