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

Unified Diff: chrome/browser/visitedlink_perftest.cc

Issue 12893: Get rid of kPathSeparator on windows. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 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
« no previous file with comments | « chrome/browser/url_fetcher_unittest.cc ('k') | chrome/browser/webdata/web_database_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/visitedlink_perftest.cc
===================================================================
--- chrome/browser/visitedlink_perftest.cc (revision 6271)
+++ chrome/browser/visitedlink_perftest.cc (working copy)
@@ -34,14 +34,12 @@
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 @@
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 @@
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)
{
« no previous file with comments | « chrome/browser/url_fetcher_unittest.cc ('k') | chrome/browser/webdata/web_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698