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

Unified Diff: components/visitedlink/test/visitedlink_perftest.cc

Issue 1417943002: Load the table of visited links from database file asynchronously. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add extra comment and fix compilation error. Created 5 years 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: components/visitedlink/test/visitedlink_perftest.cc
diff --git a/components/visitedlink/test/visitedlink_perftest.cc b/components/visitedlink/test/visitedlink_perftest.cc
index fd598c15d5c33da9c50835214f1d27f680128eec..4c805e5e93cdc53b642a5239b2b84ae963c20a13 100644
--- a/components/visitedlink/test/visitedlink_perftest.cc
+++ b/components/visitedlink/test/visitedlink_perftest.cc
@@ -15,6 +15,8 @@
#include "base/test/test_file_util.h"
#include "base/timer/elapsed_timer.h"
#include "components/visitedlink/browser/visitedlink_master.h"
+#include "content/public/test/test_browser_thread_bundle.h"
+#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -41,7 +43,7 @@ class DummyVisitedLinkEventListener : public VisitedLinkMaster::Listener {
DummyVisitedLinkEventListener() {}
void NewTable(base::SharedMemory* table) override {}
void Add(VisitedLinkCommon::Fingerprint) override {}
- void Reset() override {}
+ void Reset(bool invalidate_hashes) override {}
};
@@ -66,6 +68,9 @@ class VisitedLink : public testing::Test {
base::FilePath db_path_;
void SetUp() override { ASSERT_TRUE(base::CreateTemporaryFile(&db_path_)); }
void TearDown() override { base::DeleteFile(db_path_, false); }
+
+ private:
+ content::TestBrowserThreadBundle thread_bundle_;
};
} // namespace
@@ -80,6 +85,7 @@ TEST_F(VisitedLink, TestAddAndQuery) {
VisitedLinkMaster master(new DummyVisitedLinkEventListener(),
NULL, true, true, db_path_, 0);
ASSERT_TRUE(master.Init());
+ content::RunAllBlockingPoolTasksUntilIdle();
base::PerfTimeLogger timer("Visited_link_add_and_query");
@@ -114,6 +120,7 @@ TEST_F(VisitedLink, TestLoad) {
// time init with empty table
base::PerfTimeLogger initTimer("Empty_visited_link_init");
bool success = master.Init();
+ content::RunAllBlockingPoolTasksUntilIdle();
initTimer.Done();
ASSERT_TRUE(success);
@@ -153,6 +160,7 @@ TEST_F(VisitedLink, TestLoad) {
db_path_,
0);
bool success = master.Init();
+ content::RunAllBlockingPoolTasksUntilIdle();
TimeDelta elapsed = cold_timer.Elapsed();
ASSERT_TRUE(success);
@@ -170,6 +178,7 @@ TEST_F(VisitedLink, TestLoad) {
db_path_,
0);
bool success = master.Init();
+ content::RunAllBlockingPoolTasksUntilIdle();
TimeDelta elapsed = hot_timer.Elapsed();
ASSERT_TRUE(success);
« no previous file with comments | « components/visitedlink/renderer/visitedlink_slave.cc ('k') | components/visitedlink/test/visitedlink_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698