summaryrefslogtreecommitdiffstats
path: root/chrome/browser/visitedlink_perftest.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-04 20:46:06 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-04 20:46:06 +0000
commitceeb87e90224c8743995b999661eede7c31b6346 (patch)
tree459f0698b022e42ead17cb742be9ff7f9d1b441f /chrome/browser/visitedlink_perftest.cc
parentf3208bd4c625527d854c3bf49908352199488c48 (diff)
downloadchromium_src-ceeb87e90224c8743995b999661eede7c31b6346.zip
chromium_src-ceeb87e90224c8743995b999661eede7c31b6346.tar.gz
chromium_src-ceeb87e90224c8743995b999661eede7c31b6346.tar.bz2
Get rid of kPathSeparator on windows. Port some wstring function to take FilePaths. Re-enable relevant posix unit tests.
Review URL: http://codereview.chromium.org/12893 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/visitedlink_perftest.cc')
-rw-r--r--chrome/browser/visitedlink_perftest.cc24
1 files changed, 11 insertions, 13 deletions
diff --git a/chrome/browser/visitedlink_perftest.cc b/chrome/browser/visitedlink_perftest.cc
index 328e9fe..d589f92 100644
--- a/chrome/browser/visitedlink_perftest.cc
+++ b/chrome/browser/visitedlink_perftest.cc
@@ -34,14 +34,12 @@ VisitedLinkMaster::PostNewTableEvent DummyBroadcastNewTableEvent;
void DummyBroadcastNewTableEvent(base::SharedMemory *table) {
}
-// Call at the beginning of the test to retrieve the database name and to
-// delete any old databases left by previous unit tests. The input buffer
-// should be MAX_PATH long.
-void InitDBName(wchar_t* db_name) {
- ASSERT_TRUE(GetCurrentDirectory(MAX_PATH, db_name));
- if (db_name[wcslen(db_name) - 1] != file_util::kPathSeparator)
- wcsncat_s(db_name, MAX_PATH, &file_util::kPathSeparator, 1);
- wcscat_s(db_name, MAX_PATH, L"TempVisitedLinks");
+// 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.Append(FILE_PATH_LITERAL("TempVisitedLinks"));
+ *db_name = db_path.ToWStringHack();
}
// this checks IsVisited for the URLs starting with the given prefix and
@@ -62,13 +60,13 @@ void FillTable(VisitedLinkMaster& master, const char* prefix,
class VisitedLink : public testing::Test {
protected:
- wchar_t db_name_[MAX_PATH];
+ std::wstring db_name_;
virtual void SetUp() {
- InitDBName(db_name_);
- DeleteFile(db_name_);
+ InitDBName(&db_name_);
+ file_util::Delete(db_name_, false);
}
virtual void TearDown() {
- DeleteFile(db_name_);
+ file_util::Delete(db_name_, false);
}
};
@@ -145,7 +143,7 @@ TEST_F(VisitedLink, TestLoad) {
for (int i = 0; i < load_count; i++)
{
// make sure the file has to be re-loaded
- file_util::EvictFileFromSystemCache(db_name_);
+ file_util::EvictFileFromSystemCache(db_name_.c_str());
// cold load (no OS cache, hopefully)
{