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

Unified Diff: chrome/browser/importer/ie_importer_unittest_win.cc

Issue 9691059: Cleanup: Remove remaining deprecated file_util functions. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 months 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 | « base/file_util_deprecated.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/importer/ie_importer_unittest_win.cc
===================================================================
--- chrome/browser/importer/ie_importer_unittest_win.cc (revision 126437)
+++ chrome/browser/importer/ie_importer_unittest_win.cc (working copy)
@@ -135,7 +135,7 @@
return true;
}
-bool CreateUrlFile(const string16& file, const string16& url) {
+bool CreateUrlFile(const FilePath& file, const string16& url) {
base::win::ScopedComPtr<IUniformResourceLocator> locator;
HRESULT result = locator.CreateInstance(CLSID_InternetShortcut, NULL,
CLSCTX_INPROC_SERVER);
@@ -148,7 +148,7 @@
result = locator->SetURL(url.c_str(), 0);
if (FAILED(result))
return false;
- result = persist_file->Save(file.c_str(), TRUE);
+ result = persist_file->Save(file.value().c_str(), TRUE);
if (FAILED(result))
return false;
return true;
@@ -353,30 +353,34 @@
TEST_F(IEImporterTest, IEImporter) {
// Sets up a favorites folder.
base::win::ScopedCOMInitializer com_init;
- string16 path = temp_dir_.path().AppendASCII("Favorites").value();
- CreateDirectory(path.c_str(), NULL);
- CreateDirectory((path + L"\\SubFolder").c_str(), NULL);
- CreateDirectory((path + L"\\Links").c_str(), NULL);
- CreateDirectory((path + L"\\Links\\SubFolderOfLinks").c_str(), NULL);
- CreateDirectory((path + L"\\\x0061").c_str(), NULL);
- ASSERT_TRUE(CreateUrlFile(path + L"\\Google Home Page.url",
+ FilePath path = temp_dir_.path().AppendASCII("Favorites");
+ CreateDirectory(path.value().c_str(), NULL);
+ CreateDirectory(path.AppendASCII("SubFolder").value().c_str(), NULL);
+ FilePath links_path = path.AppendASCII("Links");
+ CreateDirectory(links_path.value().c_str(), NULL);
+ CreateDirectory(links_path.AppendASCII("SubFolderOfLinks").value().c_str(),
+ NULL);
+ CreateDirectory(path.AppendASCII("\x0061").value().c_str(), NULL);
+ ASSERT_TRUE(CreateUrlFile(path.AppendASCII("Google Home Page.url"),
L"http://www.google.com/"));
- ASSERT_TRUE(CreateUrlFile(path + L"\\SubFolder\\Title.url",
+ ASSERT_TRUE(CreateUrlFile(path.AppendASCII("SubFolder\\Title.url"),
L"http://www.link.com/"));
- ASSERT_TRUE(CreateUrlFile(path + L"\\SubFolder.url",
+ ASSERT_TRUE(CreateUrlFile(path.AppendASCII("SubFolder.url"),
L"http://www.subfolder.com/"));
- ASSERT_TRUE(CreateUrlFile(path + L"\\TheLink.url",
+ ASSERT_TRUE(CreateUrlFile(path.AppendASCII("TheLink.url"),
L"http://www.links-thelink.com/"));
- ASSERT_TRUE(CreateUrlFile(path + L"\\WithPortAndQuery.url",
+ ASSERT_TRUE(CreateUrlFile(path.AppendASCII("WithPortAndQuery.url"),
L"http://host:8080/cgi?q=query"));
- ASSERT_TRUE(CreateUrlFile(path + L"\\\x0061\\\x4E2D\x6587.url",
- L"http://chinese-title-favorite/"));
- ASSERT_TRUE(CreateUrlFile(path + L"\\Links\\TheLink.url",
+ ASSERT_TRUE(CreateUrlFile(
+ path.AppendASCII("\x0061").Append(L"\x4E2D\x6587.url"),
+ L"http://chinese-title-favorite/"));
+ ASSERT_TRUE(CreateUrlFile(links_path.AppendASCII("TheLink.url"),
L"http://www.links-thelink.com/"));
- ASSERT_TRUE(CreateUrlFile(path + L"\\Links\\SubFolderOfLinks\\SubLink.url",
- L"http://www.links-sublink.com/"));
- file_util::WriteFile(path + L"\\InvalidUrlFile.url", "x", 1);
- file_util::WriteFile(path + L"\\PlainTextFile.txt", "x", 1);
+ ASSERT_TRUE(CreateUrlFile(
+ links_path.AppendASCII("SubFolderOfLinks").AppendASCII("SubLink.url"),
+ L"http://www.links-sublink.com/"));
+ file_util::WriteFile(path.AppendASCII("InvalidUrlFile.url"), "x", 1);
+ file_util::WriteFile(path.AppendASCII("PlainTextFile.txt"), "x", 1);
const char16* root_links[] = {
L"Links",
@@ -432,16 +436,16 @@
TEST_F(IEImporterTest, IEImporterMalformedFavoritesRegistry) {
// Sets up a favorites folder.
base::win::ScopedCOMInitializer com_init;
- string16 path = temp_dir_.path().AppendASCII("Favorites").value();
- CreateDirectory(path.c_str(), NULL);
- CreateDirectory((path + L"\\b").c_str(), NULL);
- ASSERT_TRUE(CreateUrlFile(path + L"\\a.url",
+ FilePath path = temp_dir_.path().AppendASCII("Favorites");
+ CreateDirectory(path.value().c_str(), NULL);
+ CreateDirectory(path.AppendASCII("b").value().c_str(), NULL);
+ ASSERT_TRUE(CreateUrlFile(path.AppendASCII("a.url"),
L"http://www.google.com/0"));
- ASSERT_TRUE(CreateUrlFile(path + L"\\b\\a.url",
+ ASSERT_TRUE(CreateUrlFile(path.AppendASCII("b").AppendASCII("a.url"),
L"http://www.google.com/1"));
- ASSERT_TRUE(CreateUrlFile(path + L"\\b\\b.url",
+ ASSERT_TRUE(CreateUrlFile(path.AppendASCII("b").AppendASCII("b.url"),
L"http://www.google.com/2"));
- ASSERT_TRUE(CreateUrlFile(path + L"\\c.url",
+ ASSERT_TRUE(CreateUrlFile(path.AppendASCII("c.url"),
L"http://www.google.com/3"));
struct BadBinaryData {
« no previous file with comments | « base/file_util_deprecated.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698