0

Move ReadFileToString to the base namespace.

BUG=

Review URL: https://codereview.chromium.org/19579005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220612 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
brettw@chromium.org
2013-08-30 18:23:50 +00:00
parent 88a8115978
commit 82f84b91a1
253 changed files with 387 additions and 413 deletions
ash/desktop_background
base
cc
chrome
browser
autofill
browser_shutdown.cc
chromeos
component_updater
diagnostics
download
drive
extensions
feedback
google
google_apis
history
icon_loader_linux.cc
media
media_galleries
nacl_host
net
page_cycler
policy
printing
profiles
renderer_host
safe_browsing
search_engines
sessions
shell_integration_linux.cc
spellchecker
ssl
sxs_linux.cc
sync
sync_file_system
ui
upload_list.ccuser_style_sheet_watcher.cc
common
installer
service
test
utility
chrome_frame/test
chromeos
cloud_print
components
content
courgette
extensions/browser
gpu
jingle/glue
net
printing
remoting
sandbox/win/src
skia/ext
testing/android
third_party/zlib/google
tools
ui/gfx
webkit

@ -115,7 +115,7 @@ class DesktopBackgroundController::WallpaperLoader
static scoped_ptr<SkBitmap> LoadSkBitmapFromJPEGFile(
const base::FilePath& path) {
std::string data;
if (!file_util::ReadFileToString(path, &data)) {
if (!base::ReadFileToString(path, &data)) {
LOG(ERROR) << "Unable to read data from " << path.value();
return scoped_ptr<SkBitmap>();
}

@ -24,7 +24,7 @@ namespace debug {
bool ReadProcMaps(std::string* proc_maps) {
FilePath proc_maps_path("/proc/self/maps");
return file_util::ReadFileToString(proc_maps_path, proc_maps);
return ReadFileToString(proc_maps_path, proc_maps);
}
bool ParseProcMaps(const std::string& input,

@ -130,21 +130,10 @@ bool TextContentsEqual(const FilePath& filename1, const FilePath& filename2) {
return true;
}
} // namespace base
// -----------------------------------------------------------------------------
namespace file_util {
using base::FileEnumerator;
using base::FilePath;
using base::kExtensionSeparator;
using base::kMaxUniqueFiles;
bool ReadFileToString(const FilePath& path, std::string* contents) {
if (path.ReferencesParent())
return false;
FILE* file = OpenFile(path, "rb");
FILE* file = file_util::OpenFile(path, "rb");
if (!file) {
return false;
}
@ -155,11 +144,22 @@ bool ReadFileToString(const FilePath& path, std::string* contents) {
if (contents)
contents->append(buf, len);
}
CloseFile(file);
file_util::CloseFile(file);
return true;
}
} // namespace base
// -----------------------------------------------------------------------------
namespace file_util {
using base::FileEnumerator;
using base::FilePath;
using base::kExtensionSeparator;
using base::kMaxUniqueFiles;
bool IsDirectoryEmpty(const FilePath& dir_path) {
FileEnumerator files(dir_path, false,
FileEnumerator::FILES | FileEnumerator::DIRECTORIES);

@ -132,19 +132,18 @@ BASE_EXPORT bool ContentsEqual(const FilePath& filename1,
BASE_EXPORT bool TextContentsEqual(const FilePath& filename1,
const FilePath& filename2);
} // namespace base
// -----------------------------------------------------------------------------
namespace file_util {
// Read the file at |path| into |contents|, returning true on success.
// This function fails if the |path| contains path traversal components ('..').
// |contents| may be NULL, in which case this function is useful for its
// side effect of priming the disk cache.
// Useful for unit tests.
BASE_EXPORT bool ReadFileToString(const base::FilePath& path,
std::string* contents);
BASE_EXPORT bool ReadFileToString(const FilePath& path, std::string* contents);
} // namespace base
// -----------------------------------------------------------------------------
namespace file_util {
#if defined(OS_POSIX)
// Read exactly |bytes| bytes from file descriptor |fd|, storing the result

@ -215,7 +215,7 @@ TEST_F(FileUtilProxyTest, CreateTemporary) {
// Make sure the written data can be read from the returned path.
std::string data;
EXPECT_TRUE(file_util::ReadFileToString(path_, &data));
EXPECT_TRUE(ReadFileToString(path_, &data));
EXPECT_EQ("test", data);
// Make sure we can & do delete the created file to prevent leaks on the bots.

@ -21,7 +21,7 @@ namespace {
std::string GetFileContent(const FilePath& path) {
std::string content;
if (!file_util::ReadFileToString(path, &content)) {
if (!ReadFileToString(path, &content)) {
NOTREACHED();
}
return content;

@ -46,7 +46,7 @@ bool JSONFileValueSerializer::SerializeInternal(const base::Value& root,
int JSONFileValueSerializer::ReadFileToString(std::string* json_string) {
DCHECK(json_string);
if (!file_util::ReadFileToString(json_file_path_, json_string)) {
if (!base::ReadFileToString(json_file_path_, json_string)) {
#if defined(OS_WIN)
int error = ::GetLastError();
if (error == ERROR_SHARING_VIOLATION || error == ERROR_LOCK_VIOLATION) {

@ -77,8 +77,8 @@ class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer {
base::FilePath json_file_path_;
bool allow_trailing_comma_;
// A wrapper for file_util::ReadFileToString which returns a non-zero
// JsonFileError if there were file errors.
// A wrapper for ReadFileToString which returns a non-zero JsonFileError if
// there were file errors.
int ReadFileToString(std::string* json_string);
DISALLOW_IMPLICIT_CONSTRUCTORS(JSONFileValueSerializer);

@ -547,7 +547,7 @@ TEST(JSONReaderTest, ReadFromFile) {
ASSERT_TRUE(base::PathExists(path));
std::string input;
ASSERT_TRUE(file_util::ReadFileToString(
ASSERT_TRUE(ReadFileToString(
path.Append(FILE_PATH_LITERAL("bom_feff.json")), &input));
JSONReader reader;

@ -54,7 +54,7 @@ bool ReadProcFile(const FilePath& file, std::string* buffer) {
// Synchronously reading files in /proc is safe.
ThreadRestrictions::ScopedAllowIO allow_io;
if (!file_util::ReadFileToString(file, buffer)) {
if (!ReadFileToString(file, buffer)) {
DLOG(WARNING) << "Failed to read " << file.MaybeAsASCII();
return false;
}

@ -44,7 +44,7 @@ bool GetProcCmdline(pid_t pid, std::vector<std::string>* proc_cmd_line_args) {
FilePath cmd_line_file = internal::GetProcPidDir(pid).Append("cmdline");
std::string cmd_line;
if (!file_util::ReadFileToString(cmd_line_file, &cmd_line))
if (!ReadFileToString(cmd_line_file, &cmd_line))
return false;
std::string delimiters;
delimiters.push_back('\0');

@ -70,9 +70,9 @@ bool Process::IsProcessBackgrounded() const {
#if defined(OS_CHROMEOS)
if (cgroups.Get().enabled) {
std::string proc;
if (file_util::ReadFileToString(
base::FilePath(StringPrintf(kProcPath, process_)),
&proc)) {
if (base::ReadFileToString(
base::FilePath(StringPrintf(kProcPath, process_)),
&proc)) {
std::vector<std::string> proc_parts;
base::SplitString(proc, ':', &proc_parts);
DCHECK(proc_parts.size() == 3);

@ -34,7 +34,7 @@ enum ParsingState {
// Read a file with a single number string and return the number as a uint64.
static uint64 ReadFileToUint64(const base::FilePath file) {
std::string file_as_string;
if (!file_util::ReadFileToString(file, &file_as_string))
if (!ReadFileToString(file, &file_as_string))
return 0;
TrimWhitespaceASCII(file_as_string, TRIM_ALL, &file_as_string);
uint64 file_as_uint64 = 0;
@ -52,7 +52,7 @@ size_t ReadProcStatusAndGetFieldAsSizeT(pid_t pid, const std::string& field) {
{
// Synchronously reading files in /proc is safe.
ThreadRestrictions::ScopedAllowIO allow_io;
if (!file_util::ReadFileToString(stat_file, &status))
if (!ReadFileToString(stat_file, &status))
return 0;
}
@ -117,7 +117,7 @@ int GetProcessCPU(pid_t pid) {
std::string stat;
FilePath stat_path =
task_path.Append(ent->d_name).Append(internal::kStatFile);
if (file_util::ReadFileToString(stat_path, &stat)) {
if (ReadFileToString(stat_path, &stat)) {
int cpu = ParseProcStatCPU(stat);
if (cpu > 0)
total_cpu += cpu;
@ -223,7 +223,7 @@ bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const {
std::string proc_io_contents;
FilePath io_file = internal::GetProcPidDir(process_).Append("io");
if (!file_util::ReadFileToString(io_file, &proc_io_contents))
if (!ReadFileToString(io_file, &proc_io_contents))
return false;
(*io_counters).OtherOperationCount = 0;
@ -295,7 +295,7 @@ bool ProcessMetrics::GetWorkingSetKBytesTotmaps(WorkingSetKBytes *ws_usage)
{
FilePath totmaps_file = internal::GetProcPidDir(process_).Append("totmaps");
ThreadRestrictions::ScopedAllowIO allow_io;
bool ret = file_util::ReadFileToString(totmaps_file, &totmaps_data);
bool ret = ReadFileToString(totmaps_file, &totmaps_data);
if (!ret || totmaps_data.length() == 0)
return false;
}
@ -347,7 +347,7 @@ bool ProcessMetrics::GetWorkingSetKBytesStatm(WorkingSetKBytes* ws_usage)
FilePath statm_file = internal::GetProcPidDir(process_).Append("statm");
// Synchronously reading files in /proc is safe.
ThreadRestrictions::ScopedAllowIO allow_io;
bool ret = file_util::ReadFileToString(statm_file, &statm);
bool ret = ReadFileToString(statm_file, &statm);
if (!ret || statm.length() == 0)
return false;
}
@ -444,7 +444,7 @@ bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) {
// Used memory is: total - free - buffers - caches
FilePath meminfo_file("/proc/meminfo");
std::string meminfo_data;
if (!file_util::ReadFileToString(meminfo_file, &meminfo_data)) {
if (!ReadFileToString(meminfo_file, &meminfo_data)) {
DLOG(WARNING) << "Failed to open " << meminfo_file.value();
return false;
}
@ -499,7 +499,7 @@ bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) {
std::string geminfo_data;
meminfo->gem_objects = -1;
meminfo->gem_size = -1;
if (file_util::ReadFileToString(geminfo_file, &geminfo_data)) {
if (ReadFileToString(geminfo_file, &geminfo_data)) {
int gem_objects = -1;
long long gem_size = -1;
int num_res = sscanf(geminfo_data.c_str(),
@ -515,7 +515,7 @@ bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) {
// Incorporate Mali graphics memory if present.
FilePath mali_memory_file("/sys/devices/platform/mali.0/memory");
std::string mali_memory_data;
if (file_util::ReadFileToString(mali_memory_file, &mali_memory_data)) {
if (ReadFileToString(mali_memory_file, &mali_memory_data)) {
long long mali_size = -1;
int num_res = sscanf(mali_memory_data.c_str(), "%lld bytes", &mali_size);
if (num_res == 1)

@ -54,7 +54,7 @@ void SysInfo::OperatingSystemVersionNumbers(int32* major_version,
FilePath path(kLinuxStandardBaseReleaseFile);
std::string contents;
if (file_util::ReadFileToString(path, &contents)) {
if (ReadFileToString(path, &contents)) {
g_chrome_os_version_numbers.Get().parsed = true;
ParseLsbRelease(contents,
&(g_chrome_os_version_numbers.Get().major_version),

@ -42,7 +42,7 @@ size_t SysInfo::MaxSharedMemorySize() {
static bool limit_valid = false;
if (!limit_valid) {
std::string contents;
file_util::ReadFileToString(FilePath("/proc/sys/kernel/shmmax"), &contents);
ReadFileToString(FilePath("/proc/sys/kernel/shmmax"), &contents);
DCHECK(!contents.empty());
if (!contents.empty() && contents[contents.length() - 1] == '\n') {
contents.erase(contents.length() - 1);
@ -67,7 +67,7 @@ std::string SysInfo::CPUModelName() {
const char kCpuModelPrefix[] = "model name";
#endif
std::string contents;
file_util::ReadFileToString(FilePath("/proc/cpuinfo"), &contents);
ReadFileToString(FilePath("/proc/cpuinfo"), &contents);
DCHECK(!contents.empty());
if (!contents.empty()) {
std::istringstream iss(contents);

@ -93,7 +93,7 @@ bool ProcessGTestOutput(const base::FilePath& output_file,
DCHECK(results);
std::string xml_contents;
if (!file_util::ReadFileToString(output_file, &xml_contents))
if (!ReadFileToString(output_file, &xml_contents))
return false;
// Silence XML errors - otherwise they go to stderr.

@ -241,7 +241,7 @@ bool VolumeSupportsADS(const base::FilePath& path) {
bool HasInternetZoneIdentifier(const base::FilePath& full_path) {
base::FilePath zone_path(full_path.value() + L":Zone.Identifier");
std::string zone_path_contents;
if (!file_util::ReadFileToString(zone_path, &zone_path_contents))
if (!base::ReadFileToString(zone_path, &zone_path_contents))
return false;
std::vector<std::string> lines;

@ -31,7 +31,7 @@ bool WritePNGFile(const SkBitmap& bitmap, const base::FilePath& file_path,
bool ReadPNGFile(const base::FilePath& file_path, SkBitmap* bitmap) {
DCHECK(bitmap);
std::string png_data;
return file_util::ReadFileToString(file_path, &png_data) &&
return base::ReadFileToString(file_path, &png_data) &&
gfx::PNGCodec::Decode(reinterpret_cast<unsigned char*>(&png_data[0]),
png_data.length(),
bitmap);

@ -115,7 +115,7 @@ class LayerTreeHostPerfTestJsonReader : public LayerTreeHostPerfTest {
base::FilePath test_data_dir;
ASSERT_TRUE(PathService::Get(cc::DIR_TEST_DATA, &test_data_dir));
base::FilePath json_file = test_data_dir.AppendASCII(name + ".json");
ASSERT_TRUE(file_util::ReadFileToString(json_file, &json_));
ASSERT_TRUE(base::ReadFileToString(json_file, &json_));
}
virtual void BuildTree() OVERRIDE {

@ -199,7 +199,7 @@ class AutofillTest : public InProcessBrowserTest {
base::FilePath data_file =
ui_test_utils::GetTestFilePath(base::FilePath().AppendASCII("autofill"),
base::FilePath().AppendASCII(filename));
CHECK(file_util::ReadFileToString(data_file, &data));
CHECK(base::ReadFileToString(data_file, &data));
std::vector<std::string> lines;
base::SplitString(data, '\n', &lines);
int parsed_profiles = 0;

@ -263,7 +263,7 @@ void ReadLastShutdownFile(ShutdownType type,
base::FilePath shutdown_ms_file = GetShutdownMsPath();
std::string shutdown_ms_str;
int64 shutdown_ms = 0;
if (file_util::ReadFileToString(shutdown_ms_file, &shutdown_ms_str))
if (base::ReadFileToString(shutdown_ms_file, &shutdown_ms_str))
base::StringToInt64(shutdown_ms_str, &shutdown_ms);
base::DeleteFile(shutdown_ms_file, false);

@ -112,7 +112,7 @@ class KioskAppData::IconLoader : public ImageDecoder::Delegate {
DCHECK(task_runner_->RunsTasksOnCurrentThread());
std::string data;
if (!file_util::ReadFileToString(base::FilePath(icon_path_), &data)) {
if (!base::ReadFileToString(base::FilePath(icon_path_), &data)) {
ReportResultOnBlockingPool(FAILED_TO_LOAD);
return;
}

@ -261,8 +261,8 @@ BootTimesLoader::Stats BootTimesLoader::GetCurrentStats() {
const base::FilePath kDiskStat(FPL("/sys/block/sda/stat"));
Stats stats;
base::ThreadRestrictions::ScopedAllowIO allow_io;
file_util::ReadFileToString(kProcUptime, &stats.uptime);
file_util::ReadFileToString(kDiskStat, &stats.disk);
base::ReadFileToString(kProcUptime, &stats.uptime);
base::ReadFileToString(kDiskStat, &stats.disk);
return stats;
}

@ -80,7 +80,7 @@ CustomizationDocument::~CustomizationDocument() {}
bool CustomizationDocument::LoadManifestFromFile(
const base::FilePath& manifest_path) {
std::string manifest;
if (!file_util::ReadFileToString(manifest_path, &manifest))
if (!base::ReadFileToString(manifest_path, &manifest))
return false;
return LoadManifestFromString(manifest);
}
@ -280,7 +280,7 @@ void ServicesCustomizationDocument::ReadFileInBackground(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
std::string manifest;
if (file_util::ReadFileToString(file, &manifest)) {
if (base::ReadFileToString(file, &manifest)) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(
base::IgnoreResult(

@ -94,7 +94,7 @@ TEST_F(FakeFileSystemTest, GetFileContentByPath) {
// Make sure the cached file's content.
std::string cache_file_content;
ASSERT_TRUE(
file_util::ReadFileToString(cache_file_path, &cache_file_content));
base::ReadFileToString(cache_file_path, &cache_file_content));
EXPECT_EQ(content, cache_file_content);
}

@ -918,11 +918,11 @@ TEST_F(FileCacheTest, RenameCacheFilesToNewFormat) {
// Rename and verify the result.
RenameCacheFilesToNewFormat(cache_.get());
std::string contents;
EXPECT_TRUE(file_util::ReadFileToString(file_directory.AppendASCII("id_koo"),
EXPECT_TRUE(base::ReadFileToString(file_directory.AppendASCII("id_koo"),
&contents));
EXPECT_EQ("koo", contents);
contents.clear();
EXPECT_TRUE(file_util::ReadFileToString(file_directory.AppendASCII("id_kyu"),
EXPECT_TRUE(base::ReadFileToString(file_directory.AppendASCII("id_kyu"),
&contents));
EXPECT_EQ("kyu", contents);
@ -931,11 +931,11 @@ TEST_F(FileCacheTest, RenameCacheFilesToNewFormat) {
// Files with new style names are not affected.
contents.clear();
EXPECT_TRUE(file_util::ReadFileToString(file_directory.AppendASCII("id_koo"),
EXPECT_TRUE(base::ReadFileToString(file_directory.AppendASCII("id_koo"),
&contents));
EXPECT_EQ("koo", contents);
contents.clear();
EXPECT_TRUE(file_util::ReadFileToString(file_directory.AppendASCII("id_kyu"),
EXPECT_TRUE(base::ReadFileToString(file_directory.AppendASCII("id_kyu"),
&contents));
EXPECT_EQ("kyu", contents);
}

@ -114,7 +114,7 @@ TEST_F(TruncateOperationTest, Extend) {
// The local file should be truncated.
std::string content;
ASSERT_TRUE(file_util::ReadFileToString(local_path, &content));
ASSERT_TRUE(base::ReadFileToString(local_path, &content));
EXPECT_EQ(file_size + 10, static_cast<int64>(content.size()));
// All trailing 10 bytes should be '\0'.

@ -749,7 +749,7 @@ TEST_F(FileSystemTest, OpenAndCloseFile) {
// Verify that the file contents match the expected contents.
const std::string kExpectedContent = "This is some test content.";
std::string cache_file_data;
EXPECT_TRUE(file_util::ReadFileToString(opened_file_path, &cache_file_data));
EXPECT_TRUE(base::ReadFileToString(opened_file_path, &cache_file_data));
EXPECT_EQ(kExpectedContent, cache_file_data);
FileCacheEntry cache_entry;

@ -658,7 +658,7 @@ TEST_F(JobSchedulerTest, DownloadFileCellularDisabled) {
EXPECT_EQ(google_apis::HTTP_SUCCESS, download_error);
std::string content;
EXPECT_EQ(output_file_path, kOutputFilePath);
ASSERT_TRUE(file_util::ReadFileToString(output_file_path, &content));
ASSERT_TRUE(base::ReadFileToString(output_file_path, &content));
EXPECT_EQ("This is some test content.", content);
}
@ -711,7 +711,7 @@ TEST_F(JobSchedulerTest, DownloadFileWimaxDisabled) {
EXPECT_EQ(google_apis::HTTP_SUCCESS, download_error);
std::string content;
EXPECT_EQ(output_file_path, kOutputFilePath);
ASSERT_TRUE(file_util::ReadFileToString(output_file_path, &content));
ASSERT_TRUE(base::ReadFileToString(output_file_path, &content));
EXPECT_EQ("This is some test content.", content);
}
@ -756,7 +756,7 @@ TEST_F(JobSchedulerTest, DownloadFileCellularEnabled) {
EXPECT_EQ(google_apis::HTTP_SUCCESS, download_error);
std::string content;
EXPECT_EQ(output_file_path, kOutputFilePath);
ASSERT_TRUE(file_util::ReadFileToString(output_file_path, &content));
ASSERT_TRUE(base::ReadFileToString(output_file_path, &content));
EXPECT_EQ("This is some test content.", content);
}
@ -801,7 +801,7 @@ TEST_F(JobSchedulerTest, DownloadFileWimaxEnabled) {
EXPECT_EQ(google_apis::HTTP_SUCCESS, download_error);
std::string content;
EXPECT_EQ(output_file_path, kOutputFilePath);
ASSERT_TRUE(file_util::ReadFileToString(output_file_path, &content));
ASSERT_TRUE(base::ReadFileToString(output_file_path, &content));
EXPECT_EQ("This is some test content.", content);
}

@ -286,13 +286,13 @@ TEST_F(SyncClientTest, ExistingPinnedFiles) {
std::string content;
EXPECT_EQ(FILE_ERROR_OK, cache_->GetFile(resource_ids_["fetched"],
&cache_file));
EXPECT_TRUE(file_util::ReadFileToString(cache_file, &content));
EXPECT_TRUE(base::ReadFileToString(cache_file, &content));
EXPECT_EQ(kRemoteContent, content);
content.clear();
EXPECT_EQ(FILE_ERROR_OK, cache_->GetFile(resource_ids_["dirty"],
&cache_file));
EXPECT_TRUE(file_util::ReadFileToString(cache_file, &content));
EXPECT_TRUE(base::ReadFileToString(cache_file, &content));
EXPECT_EQ(kLocalContent, content);
}

@ -59,7 +59,7 @@ struct TestCase {
void ExpectFileContentEquals(const base::FilePath& selected_path,
const std::string& expected_contents) {
std::string test_file_contents;
ASSERT_TRUE(file_util::ReadFileToString(selected_path, &test_file_contents));
ASSERT_TRUE(base::ReadFileToString(selected_path, &test_file_contents));
EXPECT_EQ(expected_contents, test_file_contents);
}

@ -250,7 +250,7 @@ class DriveTestVolume {
base::FilePath source_file_path =
google_apis::test_util::GetTestFilePath("chromeos/file_manager").
AppendASCII(source_file_name);
ASSERT_TRUE(file_util::ReadFileToString(source_file_path, &content_data));
ASSERT_TRUE(base::ReadFileToString(source_file_path, &content_data));
}
scoped_ptr<google_apis::ResourceEntry> resource_entry;

@ -99,7 +99,7 @@ bool GetData(const base::FilePath& path, std::string* data) {
return false;
return !base::PathExists(path) ||
file_util::ReadFileToString(path, data);
base::ReadFileToString(path, data);
}
class WindowStateManager;
@ -386,7 +386,7 @@ void WallpaperPrivateSetWallpaperIfExistsFunction::
path = fallback_path;
if (base::PathExists(path) &&
file_util::ReadFileToString(path, &data)) {
base::ReadFileToString(path, &data)) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(&WallpaperPrivateSetWallpaperIfExistsFunction::StartDecode,
this, data));

@ -106,7 +106,7 @@ void SetupProgressiveScanFieldTrial() {
bool Is2GBParrot() {
base::FilePath path("/etc/lsb-release");
std::string contents;
if (!file_util::ReadFileToString(path, &contents))
if (!base::ReadFileToString(path, &contents))
return false;
if (contents.find("CHROMEOS_RELEASE_BOARD=parrot") == std::string::npos)
return false;

@ -257,7 +257,7 @@ void ComponentExtensionIMEManagerImpl::ReadComponentExtensionsInfo(
!base::PathExists(manifest_path))
continue;
if (!file_util::ReadFileToString(manifest_path, &component_ime.manifest))
if (!base::ReadFileToString(manifest_path, &component_ime.manifest))
continue;
scoped_ptr<DictionaryValue> manifest = GetManifest(component_ime.path);

@ -181,8 +181,8 @@ class KioskTest : public InProcessBrowserTest,
virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
base::FilePath test_data_dir;
PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
CHECK(file_util::ReadFileToString(test_data_dir.Append(kServiceLogin),
&service_login_response_));
CHECK(base::ReadFileToString(test_data_dir.Append(kServiceLogin),
&service_login_response_));
host_resolver()->AddRule(kWebstoreDomain, "127.0.0.1");
}

@ -30,7 +30,7 @@ std::string LoadSyncToken() {
std::string token;
base::FilePath token_file =
file_util::GetHomeDir().Append(kManagedUserTokenFilename);
if (!file_util::ReadFileToString(token_file, &token)) {
if (!base::ReadFileToString(token_file, &token)) {
return std::string();
}
return token;

@ -145,8 +145,8 @@ class OobeTest : public InProcessBrowserTest {
content_browser_client_.get());
base::FilePath test_data_dir;
PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
CHECK(file_util::ReadFileToString(test_data_dir.Append(kServiceLogin),
&service_login_response_));
CHECK(base::ReadFileToString(test_data_dir.Append(kServiceLogin),
&service_login_response_));
}
virtual void SetUpOnMainThread() OVERRIDE {

@ -460,7 +460,7 @@ bool UpdateScreen::HasCriticalUpdate() {
// Temporarily allow it until we fix http://crosbug.com/11106
base::ThreadRestrictions::ScopedAllowIO allow_io;
base::FilePath update_deadline_file_path(kUpdateDeadlineFile);
if (!file_util::ReadFileToString(update_deadline_file_path, &deadline) ||
if (!base::ReadFileToString(update_deadline_file_path, &deadline) ||
deadline.empty()) {
return false;
}

@ -71,7 +71,7 @@ void UserImageLoader::LoadImage(
DCHECK(task_runner->RunsTasksOnCurrentThread());
std::string image_data;
file_util::ReadFileToString(base::FilePath(filepath), &image_data);
base::ReadFileToString(base::FilePath(filepath), &image_data);
scoped_refptr<ImageDecoder> image_decoder =
new ImageDecoder(this, image_data, image_codec_);

@ -118,7 +118,7 @@ void CellularConfigDocument::SetErrorMap(
bool CellularConfigDocument::LoadFromFile(const base::FilePath& config_path) {
std::string config;
if (!file_util::ReadFileToString(config_path, &config))
if (!base::ReadFileToString(config_path, &config))
return false;
scoped_ptr<Value> root(

@ -360,11 +360,11 @@ void MobileConfig::ReadConfigInBackground(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
std::string global_config;
std::string local_config;
if (!file_util::ReadFileToString(global_config_file, &global_config)) {
if (!base::ReadFileToString(global_config_file, &global_config)) {
VLOG(1) << "Failed to load global mobile config from: "
<< global_config_file.value();
}
if (!file_util::ReadFileToString(local_config_file, &local_config)) {
if (!base::ReadFileToString(local_config_file, &local_config)) {
VLOG(1) << "Failed to load local mobile config from: "
<< local_config_file.value();
}

@ -561,7 +561,7 @@ IN_PROC_BROWSER_TEST_P(TermsOfServiceTest, TermsOfServiceScreen) {
base::FilePath test_dir;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir));
std::string terms_of_service;
ASSERT_TRUE(file_util::ReadFileToString(
ASSERT_TRUE(base::ReadFileToString(
test_dir.Append(kExistentTermsOfServicePath), &terms_of_service));
EXPECT_EQ(terms_of_service, content);
EXPECT_FALSE(error);

@ -73,7 +73,7 @@ void UserPolicyDiskCache::LoadOnFileThread() {
// Read the protobuf from the file.
std::string data;
if (!file_util::ReadFileToString(backing_file_path_, &data)) {
if (!base::ReadFileToString(backing_file_path_, &data)) {
LOG(WARNING) << "Failed to read policy data from "
<< backing_file_path_.value();
LoadDone(LOAD_RESULT_READ_ERROR, cached_response);

@ -61,7 +61,7 @@ void UserPolicyTokenLoader::LoadOnFileThread() {
if (base::PathExists(cache_file_)) {
std::string data;
em::DeviceCredentials device_credentials;
if (file_util::ReadFileToString(cache_file_, &data) &&
if (base::ReadFileToString(cache_file_, &data) &&
device_credentials.ParseFromArray(data.c_str(), data.size())) {
device_token = device_credentials.device_token();
device_id = device_credentials.device_id();

@ -261,7 +261,7 @@ bool SwapMetrics::Backend::GetFieldFromKernelOutput(const std::string& path,
const std::string& field,
int64* value) {
std::string file_content;
if (!file_util::ReadFileToString(FilePath(path), &file_content)) {
if (!base::ReadFileToString(FilePath(path), &file_content)) {
LOG(WARNING) << "Cannot read " << path;
return false;
}
@ -296,7 +296,7 @@ bool SwapMetrics::Backend::TokenizeOneLineFile(const std::string& path,
std::vector<std::string>*
tokens) {
std::string file_content;
if (!file_util::ReadFileToString(FilePath(path), &file_content)) {
if (!base::ReadFileToString(FilePath(path), &file_content)) {
LOG(WARNING) << "cannot read " << path;
return false;
}

@ -478,8 +478,7 @@ void AutomaticRebootManagerBasicTest::CreateAutomaticRebootManager(
bool AutomaticRebootManagerBasicTest::ReadUpdateRebootNeededUptimeFromFile(
base::TimeDelta* uptime) {
std::string contents;
if (!file_util::ReadFileToString(update_reboot_needed_uptime_file_,
&contents)) {
if (!base::ReadFileToString(update_reboot_needed_uptime_file_, &contents)) {
return false;
}
double seconds;

@ -142,8 +142,7 @@ LogDictionaryType* GetSystemLogs(base::FilePath* zip_file_name,
}
// Read logs from the temp file
std::string data;
bool read_success = file_util::ReadFileToString(temp_filename,
&data);
bool read_success = base::ReadFileToString(temp_filename, &data);
// if we were using an internal temp file, the user does not need the
// logs to stay past the ReadFile call - delete the file
base::DeleteFile(temp_filename, false);
@ -348,7 +347,7 @@ void SyslogsProviderImpl::ReadSyslogs(
void SyslogsProviderImpl::LoadCompressedLogs(const base::FilePath& zip_file,
std::string* zip_content) {
DCHECK(zip_content);
if (!file_util::ReadFileToString(zip_file, zip_content)) {
if (!base::ReadFileToString(zip_file, zip_content)) {
LOG(ERROR) << "Cannot read compressed logs file from " <<
zip_file.value().c_str();
}

@ -160,7 +160,7 @@ void DebugDaemonLogSource::ReadUserLogFiles(
std::string value;
std::string filename = it->second;
base::FilePath profile_dir = last_used_profiles[i]->GetPath();
bool read_success = file_util::ReadFileToString(
bool read_success = base::ReadFileToString(
profile_dir.Append(filename), &value);
if (read_success && !value.empty())

@ -44,7 +44,7 @@ void LsbReleaseLogSource::ReadLSBRelease(SystemLogsResponse* response) {
const base::FilePath lsb_release_file("/etc/lsb-release");
std::string lsb_data;
bool read_success = file_util::ReadFileToString(lsb_release_file, &lsb_data);
bool read_success = base::ReadFileToString(lsb_release_file, &lsb_data);
// if we were using an internal temp file, the user does not need the
// logs to stay past the ReadFile call - delete the file
if (!read_success) {

@ -135,7 +135,7 @@ void VersionLoader::Backend::GetVersion(VersionFormat format,
std::string contents;
const base::FilePath file_path(kPathVersion);
if (file_util::ReadFileToString(file_path, &contents)) {
if (base::ReadFileToString(file_path, &contents)) {
*version = ParseVersion(
contents,
(format == VERSION_FULL) ? kFullVersionPrefix : kVersionPrefix);
@ -159,7 +159,7 @@ void VersionLoader::Backend::GetFirmware(std::string* firmware) {
std::string contents;
const base::FilePath file_path(kPathFirmware);
if (file_util::ReadFileToString(file_path, &contents)) {
if (base::ReadFileToString(file_path, &contents)) {
*firmware = ParseFirmware(contents);
}
}

@ -121,8 +121,8 @@ void DefaultComponentInstaller::StartRegistration(
if (found) {
current_version_ = latest_version;
file_util::ReadFileToString(latest_dir.AppendASCII("manifest.fingerprint"),
&current_fingerprint_);
base::ReadFileToString(latest_dir.AppendASCII("manifest.fingerprint"),
&current_fingerprint_);
}
// Remove older versions of the component. None should be in use during

@ -203,7 +203,7 @@ class JSONTest : public DiagnosticsTest {
}
// Being small enough, we can process it in-memory.
std::string json_data;
if (!file_util::ReadFileToString(path_, &json_data)) {
if (!base::ReadFileToString(path_, &json_data)) {
RecordFailure(DIAG_RECON_UNABLE_TO_OPEN_FILE,
"Could not open file. Possibly locked by another process");
return true;

@ -679,8 +679,7 @@ class DownloadTest : public InProcessBrowserTest {
int64 origin_file_size = 0;
EXPECT_TRUE(file_util::GetFileSize(origin_file, &origin_file_size));
std::string original_file_contents;
EXPECT_TRUE(
file_util::ReadFileToString(origin_file, &original_file_contents));
EXPECT_TRUE(base::ReadFileToString(origin_file, &original_file_contents));
EXPECT_TRUE(
VerifyFile(downloaded_file, original_file_contents, origin_file_size));
@ -831,7 +830,7 @@ class DownloadTest : public InProcessBrowserTest {
const int64 file_size) {
std::string file_contents;
bool read = file_util::ReadFileToString(path, &file_contents);
bool read = base::ReadFileToString(path, &file_contents);
EXPECT_TRUE(read) << "Failed reading file: " << path.value() << std::endl;
if (!read)
return false; // Couldn't read the file.
@ -1475,7 +1474,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_IncognitoRegular) {
int64 origin_file_size = 0;
EXPECT_TRUE(file_util::GetFileSize(origin, &origin_file_size));
std::string original_contents;
EXPECT_TRUE(file_util::ReadFileToString(origin, &original_contents));
EXPECT_TRUE(base::ReadFileToString(origin, &original_contents));
std::vector<DownloadItem*> download_items;
GetDownloads(browser(), &download_items);
@ -2846,7 +2845,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_Renaming) {
"downloads/a_zip_file.zip"))));
ASSERT_TRUE(base::PathExists(origin_file));
std::string origin_contents;
ASSERT_TRUE(file_util::ReadFileToString(origin_file, &origin_contents));
ASSERT_TRUE(base::ReadFileToString(origin_file, &origin_contents));
// Download the same url several times and expect that all downloaded files
// after the zero-th contain a deduplication counter.

@ -809,7 +809,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SavePageBrowserTest_NonMHTML) {
base::FilePath filename = download_dir.AppendASCII("dataurl.txt");
ASSERT_TRUE(base::PathExists(filename));
std::string contents;
EXPECT_TRUE(file_util::ReadFileToString(filename, &contents));
EXPECT_TRUE(base::ReadFileToString(filename, &contents));
EXPECT_EQ("foo", contents);
}

@ -1207,7 +1207,7 @@ CancelCallback FakeDriveService::ResumeUpload(
}
std::string content_data;
if (!file_util::ReadFileToString(local_file_path, &content_data)) {
if (!base::ReadFileToString(local_file_path, &content_data)) {
session->uploaded_size = end_position;
completion_callback.Run(GDATA_FILE_ERROR, scoped_ptr<ResourceEntry>());
return CancelCallback();

@ -903,7 +903,7 @@ TEST_F(FakeDriveServiceTest, DownloadFile_ExistingFile) {
EXPECT_EQ(HTTP_SUCCESS, error);
EXPECT_EQ(output_file_path, kOutputFilePath);
std::string content;
ASSERT_TRUE(file_util::ReadFileToString(output_file_path, &content));
ASSERT_TRUE(base::ReadFileToString(output_file_path, &content));
// The content is "x"s of the file size specified in root_feed.json.
EXPECT_EQ("This is some test content.", content);
ASSERT_TRUE(!download_progress_values.empty());

@ -2197,8 +2197,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
" \"current\": \"complete\"}}]",
result_id)));
std::string disk_data;
EXPECT_TRUE(file_util::ReadFileToString(item->GetTargetFilePath(),
&disk_data));
EXPECT_TRUE(base::ReadFileToString(item->GetTargetFilePath(), &disk_data));
EXPECT_STREQ(kPayloadData, disk_data.c_str());
}

@ -195,7 +195,7 @@ TEST_F(NativeMessagingTest, SingleSendMessageWrite) {
std::string output;
base::TimeTicks start_time = base::TimeTicks::Now();
while (base::TimeTicks::Now() - start_time < TestTimeouts::action_timeout()) {
ASSERT_TRUE(file_util::ReadFileToString(temp_output_file, &output));
ASSERT_TRUE(base::ReadFileToString(temp_output_file, &output));
if (!output.empty())
break;
base::PlatformThread::YieldCurrentThread();

@ -17,7 +17,7 @@ void GetDBusMachineId(const extensions::api::DeviceId::IdCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
std::string result;
if (!file_util::ReadFileToString(base::FilePath(kDBusFilename), &result)) {
if (!base::ReadFileToString(base::FilePath(kDBusFilename), &result)) {
DLOG(WARNING) << "Error reading dbus machine id file.";
result = "";
}

@ -50,7 +50,7 @@ bool SyncSetupHelper::InitializeSync(Profile* profile) {
bool SyncSetupHelper::ReadPasswordFile(const base::FilePath& password_file) {
// TODO(dcheng): Convert format of config file to JSON.
std::string file_contents;
bool success = file_util::ReadFileToString(password_file, &file_contents);
bool success = base::ReadFileToString(password_file, &file_contents);
EXPECT_TRUE(success)
<< "Password file \""
<< password_file.value() << "\" does not exist.";

@ -88,7 +88,7 @@ class ComponentLoaderTest : public testing::Test {
.AppendASCII("1.0.0.0");
// Read in the extension manifest.
ASSERT_TRUE(file_util::ReadFileToString(
ASSERT_TRUE(base::ReadFileToString(
extension_path_.Append(kManifestFilename),
&manifest_contents_));

@ -34,7 +34,7 @@ scoped_refptr<Extension> ConvertUserScriptToExtension(
const base::FilePath& user_script_path, const GURL& original_url,
const base::FilePath& extensions_dir, string16* error) {
std::string content;
if (!file_util::ReadFileToString(user_script_path, &content)) {
if (!base::ReadFileToString(user_script_path, &content)) {
*error = ASCIIToUTF16("Could not read source file.");
return NULL;
}

@ -51,7 +51,7 @@ WebApplicationInfo::IconInfo GetIconInfo(const GURL& url, int size) {
result.height = size;
std::string icon_data;
if (!file_util::ReadFileToString(icon_file, &icon_data)) {
if (!base::ReadFileToString(icon_file, &icon_data)) {
ADD_FAILURE() << "Could not read test icon.";
return result;
}

@ -70,7 +70,7 @@ gfx::Image LoadIcon(const std::string& filename) {
path = path.AppendASCII("extensions/api_test").AppendASCII(filename);
std::string file_contents;
file_util::ReadFileToString(path, &file_contents);
base::ReadFileToString(path, &file_contents);
const unsigned char* data =
reinterpret_cast<const unsigned char*>(file_contents.data());

@ -220,8 +220,7 @@ const Extension* ExtensionBrowserTest::LoadExtensionAsComponentWithManifest(
profile())->extension_service();
std::string manifest;
if (!file_util::ReadFileToString(path.Append(manifest_relative_path),
&manifest)) {
if (!base::ReadFileToString(path.Append(manifest_relative_path), &manifest)) {
return NULL;
}

@ -127,8 +127,7 @@ crypto::RSAPrivateKey* ExtensionCreator::ReadInputKey(const base::FilePath&
}
std::string private_key_contents;
if (!file_util::ReadFileToString(private_key_path,
&private_key_contents)) {
if (!base::ReadFileToString(private_key_path, &private_key_contents)) {
error_message_ =
l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_FAILED_TO_READ);
return NULL;

@ -88,7 +88,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, OriginPrivileges) {
// A data URL. Data URLs should always be able to load chrome-extension://
// resources.
std::string file_source;
ASSERT_TRUE(file_util::ReadFileToString(
ASSERT_TRUE(base::ReadFileToString(
test_data_dir_.AppendASCII("extension_resource_request_policy")
.AppendASCII("index.html"), &file_source));
ui_test_utils::NavigateToURL(browser(),

@ -3499,7 +3499,7 @@ TEST_F(ExtensionServiceTest, ComponentExtensionWhitelisted) {
.AppendASCII(good0)
.AppendASCII("1.0.0.0");
std::string manifest;
ASSERT_TRUE(file_util::ReadFileToString(
ASSERT_TRUE(base::ReadFileToString(
path.Append(extensions::kManifestFilename), &manifest));
service_->component_loader()->Add(manifest, path);
service_->Init();
@ -5050,7 +5050,7 @@ TEST_F(ExtensionServiceTest, ComponentExtensions) {
.AppendASCII("1.0.0.0");
std::string manifest;
ASSERT_TRUE(file_util::ReadFileToString(
ASSERT_TRUE(base::ReadFileToString(
path.Append(extensions::kManifestFilename), &manifest));
service_->component_loader()->Add(manifest, path);
@ -5104,7 +5104,7 @@ TEST_F(ExtensionServiceTest, DeferredSyncStartupPreInstalledComponent) {
.AppendASCII(good0)
.AppendASCII("1.0.0.0");
std::string manifest;
ASSERT_TRUE(file_util::ReadFileToString(
ASSERT_TRUE(base::ReadFileToString(
path.Append(extensions::kManifestFilename), &manifest));
service_->component_loader()->Add(manifest, path);
ASSERT_FALSE(service_->is_ready());

@ -69,7 +69,7 @@ class GtalkExtensionTest : public ExtensionBrowserTest {
std::string ReadCurrentVersion() {
std::string response;
EXPECT_TRUE(file_util::ReadFileToString(
EXPECT_TRUE(base::ReadFileToString(
test_data_dir_.AppendASCII("gtalk").AppendASCII("current_version"),
&response));
return response;

@ -83,7 +83,7 @@ void LoadImageOnBlockingPool(const ImageLoader::ImageRepresentation& image_info,
// Read the file from disk.
std::string file_contents;
base::FilePath path = image_info.resource.GetFilePath();
if (path.empty() || !file_util::ReadFileToString(path, &file_contents)) {
if (path.empty() || !base::ReadFileToString(path, &file_contents)) {
return;
}

@ -182,7 +182,7 @@ bool ReadImagesFromFile(const base::FilePath& extension_path,
base::FilePath path =
extension_path.AppendASCII(kDecodedImagesFilename);
std::string file_str;
if (!file_util::ReadFileToString(path, &file_str))
if (!base::ReadFileToString(path, &file_str))
return false;
IPC::Message pickle(file_str.data(), file_str.size());
@ -198,7 +198,7 @@ bool ReadMessageCatalogsFromFile(const base::FilePath& extension_path,
base::FilePath path = extension_path.AppendASCII(
kDecodedMessageCatalogsFilename);
std::string file_str;
if (!file_util::ReadFileToString(path, &file_str))
if (!base::ReadFileToString(path, &file_str))
return false;
IPC::Message pickle(file_str.data(), file_str.size());

@ -203,7 +203,7 @@ static bool LoadScriptContent(UserScript::File* script_file,
return false;
}
} else {
if (!file_util::ReadFileToString(path, &content)) {
if (!base::ReadFileToString(path, &content)) {
LOG(WARNING) << "Failed to load user script file: " << path.value();
return false;
}

@ -415,7 +415,7 @@ bool ZipString(const std::string& logs, std::string* compressed_logs) {
if (!zip::Zip(temp_path, zip_file, false))
return false;
if (!file_util::ReadFileToString(zip_file, compressed_logs))
if (!base::ReadFileToString(zip_file, compressed_logs))
return false;
return true;

@ -27,7 +27,7 @@ bool GoogleUpdateSettings::GetCollectStatsConsent() {
PathService::Get(chrome::DIR_USER_DATA, &consent_file);
consent_file = consent_file.Append(kConsentToSendStats);
std::string tmp_guid;
bool consented = file_util::ReadFileToString(consent_file, &tmp_guid);
bool consented = base::ReadFileToString(consent_file, &tmp_guid);
if (consented)
google_update::posix_guid().assign(tmp_guid);
return consented;

@ -28,7 +28,7 @@ const base::FilePath::CharType kRLZBrandFilePath[] =
std::string ReadBrandFromFile() {
std::string brand;
base::FilePath brand_file_path(kRLZBrandFilePath);
if (!file_util::ReadFileToString(brand_file_path, &brand))
if (!base::ReadFileToString(brand_file_path, &brand))
LOG(WARNING) << "Brand code file missing: " << brand_file_path.value();
TrimWhitespace(brand, TRIM_ALL, &brand);
return brand;

@ -90,7 +90,7 @@ TEST_F(BaseRequestsServerTest, DownloadFileRequest_ValidFile) {
}
std::string contents;
file_util::ReadFileToString(temp_file, &contents);
base::ReadFileToString(temp_file, &contents);
base::DeleteFile(temp_file, false);
EXPECT_EQ(HTTP_SUCCESS, result_code);
@ -100,7 +100,7 @@ TEST_F(BaseRequestsServerTest, DownloadFileRequest_ValidFile) {
const base::FilePath expected_path =
test_util::GetTestFilePath("gdata/testfile.txt");
std::string expected_contents;
file_util::ReadFileToString(expected_path, &expected_contents);
base::ReadFileToString(expected_path, &expected_contents);
EXPECT_EQ(expected_contents, contents);
}

@ -187,8 +187,8 @@ class DriveApiRequestsTest : public testing::Test {
response->set_code(net::HTTP_PRECONDITION_FAILED);
std::string content;
if (file_util::ReadFileToString(expected_precondition_failed_file_path_,
&content)) {
if (base::ReadFileToString(expected_precondition_failed_file_path_,
&content)) {
response->set_content(content);
response->set_content_type("application/json");
}
@ -1588,7 +1588,7 @@ TEST_F(DriveApiRequestsTest, DownloadFileRequest) {
}
std::string contents;
file_util::ReadFileToString(temp_file, &contents);
base::ReadFileToString(temp_file, &contents);
base::DeleteFile(temp_file, false);
EXPECT_EQ(HTTP_SUCCESS, result_code);

@ -1580,7 +1580,7 @@ TEST_F(GDataWapiRequestsTest, DownloadFileRequest) {
}
std::string contents;
file_util::ReadFileToString(temp_file, &contents);
base::ReadFileToString(temp_file, &contents);
base::DeleteFile(temp_file, false);
EXPECT_EQ(HTTP_SUCCESS, result_code);

@ -93,7 +93,7 @@ scoped_ptr<base::Value> LoadJSONFile(const std::string& relative_path) {
scoped_ptr<net::test_server::BasicHttpResponse> CreateHttpResponseFromFile(
const base::FilePath& file_path) {
std::string content;
if (!file_util::ReadFileToString(file_path, &content))
if (!base::ReadFileToString(file_path, &content))
return scoped_ptr<net::test_server::BasicHttpResponse>();
std::string content_type = "text/plain";
@ -130,8 +130,7 @@ bool VerifyJsonData(const base::FilePath& expected_json_file_path,
}
std::string expected_content;
if (!file_util::ReadFileToString(
expected_json_file_path, &expected_content)) {
if (!base::ReadFileToString(expected_json_file_path, &expected_content)) {
LOG(ERROR) << "Failed to read file: " << expected_json_file_path.value();
return false;
}

@ -391,7 +391,7 @@ TEST_F(ExpireHistoryTest, DeleteFaviconsIfPossible) {
bool ExpireHistoryTest::IsStringInFile(const base::FilePath& filename,
const char* str) {
std::string contents;
EXPECT_TRUE(file_util::ReadFileToString(filename, &contents));
EXPECT_TRUE(base::ReadFileToString(filename, &contents));
return contents.find(str) != std::string::npos;
}

@ -19,7 +19,7 @@ HistoryUnitTestBase::~HistoryUnitTestBase() {
void HistoryUnitTestBase::ExecuteSQLScript(const base::FilePath& sql_path,
const base::FilePath& db_path) {
std::string sql;
ASSERT_TRUE(file_util::ReadFileToString(sql_path, &sql));
ASSERT_TRUE(base::ReadFileToString(sql_path, &sql));
// Replace the 'last_visit_time', 'visit_time', 'time_slot' values in this
// SQL with the current time.

@ -401,7 +401,7 @@ scoped_refptr<URLIndexPrivateData> URLIndexPrivateData::RestoreFromFile(
std::string data;
// If there is no cache file then simply give up. This will cause us to
// attempt to rebuild from the history database.
if (!file_util::ReadFileToString(file_path, &data))
if (!base::ReadFileToString(file_path, &data))
return NULL;
scoped_refptr<URLIndexPrivateData> restored_data(new URLIndexPrivateData);

@ -50,7 +50,7 @@ void IconLoader::ReadIcon() {
if (filename.Extension() != ".svg" &&
filename.Extension() != ".xpm") {
string icon_data;
file_util::ReadFileToString(filename, &icon_data);
base::ReadFileToString(filename, &icon_data);
SkBitmap bitmap;
bool success = gfx::PNGCodec::Decode(

@ -227,7 +227,7 @@ void WebRtcLogUploader::AddUploadedLogInfoToUploadListFile(
std::string contents;
if (base::PathExists(upload_list_path_)) {
bool read_ok = file_util::ReadFileToString(upload_list_path_, &contents);
bool read_ok = base::ReadFileToString(upload_list_path_, &contents);
DPCHECK(read_ok);
// Limit the number of log entries to |kLogListLimitLines| - 1, to make room

@ -23,7 +23,7 @@ class WebRtcLogUploaderTest : public testing::Test {
bool VerifyNumberOfLinesAndContentsOfLastLine(int expected_lines) {
std::string contents;
int read = file_util::ReadFileToString(test_list_path_, &contents);
int read = base::ReadFileToString(test_list_path_, &contents);
EXPECT_GT(read, 0);
if (read <= 0)
return false;

@ -29,7 +29,7 @@ std::string GetPrefFileData() {
base::FilePath pref_file = appdata_dir.AppendASCII("Apple Computer")
.AppendASCII("iTunes")
.AppendASCII("iTunesPrefs.xml");
file_util::ReadFileToString(pref_file, &xml_pref_data);
base::ReadFileToString(pref_file, &xml_pref_data);
}
return xml_pref_data;
}

@ -154,7 +154,7 @@ class MediaFileValidatorTest : public InProcessBrowserTest {
const base::FilePath& source,
bool expected_result) {
std::string content;
ASSERT_TRUE(file_util::ReadFileToString(source, &content));
ASSERT_TRUE(base::ReadFileToString(source, &content));
SetupOnFileThread(filename, content, expected_result);
}

@ -67,10 +67,10 @@ void SafePicasaAlbumsIndexer::ProcessFoldersBatch() {
folders_inis_.push_back(FolderINIContents());
bool ini_read =
file_util::ReadFileToString(
base::ReadFileToString(
folder_path.AppendASCII(kPicasaINIFilename),
&folders_inis_.back().ini_contents) ||
file_util::ReadFileToString(
base::ReadFileToString(
folder_path.AppendASCII(kPicasaINIFilenameLegacy),
&folders_inis_.back().ini_contents);

@ -568,7 +568,7 @@ TEST_F(MTPDeviceDelegateImplMacTest, TestDownload) {
DownloadFile(base::FilePath("/ic:id/filename"),
temp_dir_.path().Append("target")));
std::string contents;
EXPECT_TRUE(file_util::ReadFileToString(temp_dir_.path().Append("target"),
&contents));
EXPECT_TRUE(base::ReadFileToString(temp_dir_.path().Append("target"),
&contents));
EXPECT_EQ(kTestFileContents, contents);
}

@ -86,7 +86,7 @@ bool CheckEnvVar(const char* name, bool default_value) {
}
void ReadCache(const base::FilePath& filename, std::string* data) {
if (!file_util::ReadFileToString(filename, data)) {
if (!base::ReadFileToString(filename, data)) {
// Zero-size data used as an in-band error code.
data->clear();
}

@ -55,12 +55,12 @@ class NaClGdbTest : public PPAPINaClNewlibTest {
RunTestViaHTTP(test_name);
env->UnSetVar("MOCK_NACL_GDB");
EXPECT_TRUE(file_util::ReadFileToString(mock_nacl_gdb_file, &content));
EXPECT_TRUE(base::ReadFileToString(mock_nacl_gdb_file, &content));
EXPECT_STREQ("PASS", content.c_str());
EXPECT_TRUE(base::DeleteFile(mock_nacl_gdb_file, false));
content.clear();
EXPECT_TRUE(file_util::ReadFileToString(script_, &content));
EXPECT_TRUE(base::ReadFileToString(script_, &content));
EXPECT_STREQ("PASS", content.c_str());
EXPECT_TRUE(base::DeleteFile(script_, false));
}

@ -74,7 +74,7 @@ void CRLSetFetcher::LoadFromDisk(base::FilePath path,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
std::string crl_set_bytes;
if (!file_util::ReadFileToString(path, &crl_set_bytes))
if (!base::ReadFileToString(path, &crl_set_bytes))
return;
if (!net::CRLSet::Parse(crl_set_bytes, out_crl_set)) {
@ -153,7 +153,7 @@ bool CRLSetFetcher::Install(const base::DictionaryValue& manifest,
return true;
std::string crl_set_bytes;
if (!file_util::ReadFileToString(crl_set_file_path, &crl_set_bytes)) {
if (!base::ReadFileToString(crl_set_file_path, &crl_set_bytes)) {
LOG(WARNING) << "Failed to find crl-set file inside CRX";
return false;
}

@ -69,7 +69,7 @@ bool ParsePrefFile(const base::FilePath& pref_file, DictionaryValue* prefs) {
// The string that is before a pref key.
const std::string kUserPrefString = "user_pref(\"";
std::string contents;
if (!file_util::ReadFileToString(pref_file, &contents))
if (!base::ReadFileToString(pref_file, &contents))
return false;
std::vector<std::string> lines;

@ -235,7 +235,7 @@ class DataProxyScriptBrowserTest : public InProcessBrowserTest {
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
std::string contents;
// Read in kPACScript contents.
ASSERT_TRUE(file_util::ReadFileToString(ui_test_utils::GetTestFilePath(
ASSERT_TRUE(base::ReadFileToString(ui_test_utils::GetTestFilePath(
base::FilePath(base::FilePath::kCurrentDirectory),
base::FilePath(kPACScript)),
&contents));

@ -53,8 +53,8 @@ class SQLiteServerBoundCertStoreTest : public testing::Test {
"unittest.originbound.key.der");
base::FilePath cert_path = net::GetTestCertsDirectory().AppendASCII(
"unittest.originbound.der");
ASSERT_TRUE(file_util::ReadFileToString(key_path, key));
ASSERT_TRUE(file_util::ReadFileToString(cert_path, cert));
ASSERT_TRUE(base::ReadFileToString(key_path, key));
ASSERT_TRUE(base::ReadFileToString(cert_path, cert));
}
static base::Time GetTestCertExpirationTime() {

@ -94,7 +94,7 @@ class TransportSecurityPersister::Loader {
void Load() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
state_valid_ = file_util::ReadFileToString(path_, &state_);
state_valid_ = base::ReadFileToString(path_, &state_);
}
void CompleteLoad() {

@ -142,7 +142,7 @@ TEST_F(TransportSecurityPersisterTest, SerializeData3) {
// Read the data back.
std::string persisted;
EXPECT_TRUE(file_util::ReadFileToString(path, &persisted));
EXPECT_TRUE(base::ReadFileToString(path, &persisted));
EXPECT_EQ(persisted, serialized);
bool dirty;
EXPECT_TRUE(persister_->LoadEntries(persisted, &dirty));

@ -92,7 +92,7 @@ void PageCycler::ReadURLsOnBackgroundThread() {
std::vector<std::string> url_strings;
CHECK(base::PathExists(urls_file_)) << urls_file_.value();
file_util::ReadFileToString(urls_file_, &file_contents);
base::ReadFileToString(urls_file_, &file_contents);
base::SplitStringAlongWhitespace(file_contents, &url_strings);
if (!url_strings.size()) {

@ -90,8 +90,7 @@ class PageCyclerBrowserTest : public content::NotificationObserver,
// Read the errors file, and generate a vector of error strings.
std::vector<std::string> GetErrorsFromFile() {
std::string error_file_contents;
CHECK(file_util::ReadFileToString(errors_file_,
&error_file_contents));
CHECK(base::ReadFileToString(errors_file_, &error_file_contents));
if (error_file_contents[error_file_contents.size() - 1] == '\n')
error_file_contents.resize(error_file_contents.size() - 1);

Some files were not shown because too many files have changed in this diff Show More