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

Side by Side Diff: chrome/common/importer/firefox_importer_utils_unittest.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/importer/firefox_importer_utils.h" 5 #include "chrome/common/importer/firefox_importer_utils.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 GetPrefsJsValueCases[i].pref_name)); 100 GetPrefsJsValueCases[i].pref_name));
101 } 101 }
102 } 102 }
103 103
104 TEST(FirefoxImporterUtilsTest, GetFirefoxImporterName) { 104 TEST(FirefoxImporterUtilsTest, GetFirefoxImporterName) {
105 base::ScopedTempDir temp_dir; 105 base::ScopedTempDir temp_dir;
106 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 106 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
107 const base::FilePath app_ini_file( 107 const base::FilePath app_ini_file(
108 temp_dir.path().AppendASCII("application.ini")); 108 temp_dir.path().AppendASCII("application.ini"));
109 for (size_t i = 0; i < arraysize(GetFirefoxImporterNameCases); ++i) { 109 for (size_t i = 0; i < arraysize(GetFirefoxImporterNameCases); ++i) {
110 file_util::WriteFile(app_ini_file, 110 base::WriteFile(app_ini_file,
111 GetFirefoxImporterNameCases[i].app_ini_content.c_str(), 111 GetFirefoxImporterNameCases[i].app_ini_content.c_str(),
112 GetFirefoxImporterNameCases[i].app_ini_content.size()); 112 GetFirefoxImporterNameCases[i].app_ini_content.size());
113 EXPECT_EQ(GetFirefoxImporterName(temp_dir.path()), 113 EXPECT_EQ(GetFirefoxImporterName(temp_dir.path()),
114 l10n_util::GetStringUTF16(GetFirefoxImporterNameCases[i].resource_id)); 114 l10n_util::GetStringUTF16(GetFirefoxImporterNameCases[i].resource_id));
115 } 115 }
116 EXPECT_EQ(l10n_util::GetStringUTF16( 116 EXPECT_EQ(l10n_util::GetStringUTF16(
117 IDS_IMPORT_FROM_FIREFOX), 117 IDS_IMPORT_FROM_FIREFOX),
118 GetFirefoxImporterName(base::FilePath( 118 GetFirefoxImporterName(base::FilePath(
119 FILE_PATH_LITERAL("/invalid/path")))); 119 FILE_PATH_LITERAL("/invalid/path"))));
120 } 120 }
121 121
122 TEST(FirefoxImporterUtilsTest, GetFirefoxProfilePath) { 122 TEST(FirefoxImporterUtilsTest, GetFirefoxProfilePath) {
(...skipping 27 matching lines...) Expand all
150 150
151 base::DictionaryValue default_second; 151 base::DictionaryValue default_second;
152 default_second.SetString("Profile0.Path", "first"); 152 default_second.SetString("Profile0.Path", "first");
153 default_second.SetString("Profile0.IsRelative", "0"); 153 default_second.SetString("Profile0.IsRelative", "0");
154 default_second.SetString("Profile1.Path", "second"); 154 default_second.SetString("Profile1.Path", "second");
155 default_second.SetString("Profile1.IsRelative", "0"); 155 default_second.SetString("Profile1.IsRelative", "0");
156 default_second.SetString("Profile1.Default", "1"); 156 default_second.SetString("Profile1.Default", "1");
157 EXPECT_EQ("second", 157 EXPECT_EQ("second",
158 GetFirefoxProfilePathFromDictionary(default_second).MaybeAsASCII()); 158 GetFirefoxProfilePathFromDictionary(default_second).MaybeAsASCII());
159 } 159 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_l10n_util_unittest.cc ('k') | chrome/common/mac/mock_launchd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698