Commit ef5ff1b4 authored by thestig@chromium.org's avatar thestig@chromium.org

Fix to use FilePath version of PathService::Get.

BUG=None
TEST=None

Original Review URL: http://codereview.chromium.org/174189
Patch from Thiago Farina <thiago.farina@gmail.com>.
Review URL: http://codereview.chromium.org/193047

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25778 0039d316-1c4b-4281-b951-d872f2087c98
parent 0bbb1b1f
...@@ -74,14 +74,14 @@ FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) { ...@@ -74,14 +74,14 @@ FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) {
void ResourceBundle::LoadThemeResources() { void ResourceBundle::LoadThemeResources() {
DCHECK(NULL == theme_data_) << "theme dll already loaded"; DCHECK(NULL == theme_data_) << "theme dll already loaded";
std::wstring theme_data_path; FilePath theme_data_path;
PathService::Get(app::DIR_THEMES, &theme_data_path); PathService::Get(app::DIR_THEMES, &theme_data_path);
file_util::AppendToPath(&theme_data_path, L"default.dll"); theme_data_path = theme_data_path.AppendASCII("default.dll");
// The dll should only have resources, not executable code. // The dll should only have resources, not executable code.
theme_data_ = LoadLibraryEx(theme_data_path.c_str(), NULL, theme_data_ = LoadLibraryEx(theme_data_path.value().c_str(), NULL,
GetDataDllLoadFlags()); GetDataDllLoadFlags());
DCHECK(theme_data_ != NULL) << "unable to load " << theme_data_path; DCHECK(theme_data_ != NULL) << "unable to load " << theme_data_path.value();
} }
/* static */ /* static */
......
...@@ -32,7 +32,7 @@ typedef struct { ...@@ -32,7 +32,7 @@ typedef struct {
// static // static
FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() { FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() {
std::wstring app_path; FilePath app_path;
if (!PathService::Get(base::FILE_MODULE, &app_path)) if (!PathService::Get(base::FILE_MODULE, &app_path))
return NULL; return NULL;
......
...@@ -13,12 +13,12 @@ namespace { ...@@ -13,12 +13,12 @@ namespace {
class FileVersionInfoTest : public testing::Test { class FileVersionInfoTest : public testing::Test {
}; };
std::wstring GetTestDataPath() { FilePath GetTestDataPath() {
std::wstring path; FilePath path;
PathService::Get(base::DIR_SOURCE_ROOT, &path); PathService::Get(base::DIR_SOURCE_ROOT, &path);
file_util::AppendToPath(&path, L"base"); path = path.AppendASCII("base");
file_util::AppendToPath(&path, L"data"); path = path.AppendASCII("data");
file_util::AppendToPath(&path, L"file_version_info_unittest"); path = path.AppendASCII("file_version_info_unittest");
return path; return path;
} }
...@@ -47,12 +47,11 @@ TEST(FileVersionInfoTest, HardCodedProperties) { ...@@ -47,12 +47,11 @@ TEST(FileVersionInfoTest, HardCodedProperties) {
L"This is the legal copyright", // legal_copyright L"This is the legal copyright", // legal_copyright
L"This is the legal trademarks", // legal_trademarks L"This is the legal trademarks", // legal_trademarks
L"This is the last change", // last_change L"This is the last change", // last_change
}; };
for (int i = 0; i < arraysize(kDLLNames); ++i) { for (int i = 0; i < arraysize(kDLLNames); ++i) {
std::wstring dll_path = GetTestDataPath(); FilePath dll_path = GetTestDataPath();
file_util::AppendToPath(&dll_path, kDLLNames[i]); dll_path = dll_path.Append(kDLLNames[i]);
scoped_ptr<FileVersionInfo> version_info( scoped_ptr<FileVersionInfo> version_info(
FileVersionInfo::CreateFileVersionInfo(dll_path)); FileVersionInfo::CreateFileVersionInfo(dll_path));
...@@ -93,8 +92,8 @@ TEST(FileVersionInfoTest, IsOfficialBuild) { ...@@ -93,8 +92,8 @@ TEST(FileVersionInfoTest, IsOfficialBuild) {
ASSERT_EQ(arraysize(kDLLNames), arraysize(kExpected)); ASSERT_EQ(arraysize(kDLLNames), arraysize(kExpected));
for (int i = 0; i < arraysize(kDLLNames); ++i) { for (int i = 0; i < arraysize(kDLLNames); ++i) {
std::wstring dll_path = GetTestDataPath(); FilePath dll_path = GetTestDataPath();
file_util::AppendToPath(&dll_path, kDLLNames[i]); dll_path = dll_path.Append(kDLLNames[i]);
scoped_ptr<FileVersionInfo> version_info( scoped_ptr<FileVersionInfo> version_info(
FileVersionInfo::CreateFileVersionInfo(dll_path)); FileVersionInfo::CreateFileVersionInfo(dll_path));
...@@ -105,8 +104,8 @@ TEST(FileVersionInfoTest, IsOfficialBuild) { ...@@ -105,8 +104,8 @@ TEST(FileVersionInfoTest, IsOfficialBuild) {
#endif #endif
TEST(FileVersionInfoTest, CustomProperties) { TEST(FileVersionInfoTest, CustomProperties) {
std::wstring dll_path = GetTestDataPath(); FilePath dll_path = GetTestDataPath();
file_util::AppendToPath(&dll_path, L"FileVersionInfoTest1.dll"); dll_path = dll_path.AppendASCII("FileVersionInfoTest1.dll");
scoped_ptr<FileVersionInfo> version_info( scoped_ptr<FileVersionInfo> version_info(
FileVersionInfo::CreateFileVersionInfo(dll_path)); FileVersionInfo::CreateFileVersionInfo(dll_path));
......
...@@ -37,10 +37,10 @@ class BlockedPopupContainerInteractiveTest : public UITest { ...@@ -37,10 +37,10 @@ class BlockedPopupContainerInteractiveTest : public UITest {
ASSERT_TRUE(tab_.get()); ASSERT_TRUE(tab_.get());
} }
void NavigateMainTabTo(const std::wstring& file_name) { void NavigateMainTabTo(const std::string& file_name) {
FilePath filename(test_data_directory_); FilePath filename(test_data_directory_);
filename = filename.AppendASCII("constrained_files"); filename = filename.AppendASCII("constrained_files");
filename = filename.Append(FilePath::FromWStringHack(file_name)); filename = filename.AppendASCII(file_name);
ASSERT_TRUE(tab_->NavigateToURL(net::FilePathToFileURL(filename))); ASSERT_TRUE(tab_->NavigateToURL(net::FilePathToFileURL(filename)));
} }
...@@ -62,7 +62,7 @@ class BlockedPopupContainerInteractiveTest : public UITest { ...@@ -62,7 +62,7 @@ class BlockedPopupContainerInteractiveTest : public UITest {
}; };
TEST_F(BlockedPopupContainerInteractiveTest, TestOpenAndResizeTo) { TEST_F(BlockedPopupContainerInteractiveTest, TestOpenAndResizeTo) {
NavigateMainTabTo(L"constrained_window_onload_resizeto.html"); NavigateMainTabTo("constrained_window_onload_resizeto.html");
SimulateClickInCenterOf(window_); SimulateClickInCenterOf(window_);
ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 1000)); ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 1000));
...@@ -140,7 +140,7 @@ bool ParseCountOutOfTitle(const std::wstring& title, int* output) { ...@@ -140,7 +140,7 @@ bool ParseCountOutOfTitle(const std::wstring& title, int* output) {
// Tests that in the window.open() equivalent of a fork bomb, we stop building // Tests that in the window.open() equivalent of a fork bomb, we stop building
// windows. // windows.
TEST_F(BlockedPopupContainerInteractiveTest, DontSpawnEndlessPopups) { TEST_F(BlockedPopupContainerInteractiveTest, DontSpawnEndlessPopups) {
NavigateMainTabTo(L"infinite_popups.html"); NavigateMainTabTo("infinite_popups.html");
SimulateClickInCenterOf(window_); SimulateClickInCenterOf(window_);
ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 1000)); ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 1000));
...@@ -183,7 +183,7 @@ TEST_F(BlockedPopupContainerInteractiveTest, DontSpawnEndlessPopups) { ...@@ -183,7 +183,7 @@ TEST_F(BlockedPopupContainerInteractiveTest, DontSpawnEndlessPopups) {
// Make sure that we refuse to close windows when a constrained popup is // Make sure that we refuse to close windows when a constrained popup is
// displayed. // displayed.
TEST_F(BlockedPopupContainerInteractiveTest, WindowOpenWindowClosePopup) { TEST_F(BlockedPopupContainerInteractiveTest, WindowOpenWindowClosePopup) {
NavigateMainTabTo(L"openclose_main.html"); NavigateMainTabTo("openclose_main.html");
SimulateClickInCenterOf(window_); SimulateClickInCenterOf(window_);
ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 5000)); ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 5000));
...@@ -202,7 +202,7 @@ TEST_F(BlockedPopupContainerInteractiveTest, WindowOpenWindowClosePopup) { ...@@ -202,7 +202,7 @@ TEST_F(BlockedPopupContainerInteractiveTest, WindowOpenWindowClosePopup) {
} }
TEST_F(BlockedPopupContainerInteractiveTest, BlockAlertFromBlockedPopup) { TEST_F(BlockedPopupContainerInteractiveTest, BlockAlertFromBlockedPopup) {
NavigateMainTabTo(L"block_alert.html"); NavigateMainTabTo("block_alert.html");
// Wait for there to be an app modal dialog (and fail if it's shown). // Wait for there to be an app modal dialog (and fail if it's shown).
ASSERT_FALSE(automation()->WaitForAppModalDialog(4000)); ASSERT_FALSE(automation()->WaitForAppModalDialog(4000));
...@@ -219,7 +219,7 @@ TEST_F(BlockedPopupContainerInteractiveTest, BlockAlertFromBlockedPopup) { ...@@ -219,7 +219,7 @@ TEST_F(BlockedPopupContainerInteractiveTest, BlockAlertFromBlockedPopup) {
} }
TEST_F(BlockedPopupContainerInteractiveTest, ShowAlertFromNormalPopup) { TEST_F(BlockedPopupContainerInteractiveTest, ShowAlertFromNormalPopup) {
NavigateMainTabTo(L"show_alert.html"); NavigateMainTabTo("show_alert.html");
SimulateClickInCenterOf(window_); SimulateClickInCenterOf(window_);
ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 5000)); ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 5000));
...@@ -246,7 +246,7 @@ TEST_F(BlockedPopupContainerInteractiveTest, ShowAlertFromNormalPopup) { ...@@ -246,7 +246,7 @@ TEST_F(BlockedPopupContainerInteractiveTest, ShowAlertFromNormalPopup) {
// Make sure that window focus works while creating a popup window so that we // Make sure that window focus works while creating a popup window so that we
// don't // don't
TEST_F(BlockedPopupContainerInteractiveTest, DontBreakOnBlur) { TEST_F(BlockedPopupContainerInteractiveTest, DontBreakOnBlur) {
NavigateMainTabTo(L"window_blur_test.html"); NavigateMainTabTo("window_blur_test.html");
SimulateClickInCenterOf(window_); SimulateClickInCenterOf(window_);
// Wait for the popup window to open. // Wait for the popup window to open.
......
...@@ -116,7 +116,7 @@ void RegisterURLRequestChromeJob() { ...@@ -116,7 +116,7 @@ void RegisterURLRequestChromeJob() {
} }
void UnregisterURLRequestChromeJob() { void UnregisterURLRequestChromeJob() {
std::wstring inspector_dir; FilePath inspector_dir;
if (PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) { if (PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) {
chrome_url_data_manager.RemoveFileSource("inspector"); chrome_url_data_manager.RemoveFileSource("inspector");
chrome_url_data_manager.RemoveFileSource(chrome::kChromeUIDevToolsHost); chrome_url_data_manager.RemoveFileSource(chrome::kChromeUIDevToolsHost);
......
...@@ -17,12 +17,11 @@ ...@@ -17,12 +17,11 @@
// structure as ~/Library in the Chrome test data directory. // structure as ~/Library in the Chrome test data directory.
// This function returns the path to that directory. // This function returns the path to that directory.
FilePath GetTestSafariLibraryPath() { FilePath GetTestSafariLibraryPath() {
std::wstring test_dir_wstring; FilePath test_dir;
PathService::Get(chrome::DIR_TEST_DATA, &test_dir_wstring); PathService::Get(chrome::DIR_TEST_DATA, &test_dir);
FilePath test_dir = FilePath::FromWStringHack(test_dir_wstring);
// Our simulated ~/Library directory // Our simulated ~/Library directory
test_dir = test_dir.Append("safari_import"); test_dir = test_dir.AppendASCII("safari_import");
return test_dir; return test_dir;
} }
......
...@@ -145,12 +145,13 @@ void ProcessSingleton::Create() { ...@@ -145,12 +145,13 @@ void ProcessSingleton::Create() {
ATOM clazz = RegisterClassEx(&wc); ATOM clazz = RegisterClassEx(&wc);
DCHECK(clazz); DCHECK(clazz);
std::wstring user_data_dir; FilePath user_data_dir;
PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
// Set the window's title to the path of our user data directory so other // Set the window's title to the path of our user data directory so other
// Chrome instances can decide if they should forward to us or not. // Chrome instances can decide if they should forward to us or not.
window_ = CreateWindow(chrome::kMessageWindowClass, user_data_dir.c_str(), window_ = CreateWindow(chrome::kMessageWindowClass,
user_data_dir.value().c_str(),
0, 0, 0, 0, 0, HWND_MESSAGE, 0, hinst, 0); 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hinst, 0);
DCHECK(window_); DCHECK(window_);
......
...@@ -80,11 +80,11 @@ FuncT WireExport(HMODULE module, const char* export_name) { ...@@ -80,11 +80,11 @@ FuncT WireExport(HMODULE module, const char* export_name) {
} }
HMODULE LoadRLZLibraryInternal(int directory_key) { HMODULE LoadRLZLibraryInternal(int directory_key) {
std::wstring rlz_path; FilePath rlz_path;
if (!PathService::Get(directory_key, &rlz_path)) if (!PathService::Get(directory_key, &rlz_path))
return NULL; return NULL;
file_util::AppendToPath(&rlz_path, L"rlz.dll"); rlz_path = rlz_path.AppendASCII("rlz.dll");
return ::LoadLibraryW(rlz_path.c_str()); return ::LoadLibraryW(rlz_path.value().c_str());
} }
bool LoadRLZLibrary(int directory_key) { bool LoadRLZLibrary(int directory_key) {
...@@ -261,12 +261,11 @@ class DelayedInitTask : public Task { ...@@ -261,12 +261,11 @@ class DelayedInitTask : public Task {
bool IsGoogleDefaultSearch() { bool IsGoogleDefaultSearch() {
if (!g_browser_process) if (!g_browser_process)
return false; return false;
std::wstring user_data_dir; FilePath user_data_dir;
if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir))
return false; return false;
ProfileManager* profile_manager = g_browser_process->profile_manager(); ProfileManager* profile_manager = g_browser_process->profile_manager();
Profile* profile = profile_manager-> Profile* profile = profile_manager->GetDefaultProfile(user_data_dir);
GetDefaultProfile(FilePath::FromWStringHack(user_data_dir));
if (!profile) if (!profile)
return false; return false;
const TemplateURL* url_template = const TemplateURL* url_template =
......
...@@ -1038,7 +1038,7 @@ void PrintStat(const char* name) { ...@@ -1038,7 +1038,7 @@ void PrintStat(const char* name) {
LOG(INFO) << StringPrintf("%s %d", name, value); LOG(INFO) << StringPrintf("%s %d", name, value);
} }
std::wstring GetFullSBDataPath(const std::wstring& path) { FilePath GetFullSBDataPath(const std::wstring& path) {
FilePath full_path; FilePath full_path;
CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &full_path)); CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &full_path));
full_path = full_path.AppendASCII("chrome"); full_path = full_path.AppendASCII("chrome");
...@@ -1047,7 +1047,7 @@ std::wstring GetFullSBDataPath(const std::wstring& path) { ...@@ -1047,7 +1047,7 @@ std::wstring GetFullSBDataPath(const std::wstring& path) {
full_path = full_path.AppendASCII("safe_browsing"); full_path = full_path.AppendASCII("safe_browsing");
full_path = full_path.Append(FilePath::FromWStringHack(path)); full_path = full_path.Append(FilePath::FromWStringHack(path));
CHECK(file_util::PathExists(full_path)); CHECK(file_util::PathExists(full_path));
return full_path.ToWStringHack(); return full_path;
} }
struct ChunksInfo { struct ChunksInfo {
...@@ -1070,9 +1070,8 @@ void PeformUpdate(const std::wstring& initial_db, ...@@ -1070,9 +1070,8 @@ void PeformUpdate(const std::wstring& initial_db,
file_util::Delete(path, false); file_util::Delete(path, false);
if (!initial_db.empty()) { if (!initial_db.empty()) {
std::wstring full_initial_db = GetFullSBDataPath(initial_db); FilePath full_initial_db = GetFullSBDataPath(initial_db);
ASSERT_TRUE(file_util::CopyFile( ASSERT_TRUE(file_util::CopyFile(full_initial_db, path));
FilePath::FromWStringHack(full_initial_db), path));
} }
SafeBrowsingDatabase* database = SafeBrowsingDatabase::Create(); SafeBrowsingDatabase* database = SafeBrowsingDatabase::Create();
...@@ -1129,9 +1128,8 @@ void UpdateDatabase(const std::wstring& initial_db, ...@@ -1129,9 +1128,8 @@ void UpdateDatabase(const std::wstring& initial_db,
SafeBrowsingProtocolParser parser; SafeBrowsingProtocolParser parser;
if (!updates_path.empty()) { if (!updates_path.empty()) {
std::wstring data_dir = GetFullSBDataPath(updates_path); FilePath data_dir = GetFullSBDataPath(updates_path);
file_util::FileEnumerator file_enum( file_util::FileEnumerator file_enum(data_dir, false,
FilePath::FromWStringHack(data_dir), false,
file_util::FileEnumerator::FILES); file_util::FileEnumerator::FILES);
while (true) { while (true) {
std::wstring file = file_enum.Next().ToWStringHack(); std::wstring file = file_enum.Next().ToWStringHack();
...@@ -1166,7 +1164,7 @@ void UpdateDatabase(const std::wstring& initial_db, ...@@ -1166,7 +1164,7 @@ void UpdateDatabase(const std::wstring& initial_db,
std::vector<SBChunkDelete>* deletes = new std::vector<SBChunkDelete>; std::vector<SBChunkDelete>* deletes = new std::vector<SBChunkDelete>;
if (!response_path.empty()) { if (!response_path.empty()) {
std::string update; std::string update;
std::wstring full_response_path = GetFullSBDataPath(response_path); FilePath full_response_path = GetFullSBDataPath(response_path);
if (file_util::ReadFileToString(full_response_path, &update)) { if (file_util::ReadFileToString(full_response_path, &update)) {
int next_update; int next_update;
bool result, rekey, reset; bool result, rekey, reset;
......
...@@ -33,13 +33,13 @@ class TemplateURLParserTest : public testing::Test { ...@@ -33,13 +33,13 @@ class TemplateURLParserTest : public testing::Test {
// the data dir). The TemplateURL is placed in template_url_. // the data dir). The TemplateURL is placed in template_url_.
// The result of Parse is stored in the field parse_result_ (this doesn't // The result of Parse is stored in the field parse_result_ (this doesn't
// use a return value due to internally using ASSERT_). // use a return value due to internally using ASSERT_).
void ParseFile(const std::wstring& file_name, void ParseFile(const std::string& file_name,
TemplateURLParser::ParameterFilter* filter) { TemplateURLParser::ParameterFilter* filter) {
FilePath full_path; FilePath full_path;
parse_result_ = false; parse_result_ = false;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &full_path)); ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &full_path));
full_path = full_path.AppendASCII("osdd"); full_path = full_path.AppendASCII("osdd");
full_path = full_path.Append(FilePath::FromWStringHack(file_name)); full_path = full_path.AppendASCII(file_name);
ASSERT_TRUE(file_util::PathExists(full_path)); ASSERT_TRUE(file_util::PathExists(full_path));
std::string contents; std::string contents;
...@@ -61,28 +61,28 @@ class TemplateURLParserTest : public testing::Test { ...@@ -61,28 +61,28 @@ class TemplateURLParserTest : public testing::Test {
TEST_F(TemplateURLParserTest, FailOnBogusURL) { TEST_F(TemplateURLParserTest, FailOnBogusURL) {
if (IsDisabled()) if (IsDisabled())
return; return;
ParseFile(L"bogus.xml", NULL); ParseFile("bogus.xml", NULL);
EXPECT_FALSE(parse_result_); EXPECT_FALSE(parse_result_);
} }
TEST_F(TemplateURLParserTest, PassOnHTTPS) { TEST_F(TemplateURLParserTest, PassOnHTTPS) {
if (IsDisabled()) if (IsDisabled())
return; return;
ParseFile(L"https.xml", NULL); ParseFile("https.xml", NULL);
EXPECT_TRUE(parse_result_); EXPECT_TRUE(parse_result_);
} }
TEST_F(TemplateURLParserTest, FailOnPost) { TEST_F(TemplateURLParserTest, FailOnPost) {
if (IsDisabled()) if (IsDisabled())
return; return;
ParseFile(L"post.xml", NULL); ParseFile("post.xml", NULL);
EXPECT_FALSE(parse_result_); EXPECT_FALSE(parse_result_);
} }
TEST_F(TemplateURLParserTest, TestDictionary) { TEST_F(TemplateURLParserTest, TestDictionary) {
if (IsDisabled()) if (IsDisabled())
return; return;
ParseFile(L"dictionary.xml", NULL); ParseFile("dictionary.xml", NULL);
ASSERT_TRUE(parse_result_); ASSERT_TRUE(parse_result_);
EXPECT_EQ(L"Dictionary.com", template_url_.short_name()); EXPECT_EQ(L"Dictionary.com", template_url_.short_name());
EXPECT_TRUE(template_url_.GetFavIconURL() == EXPECT_TRUE(template_url_.GetFavIconURL() ==
...@@ -96,7 +96,7 @@ TEST_F(TemplateURLParserTest, TestDictionary) { ...@@ -96,7 +96,7 @@ TEST_F(TemplateURLParserTest, TestDictionary) {
TEST_F(TemplateURLParserTest, TestMSDN) { TEST_F(TemplateURLParserTest, TestMSDN) {
if (IsDisabled()) if (IsDisabled())
return; return;
ParseFile(L"msdn.xml", NULL); ParseFile("msdn.xml", NULL);
ASSERT_TRUE(parse_result_); ASSERT_TRUE(parse_result_);
EXPECT_EQ(L"Search \" MSDN", template_url_.short_name()); EXPECT_EQ(L"Search \" MSDN", template_url_.short_name());
EXPECT_TRUE(template_url_.GetFavIconURL() == EXPECT_TRUE(template_url_.GetFavIconURL() ==
...@@ -110,7 +110,7 @@ TEST_F(TemplateURLParserTest, TestMSDN) { ...@@ -110,7 +110,7 @@ TEST_F(TemplateURLParserTest, TestMSDN) {
TEST_F(TemplateURLParserTest, TestWikipedia) { TEST_F(TemplateURLParserTest, TestWikipedia) {
if (IsDisabled()) if (IsDisabled())
return; return;
ParseFile(L"wikipedia.xml", NULL); ParseFile("wikipedia.xml", NULL);
ASSERT_TRUE(parse_result_); ASSERT_TRUE(parse_result_);
EXPECT_EQ(L"Wikipedia (English)", template_url_.short_name()); EXPECT_EQ(L"Wikipedia (English)", template_url_.short_name());
EXPECT_TRUE(template_url_.GetFavIconURL() == EXPECT_TRUE(template_url_.GetFavIconURL() ==
...@@ -131,7 +131,7 @@ TEST_F(TemplateURLParserTest, TestWikipedia) { ...@@ -131,7 +131,7 @@ TEST_F(TemplateURLParserTest, TestWikipedia) {
TEST_F(TemplateURLParserTest, NoCrashOnEmptyAttributes) { TEST_F(TemplateURLParserTest, NoCrashOnEmptyAttributes) {
if (IsDisabled()) if (IsDisabled())
return; return;
ParseFile(L"url_with_no_attributes.xml", NULL); ParseFile("url_with_no_attributes.xml", NULL);
} }
// Filters any param which as an occurrence of name_str_ in its name or an // Filters any param which as an occurrence of name_str_ in its name or an
...@@ -161,7 +161,7 @@ TEST_F(TemplateURLParserTest, TestFirefoxEbay) { ...@@ -161,7 +161,7 @@ TEST_F(TemplateURLParserTest, TestFirefoxEbay) {
// This file uses the Parameter extension // This file uses the Parameter extension
// (see http://www.opensearch.org/Specifications/OpenSearch/Extensions/Parameter/1.0) // (see http://www.opensearch.org/Specifications/OpenSearch/Extensions/Parameter/1.0)
ParamFilterImpl filter("ebay", "ebay"); ParamFilterImpl filter("ebay", "ebay");
ParseFile(L"firefox_ebay.xml", &filter); ParseFile("firefox_ebay.xml", &filter);
ASSERT_TRUE(parse_result_); ASSERT_TRUE(parse_result_);
EXPECT_EQ(L"eBay", template_url_.short_name()); EXPECT_EQ(L"eBay", template_url_.short_name());
EXPECT_TRUE(template_url_.url() != NULL); EXPECT_TRUE(template_url_.url() != NULL);
...@@ -182,7 +182,7 @@ TEST_F(TemplateURLParserTest, TestFirefoxWebster) { ...@@ -182,7 +182,7 @@ TEST_F(TemplateURLParserTest, TestFirefoxWebster) {
return; return;
// This XML file uses a namespace. // This XML file uses a namespace.
ParamFilterImpl filter("", "Mozilla"); ParamFilterImpl filter("", "Mozilla");
ParseFile(L"firefox_webster.xml", &filter); ParseFile("firefox_webster.xml", &filter);
ASSERT_TRUE(parse_result_); ASSERT_TRUE(parse_result_);
EXPECT_EQ(L"Webster", template_url_.short_name()); EXPECT_EQ(L"Webster", template_url_.short_name());
EXPECT_TRUE(template_url_.url() != NULL); EXPECT_TRUE(template_url_.url() != NULL);
...@@ -200,7 +200,7 @@ TEST_F(TemplateURLParserTest, TestFirefoxYahoo) { ...@@ -200,7 +200,7 @@ TEST_F(TemplateURLParserTest, TestFirefoxYahoo) {
return; return;
// This XML file uses a namespace. // This XML file uses a namespace.
ParamFilterImpl filter("", "Mozilla"); ParamFilterImpl filter("", "Mozilla");
ParseFile(L"firefox_yahoo.xml", &filter); ParseFile("firefox_yahoo.xml", &filter);
ASSERT_TRUE(parse_result_); ASSERT_TRUE(parse_result_);
EXPECT_EQ(L"Yahoo", template_url_.short_name()); EXPECT_EQ(L"Yahoo", template_url_.short_name());
EXPECT_TRUE(template_url_.url() != NULL); EXPECT_TRUE(template_url_.url() != NULL);
...@@ -223,7 +223,7 @@ TEST_F(TemplateURLParserTest, TestPostSuggestion) { ...@@ -223,7 +223,7 @@ TEST_F(TemplateURLParserTest, TestPostSuggestion) {
return; return;
// This XML file uses a namespace. // This XML file uses a namespace.
ParamFilterImpl filter("", "Mozilla"); ParamFilterImpl filter("", "Mozilla");
ParseFile(L"post_suggestion.xml", &filter); ParseFile("post_suggestion.xml", &filter);
ASSERT_TRUE(parse_result_); ASSERT_TRUE(parse_result_);
EXPECT_EQ(L"Yahoo", template_url_.short_name()); EXPECT_EQ(L"Yahoo", template_url_.short_name());
EXPECT_TRUE(template_url_.url() != NULL); EXPECT_TRUE(template_url_.url() != NULL);
......
...@@ -18,17 +18,17 @@ namespace { ...@@ -18,17 +18,17 @@ namespace {
class JSONValueSerializerTests : public testing::Test { class JSONValueSerializerTests : public testing::Test {
protected: protected:
virtual void SetUp() { virtual void SetUp() {
static const wchar_t* const kTestFilenames[] = { static const char* const kTestFilenames[] = {
L"serializer_nested_test.js", "serializer_nested_test.js",
L"serializer_test.js", "serializer_test.js",
L"serializer_test_nowhitespace.js", "serializer_test_nowhitespace.js",
}; };
// Load test cases // Load test cases
for (size_t i = 0; i < arraysize(kTestFilenames); ++i) { for (size_t i = 0; i < arraysize(kTestFilenames); ++i) {
std::wstring filename; FilePath filename;
EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &filename)); EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &filename));
file_util::AppendToPath(&filename, kTestFilenames[i]); filename = filename.AppendASCII(kTestFilenames[i]);
std::string test_case; std::string test_case;
EXPECT_TRUE(file_util::ReadFileToString(filename, &test_case)); EXPECT_TRUE(file_util::ReadFileToString(filename, &test_case));
......
...@@ -136,12 +136,12 @@ TEST_F(OmniboxTest, Measure) { ...@@ -136,12 +136,12 @@ TEST_F(OmniboxTest, Measure) {
if (!CommandLine::ForCurrentProcess()->HasSwitch(kRunOmniboxTest)) if (!CommandLine::ForCurrentProcess()->HasSwitch(kRunOmniboxTest))
return; return;
std::wstring omnibox_tests_path; FilePath omnibox_tests_path;
PathService::Get(chrome::DIR_TEST_DATA, &omnibox_tests_path); PathService::Get(chrome::DIR_TEST_DATA, &omnibox_tests_path);
file_util::AppendToPath(&omnibox_tests_path, L"omnibox_tests.xml"); omnibox_tests_path = omnibox_tests_path.AppendASCII("omnibox_tests.xml");
XmlReader reader; XmlReader reader;
ASSERT_TRUE(reader.LoadFile(WideToASCII(omnibox_tests_path))); ASSERT_TRUE(reader.LoadFile(WideToASCII(omnibox_tests_path.ToWStringHack())));
while (reader.SkipToElement()) { while (reader.SkipToElement()) {
ASSERT_EQ("omnibox_tests", reader.NodeName()); ASSERT_EQ("omnibox_tests", reader.NodeName());
reader.Read(); reader.Read();
......
...@@ -288,8 +288,8 @@ class BaseTestServer : public base::RefCounted<BaseTestServer> { ...@@ -288,8 +288,8 @@ class BaseTestServer : public base::RefCounted<BaseTestServer> {
virtual bool MakeGETRequest(const std::string& page_name) = 0; virtual bool MakeGETRequest(const std::string& page_name) = 0;
std::wstring GetDataDirectory() { FilePath GetDataDirectory() {
return launcher_.GetDocumentRootPath().ToWStringHack(); return launcher_.GetDocumentRootPath();
} }
protected: protected:
......
...@@ -24,7 +24,7 @@ class UnittestTestServer : public HTTPTestServer { ...@@ -24,7 +24,7 @@ class UnittestTestServer : public HTTPTestServer {
static UnittestTestServer* CreateServer() { static UnittestTestServer* CreateServer() {
UnittestTestServer* test_server = new UnittestTestServer(); UnittestTestServer* test_server = new UnittestTestServer();
FilePath no_cert; FilePath no_cert;
FilePath docroot = FilePath::FromWStringHack(L"webkit/data"); FilePath docroot(FILE_PATH_LITERAL("webkit/data"));
if (!test_server->Start(net::TestServerLauncher::ProtoHTTP, if (!test_server->Start(net::TestServerLauncher::ProtoHTTP,
"localhost", 1337, docroot, no_cert, std::wstring())) { "localhost", 1337, docroot, no_cert, std::wstring())) {
delete test_server; delete test_server;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment