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

Unified Diff: chrome/browser/extensions/api/top_sites/top_sites_apitest.cc

Issue 870063002: Componentize TopSites, TopSitesBackend, TopSitesDatabase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@815983002
Patch Set: Fix typo 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/top_sites/top_sites_apitest.cc
diff --git a/chrome/browser/extensions/api/top_sites/top_sites_apitest.cc b/chrome/browser/extensions/api/top_sites/top_sites_apitest.cc
index d1e36b8c591c763b1e487d49660b4c3598e2dcf9..059bb133e921056db49a0f954d1b87c5347955ac 100644
--- a/chrome/browser/extensions/api/top_sites/top_sites_apitest.cc
+++ b/chrome/browser/extensions/api/top_sites/top_sites_apitest.cc
@@ -6,11 +6,11 @@
#include "build/build_config.h"
#include "chrome/browser/extensions/api/top_sites/top_sites_api.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
-#include "chrome/browser/history/top_sites.h"
#include "chrome/browser/history/top_sites_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/in_process_browser_test.h"
+#include "components/history/core/browser/top_sites.h"
namespace utils = extension_function_test_utils;
@@ -20,13 +20,18 @@ namespace {
class TopSitesExtensionTest : public InProcessBrowserTest {
public:
- TopSitesExtensionTest() : top_sites_inited_(false), waiting_(false) {
- }
+ TopSitesExtensionTest()
+ : top_sites_prepopulated_pages_size_(0),
+ top_sites_inited_(false),
+ waiting_(false) {}
void SetUpOnMainThread() override {
scoped_refptr<history::TopSites> top_sites =
TopSitesFactory::GetForProfile(browser()->profile());
+ top_sites_prepopulated_pages_size_ =
+ top_sites->GetPrepopulatedPages().size();
+
// This may return async or sync. If sync, top_sites_inited_ will be true
// before we get to the conditional below. Otherwise, we'll run a nested
// message loop until the async callback.
@@ -41,6 +46,10 @@ class TopSitesExtensionTest : public InProcessBrowserTest {
// By this point, we know topsites has loaded. We can run the tests now.
}
+ size_t top_sites_prepopulated_pages_size() const {
+ return top_sites_prepopulated_pages_size_;
+ }
+
private:
void OnTopSitesAvailable(const history::MostVisitedURLList& data) {
if (waiting_) {
@@ -50,6 +59,7 @@ class TopSitesExtensionTest : public InProcessBrowserTest {
top_sites_inited_ = true;
}
+ size_t top_sites_prepopulated_pages_size_;
bool top_sites_inited_;
bool waiting_;
};
@@ -66,7 +76,7 @@ IN_PROC_BROWSER_TEST_F(TopSitesExtensionTest, GetTopSites) {
get_top_sites_function.get(), "[]", browser()));
base::ListValue* list;
ASSERT_TRUE(result->GetAsList(&list));
- EXPECT_GE(list->GetSize(), arraysize(history::kPrepopulatedPages));
+ EXPECT_GE(list->GetSize(), top_sites_prepopulated_pages_size());
}
} // namespace extensions
« 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