summaryrefslogtreecommitdiffstats
path: root/chrome/browser/visitedlink
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-13 00:25:10 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-13 00:25:10 +0000
commit883025fbdea24cd612344a6953b9ddac49dcc0eb (patch)
treec44a6ad9c7bc608c60889d951d68756a70719509 /chrome/browser/visitedlink
parentf65e0a1e6d32566d77014b3ff1f9ae6d5a5efae3 (diff)
downloadchromium_src-883025fbdea24cd612344a6953b9ddac49dcc0eb.zip
chromium_src-883025fbdea24cd612344a6953b9ddac49dcc0eb.tar.gz
chromium_src-883025fbdea24cd612344a6953b9ddac49dcc0eb.tar.bz2
wstring: fix visitedlink_perftest
For some reason we weren't running this on Linux, despite it working fine. BUG=23581 TEST=enabling a test Review URL: http://codereview.chromium.org/6182006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71266 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/visitedlink')
-rw-r--r--chrome/browser/visitedlink/visitedlink_perftest.cc26
1 files changed, 8 insertions, 18 deletions
diff --git a/chrome/browser/visitedlink/visitedlink_perftest.cc b/chrome/browser/visitedlink/visitedlink_perftest.cc
index 7d44b59..299515f 100644
--- a/chrome/browser/visitedlink/visitedlink_perftest.cc
+++ b/chrome/browser/visitedlink/visitedlink_perftest.cc
@@ -45,14 +45,6 @@ class DummyVisitedLinkEventListener : public VisitedLinkMaster::Listener {
};
-// Call at the beginning of the test to retrieve the database name.
-void InitDBName(std::wstring* db_name) {
- FilePath db_path;
- ASSERT_TRUE(file_util::GetCurrentDirectory(&db_path));
- db_path = db_path.AppendASCII("TempVisitedLinks");
- *db_name = db_path.ToWStringHack();
-}
-
// this checks IsVisited for the URLs starting with the given prefix and
// within the given range
void CheckVisited(VisitedLinkMaster& master, const char* prefix,
@@ -71,13 +63,12 @@ void FillTable(VisitedLinkMaster& master, const char* prefix,
class VisitedLink : public testing::Test {
protected:
- std::wstring db_name_;
+ FilePath db_path_;
virtual void SetUp() {
- InitDBName(&db_name_);
- file_util::Delete(db_name_, false);
+ ASSERT_TRUE(file_util::CreateTemporaryFile(&db_path_));
}
virtual void TearDown() {
- file_util::Delete(db_name_, false);
+ file_util::Delete(db_path_, false);
}
};
@@ -91,7 +82,7 @@ class VisitedLink : public testing::Test {
TEST_F(VisitedLink, TestAddAndQuery) {
// init
VisitedLinkMaster master(DummyVisitedLinkEventListener::GetInstance(),
- NULL, true, FilePath(db_name_), 0);
+ NULL, true, db_path_, 0);
ASSERT_TRUE(master.Init());
PerfTimeLogger timer("Visited_link_add_and_query");
@@ -122,7 +113,7 @@ TEST_F(VisitedLink, TestLoad) {
PerfTimeLogger table_initialization_timer("Table_initialization");
VisitedLinkMaster master(DummyVisitedLinkEventListener::GetInstance(),
- NULL, true, FilePath(db_name_), 0);
+ NULL, true, db_path_, 0);
// time init with empty table
PerfTimeLogger initTimer("Empty_visited_link_init");
@@ -153,8 +144,7 @@ TEST_F(VisitedLink, TestLoad) {
std::vector<double> hot_load_times;
for (int i = 0; i < load_count; i++) {
// make sure the file has to be re-loaded
- file_util::EvictFileFromSystemCache(
- FilePath::FromWStringHack(std::wstring(db_name_)));
+ file_util::EvictFileFromSystemCache(db_path_);
// cold load (no OS cache, hopefully)
{
@@ -163,7 +153,7 @@ TEST_F(VisitedLink, TestLoad) {
VisitedLinkMaster master(DummyVisitedLinkEventListener::GetInstance(),
NULL,
true,
- FilePath(db_name_),
+ db_path_,
0);
bool success = master.Init();
TimeDelta elapsed = cold_timer.Elapsed();
@@ -179,7 +169,7 @@ TEST_F(VisitedLink, TestLoad) {
VisitedLinkMaster master(DummyVisitedLinkEventListener::GetInstance(),
NULL,
true,
- FilePath(db_name_),
+ db_path_,
0);
bool success = master.Init();
TimeDelta elapsed = hot_timer.Elapsed();