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

Side by Side Diff: chrome/browser/extensions/api/top_sites/top_sites_apitest.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, 10 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
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/values.h" 5 #include "base/values.h"
6 #include "build/build_config.h" 6 #include "build/build_config.h"
7 #include "chrome/browser/extensions/api/top_sites/top_sites_api.h" 7 #include "chrome/browser/extensions/api/top_sites/top_sites_api.h"
8 #include "chrome/browser/extensions/extension_function_test_utils.h" 8 #include "chrome/browser/extensions/extension_function_test_utils.h"
9 #include "chrome/browser/history/top_sites.h" 9 #include "chrome/browser/history/top_sites.h"
10 #include "chrome/browser/history/top_sites_factory.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
12 #include "chrome/test/base/in_process_browser_test.h" 13 #include "chrome/test/base/in_process_browser_test.h"
13 14
14 namespace utils = extension_function_test_utils; 15 namespace utils = extension_function_test_utils;
15 16
16 namespace extensions { 17 namespace extensions {
17 18
18 namespace { 19 namespace {
19 20
20 class TopSitesExtensionTest : public InProcessBrowserTest { 21 class TopSitesExtensionTest : public InProcessBrowserTest {
21 public: 22 public:
22 TopSitesExtensionTest() : top_sites_inited_(false), waiting_(false) { 23 TopSitesExtensionTest() : top_sites_inited_(false), waiting_(false) {
23 } 24 }
24 25
25 void SetUpOnMainThread() override { 26 void SetUpOnMainThread() override {
26 history::TopSites* top_sites = browser()->profile()->GetTopSites(); 27 scoped_refptr<history::TopSites> top_sites =
28 TopSitesFactory::GetForProfile(browser()->profile());
27 29
28 // This may return async or sync. If sync, top_sites_inited_ will be true 30 // This may return async or sync. If sync, top_sites_inited_ will be true
29 // before we get to the conditional below. Otherwise, we'll run a nested 31 // before we get to the conditional below. Otherwise, we'll run a nested
30 // message loop until the async callback. 32 // message loop until the async callback.
31 top_sites->GetMostVisitedURLs( 33 top_sites->GetMostVisitedURLs(
32 base::Bind(&TopSitesExtensionTest::OnTopSitesAvailable, this), false); 34 base::Bind(&TopSitesExtensionTest::OnTopSitesAvailable, this), false);
33 35
34 if (!top_sites_inited_) { 36 if (!top_sites_inited_) {
35 waiting_ = true; 37 waiting_ = true;
36 base::MessageLoop::current()->Run(); 38 base::MessageLoop::current()->Run();
(...skipping 24 matching lines...) Expand all
61 get_top_sites_function->set_has_callback(true); 63 get_top_sites_function->set_has_callback(true);
62 64
63 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( 65 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult(
64 get_top_sites_function.get(), "[]", browser())); 66 get_top_sites_function.get(), "[]", browser()));
65 base::ListValue* list; 67 base::ListValue* list;
66 ASSERT_TRUE(result->GetAsList(&list)); 68 ASSERT_TRUE(result->GetAsList(&list));
67 EXPECT_GE(list->GetSize(), arraysize(history::kPrepopulatedPages)); 69 EXPECT_GE(list->GetSize(), arraysize(history::kPrepopulatedPages));
68 } 70 }
69 71
70 } // namespace extensions 72 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/top_sites/top_sites_api.cc ('k') | chrome/browser/history/expire_history_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698