From b647e0b22430373766687242da51ee1453a19558 Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Mon, 4 May 2009 17:50:31 +0000 Subject: Deprecate wstring version of PathService::Get() in unit tests. Review URL: http://codereview.chromium.org/100292 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15221 0039d316-1c4b-4281-b951-d872f2087c98 --- .../browser/search_engines/template_url_model_unittest.cc | 9 ++++----- .../browser/search_engines/template_url_parser_unittest.cc | 13 ++++++------- 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'chrome/browser/search_engines') diff --git a/chrome/browser/search_engines/template_url_model_unittest.cc b/chrome/browser/search_engines/template_url_model_unittest.cc index 8c0ea36..4a4bace 100644 --- a/chrome/browser/search_engines/template_url_model_unittest.cc +++ b/chrome/browser/search_engines/template_url_model_unittest.cc @@ -39,16 +39,15 @@ class TemplateURLModelTestingProfile : public TestingProfile { void SetUp() { // Name a subdirectory of the temp directory. ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &test_dir_)); - file_util::AppendToPath(&test_dir_, L"TemplateURLModelTest"); + test_dir_ = test_dir_.AppendASCII("TemplateURLModelTest"); // Create a fresh, empty copy of this directory. file_util::Delete(test_dir_, true); file_util::CreateDirectory(test_dir_); - std::wstring path = test_dir_; - file_util::AppendToPath(&path, L"TestDataService.db"); + FilePath path = test_dir_.AppendASCII("TestDataService.db"); service_ = new WebDataService; - EXPECT_TRUE(service_->InitWithPath(FilePath::FromWStringHack(path))); + EXPECT_TRUE(service_->InitWithPath(path)); } void TearDown() { @@ -64,7 +63,7 @@ class TemplateURLModelTestingProfile : public TestingProfile { private: scoped_refptr service_; - std::wstring test_dir_; + FilePath test_dir_; }; // Trivial subclass of TemplateURLModel that records the last invocation of diff --git a/chrome/browser/search_engines/template_url_parser_unittest.cc b/chrome/browser/search_engines/template_url_parser_unittest.cc index bac35c4..77c794c 100644 --- a/chrome/browser/search_engines/template_url_parser_unittest.cc +++ b/chrome/browser/search_engines/template_url_parser_unittest.cc @@ -17,11 +17,11 @@ class TemplateURLParserTest : public testing::Test { virtual void SetUp() { ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &full_path_)); - file_util::AppendToPath(&full_path_, L"osdd"); + full_path_ = full_path_.AppendASCII("osdd"); if (!file_util::PathExists(full_path_)) { LOG(ERROR) << L"This test can't be run without some non-redistributable data"; - full_path_.clear(); + full_path_ = FilePath(); } } @@ -35,12 +35,11 @@ class TemplateURLParserTest : public testing::Test { // use a return value due to internally using ASSERT_). void ParseFile(const std::wstring& file_name, TemplateURLParser::ParameterFilter* filter) { - std::wstring full_path(full_path_); - file_util::AppendToPath(&full_path, file_name); + FilePath full_path; parse_result_ = false; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &full_path)); - file_util::AppendToPath(&full_path, L"osdd"); - file_util::AppendToPath(&full_path, file_name); + full_path = full_path.AppendASCII("osdd"); + full_path = full_path.Append(FilePath::FromWStringHack(file_name)); ASSERT_TRUE(file_util::PathExists(full_path)); std::string contents; @@ -53,7 +52,7 @@ class TemplateURLParserTest : public testing::Test { // ParseFile parses the results into this template_url. TemplateURL template_url_; - std::wstring full_path_; + FilePath full_path_; // Result of the parse. bool parse_result_; -- cgit v1.1