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

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

Issue 815983002: Topsites become keyedService based. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extra inclusion from testing_profile.h Created 5 years, 11 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
« no previous file with comments | « chrome/browser/history/top_sites_impl.cc ('k') | chrome/browser/jumplist_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/history/top_sites_impl.cc ('k') | chrome/browser/jumplist_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698