diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-30 18:23:50 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-30 18:23:50 +0000 |
commit | 82f84b91a10f513cd59b8382a7ab00ed0f179bd5 (patch) | |
tree | 125081aff715fbe6815e8bb81889d4d49f887cf3 /content | |
parent | 88a8115978d75161674d97cde0761cbdba73daed (diff) | |
download | chromium_src-82f84b91a10f513cd59b8382a7ab00ed0f179bd5.zip chromium_src-82f84b91a10f513cd59b8382a7ab00ed0f179bd5.tar.gz chromium_src-82f84b91a10f513cd59b8382a7ab00ed0f179bd5.tar.bz2 |
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
Diffstat (limited to 'content')
19 files changed, 29 insertions, 32 deletions
diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc index 355cc32..859eaf4 100644 --- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc @@ -140,14 +140,14 @@ void DumpAccessibilityTreeTest::RunTest( printf("Testing: %s\n", html_file.MaybeAsASCII().c_str()); std::string html_contents; - file_util::ReadFileToString(html_file, &html_contents); + base::ReadFileToString(html_file, &html_contents); // Read the expected file. std::string expected_contents_raw; base::FilePath expected_file = base::FilePath(html_file.RemoveExtension().value() + AccessibilityTreeFormatter::GetExpectedFileSuffix()); - file_util::ReadFileToString(expected_file, &expected_contents_raw); + base::ReadFileToString(expected_file, &expected_contents_raw); // Tolerate Windows-style line endings (\r\n) in the expected file: // normalize by deleting all \r from the file (if any) to leave only \n. diff --git a/content/browser/devtools/devtools_http_handler_impl.cc b/content/browser/devtools/devtools_http_handler_impl.cc index c670df3..8003b8b 100644 --- a/content/browser/devtools/devtools_http_handler_impl.cc +++ b/content/browser/devtools/devtools_http_handler_impl.cc @@ -348,7 +348,7 @@ void DevToolsHttpHandlerImpl::OnHttpRequest( if (!frontend_dir.empty()) { base::FilePath path = frontend_dir.AppendASCII(filename); std::string data; - file_util::ReadFileToString(path, &data); + base::ReadFileToString(path, &data); server_->Send200(connection_id, data, mime_type); return; } diff --git a/content/browser/download/base_file_unittest.cc b/content/browser/download/base_file_unittest.cc index 826f56b..b82b0a8 100644 --- a/content/browser/download/base_file_unittest.cc +++ b/content/browser/download/base_file_unittest.cc @@ -71,7 +71,7 @@ class BaseFileTest : public testing::Test { if (!expected_data_.empty() && !expected_error_) { // Make sure the data has been properly written to disk. std::string disk_data; - EXPECT_TRUE(file_util::ReadFileToString(full_path, &disk_data)); + EXPECT_TRUE(base::ReadFileToString(full_path, &disk_data)); EXPECT_EQ(expected_data_, disk_data); } diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc index b638cfa..767819e 100644 --- a/content/browser/download/download_browsertest.cc +++ b/content/browser/download/download_browsertest.cc @@ -600,7 +600,7 @@ class DownloadContentTest : public ContentBrowserTest { 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. @@ -674,7 +674,7 @@ class DownloadContentTest : public ContentBrowserTest { if (file_exists) { std::string file_contents; - EXPECT_TRUE(file_util::ReadFileToString( + EXPECT_TRUE(base::ReadFileToString( download->GetFullPath(), &file_contents)); ASSERT_EQ(static_cast<size_t>(received_bytes), file_contents.size()); diff --git a/content/browser/download/download_file_unittest.cc b/content/browser/download/download_file_unittest.cc index 49e418c..dcc0e42 100644 --- a/content/browser/download/download_file_unittest.cc +++ b/content/browser/download/download_file_unittest.cc @@ -164,8 +164,7 @@ class DownloadFileTest : public testing::Test { // Make sure the data has been properly written to disk. std::string disk_data; - EXPECT_TRUE(file_util::ReadFileToString(download_file_->FullPath(), - &disk_data)); + EXPECT_TRUE(base::ReadFileToString(download_file_->FullPath(), &disk_data)); EXPECT_EQ(expected_data_, disk_data); // Make sure the Browser and File threads outlive the DownloadFile @@ -417,7 +416,7 @@ TEST_F(DownloadFileTest, RenameFileFinal) { ASSERT_EQ(static_cast<int>(sizeof(file_data) - 1), file_util::WriteFile(path_5, file_data, sizeof(file_data) - 1)); ASSERT_TRUE(base::PathExists(path_5)); - EXPECT_TRUE(file_util::ReadFileToString(path_5, &file_contents)); + EXPECT_TRUE(base::ReadFileToString(path_5, &file_contents)); EXPECT_EQ(std::string(file_data), file_contents); EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, @@ -425,7 +424,7 @@ TEST_F(DownloadFileTest, RenameFileFinal) { EXPECT_EQ(path_5, output_path); file_contents = ""; - EXPECT_TRUE(file_util::ReadFileToString(path_5, &file_contents)); + EXPECT_TRUE(base::ReadFileToString(path_5, &file_contents)); EXPECT_NE(std::string(file_data), file_contents); DestroyDownloadFile(0); diff --git a/content/browser/gpu/gpu_pixel_browsertest.cc b/content/browser/gpu/gpu_pixel_browsertest.cc index 3eaf857..7a13747 100644 --- a/content/browser/gpu/gpu_pixel_browsertest.cc +++ b/content/browser/gpu/gpu_pixel_browsertest.cc @@ -59,7 +59,7 @@ bool ReadPNGFile(const base::FilePath& file_path, SkBitmap* bitmap) { return false; std::string png_data; - return file_util::ReadFileToString(abs_path, &png_data) && + return base::ReadFileToString(abs_path, &png_data) && gfx::PNGCodec::Decode(reinterpret_cast<unsigned char*>(&png_data[0]), png_data.length(), bitmap); diff --git a/content/browser/tracing/trace_subscriber_stdio_unittest.cc b/content/browser/tracing/trace_subscriber_stdio_unittest.cc index 0a3be3a..10e51a9 100644 --- a/content/browser/tracing/trace_subscriber_stdio_unittest.cc +++ b/content/browser/tracing/trace_subscriber_stdio_unittest.cc @@ -35,7 +35,7 @@ TEST_F(TraceSubscriberStdioTest, CanWriteArray) { } BrowserThread::GetBlockingPool()->FlushForTesting(); std::string result; - EXPECT_TRUE(file_util::ReadFileToString(trace_file, &result)); + EXPECT_TRUE(base::ReadFileToString(trace_file, &result)); EXPECT_EQ("[foo,bar]", result); } @@ -61,7 +61,7 @@ TEST_F(TraceSubscriberStdioTest, CanWritePropertyList) { } BrowserThread::GetBlockingPool()->FlushForTesting(); std::string result; - EXPECT_TRUE(file_util::ReadFileToString(trace_file, &result)); + EXPECT_TRUE(base::ReadFileToString(trace_file, &result)); EXPECT_EQ("{\"traceEvents\":[foo,bar]}", result); } @@ -90,7 +90,7 @@ TEST_F(TraceSubscriberStdioTest, CanWriteSystemDataFirst) { } BrowserThread::GetBlockingPool()->FlushForTesting(); std::string result; - EXPECT_TRUE(file_util::ReadFileToString(trace_file, &result)); + EXPECT_TRUE(base::ReadFileToString(trace_file, &result)); EXPECT_EQ( "{\"traceEvents\":[foo,bar],\"" "systemTraceEvents\":\"event1\\nev\\\"ent\\\"2\\n\"}", @@ -122,7 +122,7 @@ TEST_F(TraceSubscriberStdioTest, CanWriteSystemDataLast) { } BrowserThread::GetBlockingPool()->FlushForTesting(); std::string result; - EXPECT_TRUE(file_util::ReadFileToString(trace_file, &result)); + EXPECT_TRUE(base::ReadFileToString(trace_file, &result)); EXPECT_EQ( "{\"traceEvents\":[foo,bar],\"" "systemTraceEvents\":\"event1\\nev\\\"ent\\\"2\\n\"}", diff --git a/content/browser/tracing/tracing_ui.cc b/content/browser/tracing/tracing_ui.cc index aab652d..7793adb 100644 --- a/content/browser/tracing/tracing_ui.cc +++ b/content/browser/tracing/tracing_ui.cc @@ -225,7 +225,7 @@ void TracingMessageHandler::OnBeginRequestBufferPercentFull( // TaskProxy callback when reading is complete. void ReadTraceFileCallback(TaskProxy* proxy, const base::FilePath& path) { std::string file_contents; - if (!file_util::ReadFileToString(path, &file_contents)) + if (!base::ReadFileToString(path, &file_contents)) return; // We need to escape the file contents, because it will go into a javascript diff --git a/content/child/npapi/plugin_host.cc b/content/child/npapi/plugin_host.cc index 9b72be4..814964fd 100644 --- a/content/child/npapi/plugin_host.cc +++ b/content/child/npapi/plugin_host.cc @@ -474,7 +474,7 @@ static NPError PostURLNotify(NPP id, post_file_info.is_directory) return NPERR_FILE_NOT_FOUND; - if (!file_util::ReadFileToString(file_path, &post_file_contents)) + if (!base::ReadFileToString(file_path, &post_file_contents)) return NPERR_FILE_NOT_FOUND; buf = post_file_contents.c_str(); diff --git a/content/common/gpu/client/gl_helper_benchmark.cc b/content/common/gpu/client/gl_helper_benchmark.cc index 02bcad75e..1c5bee2 100644 --- a/content/common/gpu/client/gl_helper_benchmark.cc +++ b/content/common/gpu/client/gl_helper_benchmark.cc @@ -82,8 +82,7 @@ class GLHelperTest : public testing::Test { void LoadPngFileToSkBitmap(const base::FilePath& filename, SkBitmap* bitmap) { std::string compressed; - file_util::ReadFileToString(base::MakeAbsoluteFilePath(filename), - &compressed); + base::ReadFileToString(base::MakeAbsoluteFilePath(filename), &compressed); ASSERT_TRUE(compressed.size()); ASSERT_TRUE(gfx::PNGCodec::Decode( reinterpret_cast<const unsigned char*>(compressed.data()), diff --git a/content/common/gpu/media/video_decode_accelerator_unittest.cc b/content/common/gpu/media/video_decode_accelerator_unittest.cc index 5b3e114..8cae38a 100644 --- a/content/common/gpu/media/video_decode_accelerator_unittest.cc +++ b/content/common/gpu/media/video_decode_accelerator_unittest.cc @@ -191,7 +191,7 @@ void ParseAndReadTestVideoData(base::FilePath::StringType data, // Read in the video data. base::FilePath filepath(video_file->file_name); - CHECK(file_util::ReadFileToString(filepath, &video_file->data_str)) + CHECK(base::ReadFileToString(filepath, &video_file->data_str)) << "test_video_file: " << filepath.MaybeAsASCII(); test_video_files->push_back(video_file); @@ -204,7 +204,7 @@ void ReadGoldenThumbnailMD5s(const TestVideoFile* video_file, base::FilePath filepath(video_file->file_name); filepath = filepath.AddExtension(FILE_PATH_LITERAL(".md5")); std::string all_md5s; - file_util::ReadFileToString(filepath, &all_md5s); + base::ReadFileToString(filepath, &all_md5s); base::SplitString(all_md5s, '\n', md5_strings); // Check these are legitimate MD5s. for (std::vector<std::string>::iterator md5_string = md5_strings->begin(); diff --git a/content/common/page_state_serialization_unittest.cc b/content/common/page_state_serialization_unittest.cc index 8577c34..e899867 100644 --- a/content/common/page_state_serialization_unittest.cc +++ b/content/common/page_state_serialization_unittest.cc @@ -216,7 +216,7 @@ class PageStateSerializationTest : public testing::Test { base::StringPrintf("serialized_v%d%s.dat", version, suffix)); std::string file_contents; - if (!file_util::ReadFileToString(path, &file_contents)) { + if (!base::ReadFileToString(path, &file_contents)) { ADD_FAILURE() << "File not found: " << path.value(); return; } diff --git a/content/common/plugin_list_posix.cc b/content/common/plugin_list_posix.cc index 251fe39..3e1353be 100644 --- a/content/common/plugin_list_posix.cc +++ b/content/common/plugin_list_posix.cc @@ -115,7 +115,7 @@ bool IsBlacklistedBySha1sumAndQuirks(const base::FilePath& path) { continue; std::string file_content; - if (!file_util::ReadFileToString(path, &file_content)) + if (!base::ReadFileToString(path, &file_content)) continue; std::string sha1 = base::SHA1HashString(file_content); std::string sha1_readable; diff --git a/content/common/sandbox_mac_fontloading_unittest.mm b/content/common/sandbox_mac_fontloading_unittest.mm index 57af4de..d78f2f4 100644 --- a/content/common/sandbox_mac_fontloading_unittest.mm +++ b/content/common/sandbox_mac_fontloading_unittest.mm @@ -31,8 +31,7 @@ REGISTER_SANDBOX_TEST_CASE(FontLoadingTestCase); // Load raw font data into shared memory object. bool FontLoadingTestCase::BeforeSandboxInit() { std::string font_data; - if (!file_util::ReadFileToString(base::FilePath(test_data_.c_str()), - &font_data)) { + if (!base::ReadFileToString(base::FilePath(test_data_.c_str()), &font_data)) { LOG(ERROR) << "Failed to read font data from file (" << test_data_ << ")"; return false; } diff --git a/content/renderer/dom_serializer_browsertest.cc b/content/renderer/dom_serializer_browsertest.cc index bcc4fc6..69dfc65 100644 --- a/content/renderer/dom_serializer_browsertest.cc +++ b/content/renderer/dom_serializer_browsertest.cc @@ -820,7 +820,7 @@ IN_PROC_BROWSER_TEST_F(DomSerializerTests, SerializeXMLDocWithBuiltInEntities) { base::FilePath xml_file_path = GetTestFilePath("dom_serializer", "note.xml"); // Read original contents for later comparison. std::string original_contents; - ASSERT_TRUE(file_util::ReadFileToString(xml_file_path, &original_contents)); + ASSERT_TRUE(base::ReadFileToString(xml_file_path, &original_contents)); // Get file URL. GURL file_url = net::FilePathToFileURL(page_file_path); GURL xml_file_url = net::FilePathToFileURL(xml_file_path); @@ -840,7 +840,7 @@ IN_PROC_BROWSER_TEST_F(DomSerializerTests, SerializeHTMLDOMWithAddingMOTW) { GetTestFilePath("dom_serializer", "youtube_2.htm"); // Read original contents for later comparison . std::string original_contents; - ASSERT_TRUE(file_util::ReadFileToString(page_file_path, &original_contents)); + ASSERT_TRUE(base::ReadFileToString(page_file_path, &original_contents)); // Get file URL. GURL file_url = net::FilePathToFileURL(page_file_path); ASSERT_TRUE(file_url.SchemeIsFile()); diff --git a/content/shell/app/webkit_test_platform_support_win.cc b/content/shell/app/webkit_test_platform_support_win.cc index 14d2a0e..59156fe 100644 --- a/content/shell/app/webkit_test_platform_support_win.cc +++ b/content/shell/app/webkit_test_platform_support_win.cc @@ -35,7 +35,7 @@ bool SetupFonts() { base_path.Append(FILE_PATH_LITERAL("/AHEM____.TTF")); std::string font_buffer; - if (!file_util::ReadFileToString(font_path, &font_buffer)) { + if (!base::ReadFileToString(font_path, &font_buffer)) { std::cerr << "Failed to load font " << WideToUTF8(font_path.value()) << "\n"; return false; diff --git a/content/shell/browser/shell_message_filter.cc b/content/shell/browser/shell_message_filter.cc index c7c4cca..fcbde2f 100644 --- a/content/shell/browser/shell_message_filter.cc +++ b/content/shell/browser/shell_message_filter.cc @@ -61,7 +61,7 @@ bool ShellMessageFilter::OnMessageReceived(const IPC::Message& message, void ShellMessageFilter::OnReadFileToString(const base::FilePath& local_file, std::string* contents) { base::ThreadRestrictions::ScopedAllowIO allow_io; - file_util::ReadFileToString(local_file, contents); + base::ReadFileToString(local_file, contents); } void ShellMessageFilter::OnRegisterIsolatedFileSystem( diff --git a/content/test/image_decoder_test.cc b/content/test/image_decoder_test.cc index 8824c67..8387d4a 100644 --- a/content/test/image_decoder_test.cc +++ b/content/test/image_decoder_test.cc @@ -39,7 +39,7 @@ bool ShouldSkipFile(const base::FilePath& path, void ReadFileToVector(const base::FilePath& path, std::vector<char>* contents) { std::string raw_image_data; - file_util::ReadFileToString(path, &raw_image_data); + base::ReadFileToString(path, &raw_image_data); contents->resize(raw_image_data.size()); memcpy(&contents->at(0), raw_image_data.data(), raw_image_data.size()); } @@ -90,7 +90,7 @@ void VerifyImage(const WebKit::WebImageDecoder& decoder, // Read the MD5 sum off disk. std::string file_bytes; - file_util::ReadFileToString(md5_sum_path, &file_bytes); + base::ReadFileToString(md5_sum_path, &file_bytes); base::MD5Digest expected_digest; ASSERT_EQ(sizeof expected_digest, file_bytes.size()) << path.value(); memcpy(&expected_digest, file_bytes.data(), sizeof expected_digest); diff --git a/content/test/net/url_request_mock_http_job.cc b/content/test/net/url_request_mock_http_job.cc index 9927960..b06f6b47 100644 --- a/content/test/net/url_request_mock_http_job.cc +++ b/content/test/net/url_request_mock_http_job.cc @@ -144,7 +144,7 @@ void URLRequestMockHTTPJob::GetResponseInfoConst( base::FilePath header_file = base::FilePath(file_path_.value() + kMockHeaderFileSuffix); std::string raw_headers; - if (!file_util::ReadFileToString(header_file, &raw_headers)) + if (!base::ReadFileToString(header_file, &raw_headers)) return; // ParseRawHeaders expects \0 to end each header line. |