summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/desktop_background/desktop_background_controller_unittest.cc2
-rw-r--r--base/file_util.h16
-rw-r--r--base/file_util_posix.cc56
-rw-r--r--base/file_util_unittest.cc19
-rw-r--r--base/file_util_win.cc40
-rw-r--r--base/files/file_path_watcher_browsertest.cc3
-rw-r--r--base/files/file_util_proxy_unittest.cc10
-rw-r--r--base/json/json_file_value_serializer.cc5
-rw-r--r--base/json/json_value_serializer_unittest.cc7
-rw-r--r--base/mac/mac_util_unittest.mm2
-rw-r--r--base/path_service_unittest.cc4
-rw-r--r--base/process/memory_linux.cc8
-rw-r--r--base/process/process_linux.cc2
-rw-r--r--base/sync_socket_posix.cc2
-rw-r--r--base/win/shortcut_unittest.cc8
-rw-r--r--cc/test/pixel_test_utils.cc2
-rw-r--r--chrome/browser/browser_shutdown.cc2
-rw-r--r--chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc4
-rw-r--r--chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc2
-rw-r--r--chrome/browser/browsing_data/browsing_data_remover_unittest.cc8
-rw-r--r--chrome/browser/chromeos/app_mode/kiosk_app_data.cc4
-rw-r--r--chrome/browser/chromeos/app_mode/kiosk_app_update_service_browsertest.cc2
-rw-r--r--chrome/browser/chromeos/boot_times_loader.cc3
-rw-r--r--chrome/browser/chromeos/contacts/contact_database_unittest.cc2
-rw-r--r--chrome/browser/chromeos/drive/file_system_util.cc2
-rw-r--r--chrome/browser/chromeos/drive/file_write_watcher_unittest.cc2
-rw-r--r--chrome/browser/chromeos/extensions/default_app_order_unittest.cc2
-rw-r--r--chrome/browser/chromeos/extensions/external_cache_unittest.cc2
-rw-r--r--chrome/browser/chromeos/extensions/wallpaper_private_api.cc3
-rw-r--r--chrome/browser/chromeos/external_metrics.cc2
-rw-r--r--chrome/browser/chromeos/file_manager/zip_file_creator_browsertest.cc6
-rw-r--r--chrome/browser/chromeos/login/managed/locally_managed_user_creation_controller.cc2
-rw-r--r--chrome/browser/chromeos/login/parallel_authenticator_unittest.cc2
-rw-r--r--chrome/browser/chromeos/login/resource_loader_browsertest.cc2
-rw-r--r--chrome/browser/chromeos/login/user_image_manager_browsertest.cc4
-rw-r--r--chrome/browser/chromeos/login/user_image_manager_impl.cc6
-rw-r--r--chrome/browser/chromeos/login/wallpaper_manager.cc2
-rw-r--r--chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc2
-rw-r--r--chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc9
-rw-r--r--chrome/browser/chromeos/policy/enterprise_install_attributes_unittest.cc4
-rw-r--r--chrome/browser/chromeos/policy/power_policy_browsertest.cc2
-rw-r--r--chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc16
-rw-r--r--chrome/browser/chromeos/policy/user_policy_disk_cache.cc2
-rw-r--r--chrome/browser/chromeos/settings/device_settings_provider_unittest.cc2
-rw-r--r--chrome/browser/chromeos/settings/owner_key_util_unittest.cc4
-rw-r--r--chrome/browser/chromeos/system/automatic_reboot_manager.cc5
-rw-r--r--chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc10
-rw-r--r--chrome/browser/component_updater/component_unpacker.cc2
-rw-r--r--chrome/browser/component_updater/widevine_cdm_component_installer.cc2
-rw-r--r--chrome/browser/devtools/devtools_file_helper.cc2
-rw-r--r--chrome/browser/diagnostics/diagnostics_controller_unittest.cc2
-rw-r--r--chrome/browser/download/chrome_download_manager_delegate_unittest.cc2
-rw-r--r--chrome/browser/download/download_path_reservation_tracker_unittest.cc8
-rw-r--r--chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc4
-rw-r--r--chrome/browser/extensions/api/image_writer_private/destroy_partitions_operation.cc2
-rw-r--r--chrome/browser/extensions/api/image_writer_private/test_utils.cc2
-rw-r--r--chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc17
-rw-r--r--chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc4
-rw-r--r--chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc2
-rw-r--r--chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc2
-rw-r--r--chrome/browser/extensions/app_background_page_apitest.cc6
-rw-r--r--chrome/browser/extensions/convert_web_app.cc2
-rw-r--r--chrome/browser/extensions/extension_creator.cc2
-rw-r--r--chrome/browser/extensions/extension_service_unittest.cc6
-rw-r--r--chrome/browser/extensions/sandboxed_unpacker.cc8
-rw-r--r--chrome/browser/extensions/test_extension_dir.cc2
-rw-r--r--chrome/browser/extensions/updater/local_extension_cache_unittest.cc2
-rw-r--r--chrome/browser/extensions/user_script_master_unittest.cc4
-rw-r--r--chrome/browser/feedback/feedback_util.cc4
-rw-r--r--chrome/browser/first_run/first_run.cc2
-rw-r--r--chrome/browser/first_run/first_run_browsertest.cc3
-rw-r--r--chrome/browser/first_run/first_run_internal_win.cc4
-rw-r--r--chrome/browser/google/google_update_settings_posix.cc2
-rw-r--r--chrome/browser/history/history_backend_unittest.cc8
-rw-r--r--chrome/browser/history/redirect_browsertest.cc6
-rw-r--r--chrome/browser/history/url_index_private_data.cc2
-rw-r--r--chrome/browser/importer/ie_importer_browsertest_win.cc6
-rw-r--r--chrome/browser/local_discovery/pwg_raster_converter.cc4
-rw-r--r--chrome/browser/media/webrtc_log_uploader.cc4
-rw-r--r--chrome/browser/media_galleries/fileapi/iapps_finder_impl_win_browsertest.cc6
-rw-r--r--chrome/browser/media_galleries/fileapi/iphoto_data_provider_browsertest.cc4
-rw-r--r--chrome/browser/media_galleries/fileapi/iphoto_file_util_unittest.cc4
-rw-r--r--chrome/browser/media_galleries/fileapi/itunes_data_provider_browsertest.cc4
-rw-r--r--chrome/browser/media_galleries/fileapi/itunes_file_util_unittest.cc6
-rw-r--r--chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc2
-rw-r--r--chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc6
-rw-r--r--chrome/browser/media_galleries/fileapi/picasa_file_util_unittest.cc4
-rw-r--r--chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm4
-rw-r--r--chrome/browser/media_galleries/media_folder_finder_unittest.cc2
-rw-r--r--chrome/browser/nacl_host/test/mock_nacl_gdb.cc8
-rw-r--r--chrome/browser/net/crl_set_fetcher.cc4
-rw-r--r--chrome/browser/parsers/metadata_parser_filebase_unittest.cc4
-rw-r--r--chrome/browser/policy/cloud/cloud_policy_browsertest.cc4
-rw-r--r--chrome/browser/policy/test/local_policy_test_server.cc10
-rw-r--r--chrome/browser/profile_resetter/automatic_profile_resetter_mementos.cc2
-rw-r--r--chrome/browser/profiles/profile_browsertest.cc2
-rw-r--r--chrome/browser/profiles/profile_impl.cc4
-rw-r--r--chrome/browser/profiles/profile_info_cache.cc5
-rw-r--r--chrome/browser/safe_browsing/download_feedback_service_unittest.cc2
-rw-r--r--chrome/browser/safe_browsing/download_feedback_unittest.cc4
-rw-r--r--chrome/browser/safe_browsing/download_protection_service_unittest.cc6
-rw-r--r--chrome/browser/shell_integration_linux.cc20
-rw-r--r--chrome/browser/shell_integration_linux_unittest.cc28
-rw-r--r--chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc10
-rw-r--r--chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc4
-rw-r--r--chrome/browser/spellchecker/spellcheck_service_browsertest.cc2
-rw-r--r--chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc2
-rw-r--r--chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc2
-rw-r--r--chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc12
-rw-r--r--chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc2
-rw-r--r--chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc2
-rw-r--r--chrome/browser/task_profiler/task_profiler_data_serializer.cc2
-rw-r--r--chrome/browser/ui/app_list/search/history_data_store_unittest.cc2
-rw-r--r--chrome/browser/ui/ash/screenshot_taker.cc2
-rw-r--r--chrome/browser/ui/certificate_dialogs.cc2
-rw-r--r--chrome/browser/ui/libgtk2ui/app_indicator_icon.cc5
-rw-r--r--chrome/browser/ui/metro_pin_tab_helper_win.cc6
-rw-r--r--chrome/browser/ui/network_profile_bubble.cc2
-rw-r--r--chrome/browser/ui/pdf/pdf_browsertest.cc2
-rw-r--r--chrome/browser/ui/startup/startup_browser_creator.cc4
-rw-r--r--chrome/browser/ui/webui/options/certificate_manager_handler.cc2
-rw-r--r--chrome/browser/web_applications/web_app_mac.mm2
-rw-r--r--chrome/browser/web_applications/web_app_win.cc6
-rw-r--r--chrome/common/auto_start_linux.cc4
-rw-r--r--chrome/common/extensions/api/storage/storage_schema_manifest_handler_unittest.cc2
-rw-r--r--chrome/common/extensions/extension_file_util_unittest.cc30
-rw-r--r--chrome/common/extensions/extension_l10n_util_unittest.cc16
-rw-r--r--chrome/common/importer/firefox_importer_utils_unittest.cc6
-rw-r--r--chrome/common/mac/mock_launchd.cc4
-rw-r--r--chrome/common/media_galleries/picasa_test_util.cc12
-rw-r--r--chrome/common/media_galleries/pmp_test_util.cc4
-rw-r--r--chrome/common/net/url_fixer_upper_unittest.cc2
-rw-r--r--chrome/installer/setup/install.cc2
-rw-r--r--chrome/installer/setup/install_unittest.cc2
-rw-r--r--chrome/installer/setup/setup_main.cc2
-rw-r--r--chrome/installer/setup/setup_util_unittest.cc6
-rw-r--r--chrome/installer/test/alternate_version_generator.cc12
-rw-r--r--chrome/installer/util/install_util_unittest.cc2
-rw-r--r--chrome/installer/util/logging_installer.cc5
-rw-r--r--chrome/installer/util/logging_installer_unittest.cc8
-rw-r--r--chrome/installer/util/master_preferences_unittest.cc8
-rw-r--r--chrome/installer/util/self_cleaning_temp_dir_unittest.cc4
-rw-r--r--chrome/installer/util/shell_util_unittest.cc10
-rw-r--r--chrome/renderer/mock_printer.cc4
-rw-r--r--chrome/service/cloud_print/connector_settings_unittest.cc2
-rw-r--r--chrome/service/cloud_print/printer_job_handler.cc4
-rw-r--r--chrome/test/base/ui_test_utils.cc2
-rw-r--r--chrome/test/chromedriver/chrome/zip_reader.cc2
-rw-r--r--chrome/test/chromedriver/chrome_launcher.cc10
-rw-r--r--chrome/test/chromedriver/util.cc2
-rw-r--r--chrome/test/perf/startup_test.cc2
-rw-r--r--chrome/tools/convert_dict/convert_dict_unittest.cc4
-rw-r--r--chrome/tools/profile_reset/jtl_compiler_frontend.cc2
-rw-r--r--chrome/tools/safe_browsing/sb_sigutil.cc2
-rw-r--r--chrome/utility/extensions/unpacker.cc2
-rw-r--r--chrome/utility/extensions/unpacker_unittest.cc2
-rw-r--r--chrome/utility/image_writer/image_writer_unittest.cc2
-rw-r--r--chrome/utility/media_galleries/pmp_column_reader_unittest.cc2
-rw-r--r--chromeos/dbus/cros_disks_client.cc2
-rw-r--r--chromeos/dbus/session_manager_client.cc2
-rw-r--r--chromeos/process_proxy/process_output_watcher_unittest.cc6
-rw-r--r--chromeos/process_proxy/process_proxy.cc8
-rw-r--r--cloud_print/gcp20/prototype/print_job_handler.cc8
-rw-r--r--cloud_print/gcp20/prototype/printer_state.cc2
-rw-r--r--cloud_print/service/win/chrome_launcher.cc6
-rw-r--r--cloud_print/service/win/cloud_print_service.cc2
-rw-r--r--cloud_print/service/win/cloud_print_service_config.cc2
-rw-r--r--components/autofill/core/browser/data_driven_test.cc4
-rw-r--r--components/browser_context_keyed_service/browser_context_dependency_manager.cc2
-rw-r--r--components/nacl/browser/nacl_browser.cc2
-rw-r--r--components/policy/core/common/cloud/resource_cache.cc2
-rw-r--r--components/policy/core/common/cloud/user_cloud_policy_store.cc2
-rw-r--r--components/policy/core/common/cloud/user_cloud_policy_store_unittest.cc14
-rw-r--r--components/policy/core/common/config_dir_policy_loader_unittest.cc2
-rw-r--r--components/policy/core/common/policy_loader_win_unittest.cc2
-rw-r--r--components/storage_monitor/image_capture_device_manager_unittest.mm4
-rw-r--r--content/browser/accessibility/dump_accessibility_tree_browsertest.cc2
-rw-r--r--content/browser/dom_storage/dom_storage_database_unittest.cc2
-rw-r--r--content/browser/download/base_file_posix.cc2
-rw-r--r--content/browser/download/download_file_unittest.cc4
-rw-r--r--content/browser/fileapi/blob_url_request_job_unittest.cc6
-rw-r--r--content/browser/fileapi/copy_or_move_operation_delegate_unittest.cc18
-rw-r--r--content/browser/fileapi/file_system_operation_impl_unittest.cc6
-rw-r--r--content/browser/fileapi/obfuscated_file_util_unittest.cc6
-rw-r--r--content/browser/indexed_db/indexed_db_quota_client_unittest.cc2
-rw-r--r--content/browser/storage_partition_impl_unittest.cc6
-rw-r--r--content/common/gpu/media/vaapi_h264_decoder_unittest.cc2
-rw-r--r--content/common/gpu/media/video_decode_accelerator_unittest.cc2
-rw-r--r--content/common/gpu/media/video_encode_accelerator_unittest.cc2
-rw-r--r--content/common/sandbox_mac_fontloading_unittest.mm2
-rw-r--r--content/public/test/async_file_test_helper.cc2
-rw-r--r--content/test/image_decoder_test.cc2
-rw-r--r--courgette/courgette_tool.cc2
-rw-r--r--courgette/ensemble_apply.cc2
-rw-r--r--courgette/third_party/bsdiff_apply.cc2
-rw-r--r--extensions/browser/value_store/leveldb_value_store_unittest.cc2
-rw-r--r--extensions/common/extension_resource_unittest.cc8
-rw-r--r--extensions/common/file_util_unittest.cc4
-rw-r--r--google_apis/drive/test_util.cc2
-rw-r--r--net/base/file_stream_unittest.cc6
-rw-r--r--net/base/upload_data_stream_unittest.cc18
-rw-r--r--net/base/upload_file_element_reader_unittest.cc2
-rw-r--r--net/disk_cache/backend_unittest.cc6
-rw-r--r--net/disk_cache/blockfile/block_files_unittest.cc2
-rw-r--r--net/disk_cache/simple/simple_index_file.cc2
-rw-r--r--net/disk_cache/simple/simple_index_file_unittest.cc13
-rw-r--r--net/disk_cache/simple/simple_version_upgrade_unittest.cc10
-rw-r--r--net/http/http_network_transaction_unittest.cc2
-rw-r--r--net/http/transport_security_persister_unittest.cc3
-rw-r--r--net/proxy/proxy_config_service_linux_unittest.cc8
-rw-r--r--net/spdy/spdy_network_transaction_unittest.cc6
-rw-r--r--net/tools/crl_set_dump/crl_set_dump.cc3
-rw-r--r--net/tools/tld_cleanup/tld_cleanup_util.cc2
-rw-r--r--net/url_request/url_fetcher_impl_unittest.cc2
-rw-r--r--net/url_request/url_request_unittest.cc8
-rw-r--r--printing/backend/cups_helper.cc2
-rw-r--r--printing/image.cc2
-rw-r--r--printing/pdf_metafile_skia.cc12
-rw-r--r--remoting/host/config_file_watcher_unittest.cc4
-rw-r--r--remoting/host/json_host_config_unittest.cc2
-rw-r--r--remoting/host/setup/daemon_controller_delegate_mac.mm2
-rw-r--r--skia/ext/image_operations_unittest.cc2
-rw-r--r--third_party/zlib/google/zip_reader.cc2
-rw-r--r--third_party/zlib/google/zip_unittest.cc2
-rw-r--r--tools/gn/function_write_file.cc2
-rw-r--r--tools/gn/gyp_target_writer.cc2
-rw-r--r--tools/gn/ninja_target_writer.cc4
-rw-r--r--tools/gn/trace.cc2
-rw-r--r--tools/imagediff/image_diff.cc2
-rw-r--r--ui/base/l10n/l10n_util_unittest.cc2
-rw-r--r--ui/base/resource/data_pack_unittest.cc4
-rw-r--r--ui/base/resource/resource_bundle_unittest.cc8
-rw-r--r--ui/gfx/ozone/impl/file_surface_factory.cc6
-rw-r--r--webkit/browser/appcache/appcache_database_unittest.cc6
-rw-r--r--webkit/browser/appcache/appcache_storage_impl_unittest.cc2
-rw-r--r--webkit/browser/blob/local_file_stream_reader_unittest.cc2
-rw-r--r--webkit/browser/database/database_tracker_unittest.cc14
-rw-r--r--webkit/browser/fileapi/local_file_stream_writer_unittest.cc2
-rw-r--r--webkit/browser/fileapi/sandbox_prioritized_origin_database_unittest.cc15
239 files changed, 582 insertions, 611 deletions
diff --git a/ash/desktop_background/desktop_background_controller_unittest.cc b/ash/desktop_background/desktop_background_controller_unittest.cc
index 3c41f3d..1c48105 100644
--- a/ash/desktop_background/desktop_background_controller_unittest.cc
+++ b/ash/desktop_background/desktop_background_controller_unittest.cc
@@ -215,7 +215,7 @@ class DesktopBackgroundControllerTest : public test::AshTestBase {
return false;
}
- size_t bytes_written = file_util::WriteFile(
+ size_t bytes_written = base::WriteFile(
path, reinterpret_cast<const char*>(&output[0]), output.size());
if (bytes_written != output.size()) {
LOG(ERROR) << "Wrote " << bytes_written << " byte(s) instead of "
diff --git a/base/file_util.h b/base/file_util.h
index bd33998..32dce3b 100644
--- a/base/file_util.h
+++ b/base/file_util.h
@@ -328,20 +328,22 @@ BASE_EXPORT bool TruncateFile(FILE* file);
// the number of read bytes, or -1 on error.
BASE_EXPORT int ReadFile(const FilePath& filename, char* data, int size);
-} // namespace base
-
-// -----------------------------------------------------------------------------
-
-namespace file_util {
-
// Writes the given buffer into the file, overwriting any data that was
// previously there. Returns the number of bytes written, or -1 on error.
-BASE_EXPORT int WriteFile(const base::FilePath& filename, const char* data,
+BASE_EXPORT int WriteFile(const FilePath& filename, const char* data,
int size);
+
#if defined(OS_POSIX)
// Append the data to |fd|. Does not close |fd| when done.
BASE_EXPORT int WriteFileDescriptor(const int fd, const char* data, int size);
#endif
+
+} // namespace base
+
+// -----------------------------------------------------------------------------
+
+namespace file_util {
+
// Append the given buffer into the file. Returns the number of bytes written,
// or -1 on error.
BASE_EXPORT int AppendToFile(const base::FilePath& filename,
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index f17b341..39b29b3 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -712,6 +712,33 @@ int ReadFile(const FilePath& filename, char* data, int size) {
return bytes_read;
}
+int WriteFile(const FilePath& filename, const char* data, int size) {
+ ThreadRestrictions::AssertIOAllowed();
+ int fd = HANDLE_EINTR(creat(filename.value().c_str(), 0666));
+ if (fd < 0)
+ return -1;
+
+ int bytes_written = WriteFileDescriptor(fd, data, size);
+ if (int ret = IGNORE_EINTR(close(fd)) < 0)
+ return ret;
+ return bytes_written;
+}
+
+int WriteFileDescriptor(const int fd, const char* data, int size) {
+ // Allow for partial writes.
+ ssize_t bytes_written_total = 0;
+ for (ssize_t bytes_written_partial = 0; bytes_written_total < size;
+ bytes_written_total += bytes_written_partial) {
+ bytes_written_partial =
+ HANDLE_EINTR(write(fd, data + bytes_written_total,
+ size - bytes_written_total));
+ if (bytes_written_partial < 0)
+ return -1;
+ }
+
+ return bytes_written_total;
+}
+
} // namespace base
// -----------------------------------------------------------------------------
@@ -750,40 +777,13 @@ FILE* OpenFile(const std::string& filename, const char* mode) {
return OpenFile(FilePath(filename), mode);
}
-int WriteFile(const FilePath& filename, const char* data, int size) {
- base::ThreadRestrictions::AssertIOAllowed();
- int fd = HANDLE_EINTR(creat(filename.value().c_str(), 0666));
- if (fd < 0)
- return -1;
-
- int bytes_written = WriteFileDescriptor(fd, data, size);
- if (int ret = IGNORE_EINTR(close(fd)) < 0)
- return ret;
- return bytes_written;
-}
-
-int WriteFileDescriptor(const int fd, const char* data, int size) {
- // Allow for partial writes.
- ssize_t bytes_written_total = 0;
- for (ssize_t bytes_written_partial = 0; bytes_written_total < size;
- bytes_written_total += bytes_written_partial) {
- bytes_written_partial =
- HANDLE_EINTR(write(fd, data + bytes_written_total,
- size - bytes_written_total));
- if (bytes_written_partial < 0)
- return -1;
- }
-
- return bytes_written_total;
-}
-
int AppendToFile(const FilePath& filename, const char* data, int size) {
base::ThreadRestrictions::AssertIOAllowed();
int fd = HANDLE_EINTR(open(filename.value().c_str(), O_WRONLY | O_APPEND));
if (fd < 0)
return -1;
- int bytes_written = WriteFileDescriptor(fd, data, size);
+ int bytes_written = base::WriteFileDescriptor(fd, data, size);
if (int ret = IGNORE_EINTR(close(fd)) < 0)
return ret;
return bytes_written;
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index e410c64..f360c7a 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -703,7 +703,7 @@ TEST_F(FileUtilTest, ChangeFilePermissionsAndRead) {
// Write file.
EXPECT_EQ(static_cast<int>(kData.length()),
- file_util::WriteFile(file_name, kData.data(), kData.length()));
+ WriteFile(file_name, kData.data(), kData.length()));
EXPECT_TRUE(PathExists(file_name));
// Make sure the file is readable.
@@ -742,7 +742,7 @@ TEST_F(FileUtilTest, ChangeFilePermissionsAndWrite) {
// Write file.
EXPECT_EQ(static_cast<int>(kData.length()),
- file_util::WriteFile(file_name, kData.data(), kData.length()));
+ WriteFile(file_name, kData.data(), kData.length()));
EXPECT_TRUE(PathExists(file_name));
// Make sure the file is writable.
@@ -756,8 +756,7 @@ TEST_F(FileUtilTest, ChangeFilePermissionsAndWrite) {
EXPECT_TRUE(GetPosixFilePermissions(file_name, &mode));
EXPECT_FALSE(mode & FILE_PERMISSION_WRITE_BY_USER);
// Make sure the file can't be write.
- EXPECT_EQ(-1,
- file_util::WriteFile(file_name, kData.data(), kData.length()));
+ EXPECT_EQ(-1, WriteFile(file_name, kData.data(), kData.length()));
EXPECT_FALSE(PathIsWritable(file_name));
// Give read permission.
@@ -767,7 +766,7 @@ TEST_F(FileUtilTest, ChangeFilePermissionsAndWrite) {
EXPECT_TRUE(mode & FILE_PERMISSION_WRITE_BY_USER);
// Make sure the file can be write.
EXPECT_EQ(static_cast<int>(kData.length()),
- file_util::WriteFile(file_name, kData.data(), kData.length()));
+ WriteFile(file_name, kData.data(), kData.length()));
EXPECT_TRUE(PathIsWritable(file_name));
// Delete the file.
@@ -787,7 +786,7 @@ TEST_F(FileUtilTest, ChangeDirectoryPermissionsAndEnumerate) {
EXPECT_FALSE(PathExists(file_name));
const std::string kData("hello");
EXPECT_EQ(static_cast<int>(kData.length()),
- file_util::WriteFile(file_name, kData.data(), kData.length()));
+ WriteFile(file_name, kData.data(), kData.length()));
EXPECT_TRUE(PathExists(file_name));
// Make sure the directory has the all permissions.
@@ -1950,7 +1949,7 @@ TEST_F(FileUtilTest, AppendToFile) {
std::string data("hello");
EXPECT_EQ(-1, file_util::AppendToFile(foobar, data.c_str(), data.length()));
EXPECT_EQ(static_cast<int>(data.length()),
- file_util::WriteFile(foobar, data.c_str(), data.length()));
+ WriteFile(foobar, data.c_str(), data.length()));
EXPECT_EQ(static_cast<int>(data.length()),
file_util::AppendToFile(foobar, data.c_str(), data.length()));
@@ -1965,7 +1964,7 @@ TEST_F(FileUtilTest, ReadFileToString) {
FilePath file_path =
temp_dir_.path().Append(FILE_PATH_LITERAL("ReadFileToStringTest"));
- ASSERT_EQ(4, file_util::WriteFile(file_path, kTestData, 4));
+ ASSERT_EQ(4, WriteFile(file_path, kTestData, 4));
EXPECT_TRUE(ReadFileToString(file_path, &data));
EXPECT_EQ(kTestData, data);
@@ -2017,7 +2016,7 @@ TEST_F(FileUtilTest, TouchFile) {
FilePath foobar(data_dir.Append(FILE_PATH_LITERAL("foobar.txt")));
std::string data("hello");
- ASSERT_TRUE(file_util::WriteFile(foobar, data.c_str(), data.length()));
+ ASSERT_TRUE(WriteFile(foobar, data.c_str(), data.length()));
Time access_time;
// This timestamp is divisible by one day (in local timezone),
@@ -2051,7 +2050,7 @@ TEST_F(FileUtilTest, IsDirectoryEmpty) {
FilePath foo(empty_dir.Append(FILE_PATH_LITERAL("foo.txt")));
std::string bar("baz");
- ASSERT_TRUE(file_util::WriteFile(foo, bar.c_str(), bar.length()));
+ ASSERT_TRUE(WriteFile(foo, bar.c_str(), bar.length()));
EXPECT_FALSE(IsDirectoryEmpty(empty_dir));
}
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index e7aadc2..58e02dc 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -599,23 +599,8 @@ int ReadFile(const FilePath& filename, char* data, int size) {
return -1;
}
-} // namespace base
-
-// -----------------------------------------------------------------------------
-
-namespace file_util {
-
-using base::DirectoryExists;
-using base::FilePath;
-using base::kFileShareAll;
-
-FILE* OpenFile(const std::string& filename, const char* mode) {
- base::ThreadRestrictions::AssertIOAllowed();
- return _fsopen(filename.c_str(), mode, _SH_DENYNO);
-}
-
int WriteFile(const FilePath& filename, const char* data, int size) {
- base::ThreadRestrictions::AssertIOAllowed();
+ ThreadRestrictions::AssertIOAllowed();
base::win::ScopedHandle file(CreateFile(filename.value().c_str(),
GENERIC_WRITE,
0,
@@ -625,7 +610,7 @@ int WriteFile(const FilePath& filename, const char* data, int size) {
NULL));
if (!file) {
DLOG_GETLASTERROR(WARNING) << "CreateFile failed for path "
- << filename.value();
+ << UTF16ToUTF8(filename.value());
return -1;
}
@@ -636,16 +621,31 @@ int WriteFile(const FilePath& filename, const char* data, int size) {
if (!result) {
// WriteFile failed.
- DLOG_GETLASTERROR(WARNING) << "writing file " << filename.value()
- << " failed";
+ DLOG_GETLASTERROR(WARNING) << "writing file "
+ << UTF16ToUTF8(filename.value()) << " failed";
} else {
// Didn't write all the bytes.
DLOG(WARNING) << "wrote" << written << " bytes to "
- << filename.value() << " expected " << size;
+ << UTF16ToUTF8(filename.value()) << " expected " << size;
}
return -1;
}
+} // namespace base
+
+// -----------------------------------------------------------------------------
+
+namespace file_util {
+
+using base::DirectoryExists;
+using base::FilePath;
+using base::kFileShareAll;
+
+FILE* OpenFile(const std::string& filename, const char* mode) {
+ base::ThreadRestrictions::AssertIOAllowed();
+ return _fsopen(filename.c_str(), mode, _SH_DENYNO);
+}
+
int AppendToFile(const FilePath& filename, const char* data, int size) {
base::ThreadRestrictions::AssertIOAllowed();
base::win::ScopedHandle file(CreateFile(filename.value().c_str(),
diff --git a/base/files/file_path_watcher_browsertest.cc b/base/files/file_path_watcher_browsertest.cc
index aed409c..cd3c048 100644
--- a/base/files/file_path_watcher_browsertest.cc
+++ b/base/files/file_path_watcher_browsertest.cc
@@ -172,8 +172,7 @@ class FilePathWatcherTest : public testing::Test {
// Write |content| to |file|. Returns true on success.
bool WriteFile(const FilePath& file, const std::string& content) {
- int write_size = file_util::WriteFile(file, content.c_str(),
- content.length());
+ int write_size = ::base::WriteFile(file, content.c_str(), content.length());
return write_size == static_cast<int>(content.length());
}
diff --git a/base/files/file_util_proxy_unittest.cc b/base/files/file_util_proxy_unittest.cc
index 30c77d3..8d8c8eb 100644
--- a/base/files/file_util_proxy_unittest.cc
+++ b/base/files/file_util_proxy_unittest.cc
@@ -132,7 +132,7 @@ TEST_F(FileUtilProxyTest, CreateOrOpen_Create) {
TEST_F(FileUtilProxyTest, CreateOrOpen_Open) {
// Creates a file.
- file_util::WriteFile(test_path(), NULL, 0);
+ WriteFile(test_path(), NULL, 0);
ASSERT_TRUE(PathExists(test_path()));
// Opens the created file.
@@ -223,7 +223,7 @@ TEST_F(FileUtilProxyTest, CreateTemporary) {
TEST_F(FileUtilProxyTest, GetFileInfo_File) {
// Setup.
- ASSERT_EQ(4, file_util::WriteFile(test_path(), "test", 4));
+ ASSERT_EQ(4, WriteFile(test_path(), "test", 4));
File::Info expected_info;
GetFileInfo(test_path(), &expected_info);
@@ -272,7 +272,7 @@ TEST_F(FileUtilProxyTest, Read) {
const char expected_data[] = "bleh";
int expected_bytes = arraysize(expected_data);
ASSERT_EQ(expected_bytes,
- file_util::WriteFile(test_path(), expected_data, expected_bytes));
+ WriteFile(test_path(), expected_data, expected_bytes));
// Run.
FileUtilProxy::Read(
@@ -354,7 +354,7 @@ TEST_F(FileUtilProxyTest, Touch) {
TEST_F(FileUtilProxyTest, Truncate_Shrink) {
// Setup.
const char kTestData[] = "0123456789";
- ASSERT_EQ(10, file_util::WriteFile(test_path(), kTestData, 10));
+ ASSERT_EQ(10, WriteFile(test_path(), kTestData, 10));
File::Info info;
GetFileInfo(test_path(), &info);
ASSERT_EQ(10, info.size);
@@ -381,7 +381,7 @@ TEST_F(FileUtilProxyTest, Truncate_Shrink) {
TEST_F(FileUtilProxyTest, Truncate_Expand) {
// Setup.
const char kTestData[] = "9876543210";
- ASSERT_EQ(10, file_util::WriteFile(test_path(), kTestData, 10));
+ ASSERT_EQ(10, WriteFile(test_path(), kTestData, 10));
File::Info info;
GetFileInfo(test_path(), &info);
ASSERT_EQ(10, info.size);
diff --git a/base/json/json_file_value_serializer.cc b/base/json/json_file_value_serializer.cc
index 70d0c88..e33080c 100644
--- a/base/json/json_file_value_serializer.cc
+++ b/base/json/json_file_value_serializer.cc
@@ -36,9 +36,8 @@ bool JSONFileValueSerializer::SerializeInternal(const base::Value& root,
return false;
int data_size = static_cast<int>(json_string.size());
- if (file_util::WriteFile(json_file_path_,
- json_string.data(),
- data_size) != data_size)
+ if (base::WriteFile(json_file_path_, json_string.data(), data_size) !=
+ data_size)
return false;
return true;
diff --git a/base/json/json_value_serializer_unittest.cc b/base/json/json_value_serializer_unittest.cc
index 44c0a57..f8d3a201 100644
--- a/base/json/json_value_serializer_unittest.cc
+++ b/base/json/json_value_serializer_unittest.cc
@@ -118,7 +118,7 @@ TEST(JSONValueSerializerTest, ReadProperJSONFromFile) {
// Write it down in the file.
FilePath temp_file(tempdir.path().AppendASCII("test.json"));
ASSERT_EQ(static_cast<int>(strlen(kProperJSON)),
- file_util::WriteFile(temp_file, kProperJSON, strlen(kProperJSON)));
+ WriteFile(temp_file, kProperJSON, strlen(kProperJSON)));
// Try to deserialize it through the serializer.
JSONFileValueSerializer file_deserializer(temp_file);
@@ -142,9 +142,8 @@ TEST(JSONValueSerializerTest, ReadJSONWithCommasFromFile) {
// Write it down in the file.
FilePath temp_file(tempdir.path().AppendASCII("test.json"));
ASSERT_EQ(static_cast<int>(strlen(kProperJSONWithCommas)),
- file_util::WriteFile(temp_file,
- kProperJSONWithCommas,
- strlen(kProperJSONWithCommas)));
+ WriteFile(temp_file, kProperJSONWithCommas,
+ strlen(kProperJSONWithCommas)));
// Try to deserialize it through the serializer.
JSONFileValueSerializer file_deserializer(temp_file);
diff --git a/base/mac/mac_util_unittest.mm b/base/mac/mac_util_unittest.mm
index 1b56814..079f3c2 100644
--- a/base/mac/mac_util_unittest.mm
+++ b/base/mac/mac_util_unittest.mm
@@ -108,7 +108,7 @@ TEST_F(MacUtilTest, TestExcludeFileFromBackups) {
const char dummy_data[] = "All your base are belong to us!";
// Dump something real into the file.
ASSERT_EQ(static_cast<int>(arraysize(dummy_data)),
- file_util::WriteFile(dummy_file_path, dummy_data, arraysize(dummy_data)));
+ WriteFile(dummy_file_path, dummy_data, arraysize(dummy_data)));
NSString* fileURLString =
[NSString stringWithUTF8String:dummy_file_path.value().c_str()];
NSURL* fileURL = [NSURL URLWithString:fileURLString];
diff --git a/base/path_service_unittest.cc b/base/path_service_unittest.cc
index 8ac5323..d5296cf 100644
--- a/base/path_service_unittest.cc
+++ b/base/path_service_unittest.cc
@@ -179,12 +179,12 @@ TEST_F(PathServiceTest, OverrideMultiple) {
base::FilePath fake_cache_dir1(temp_dir.path().AppendASCII("1"));
EXPECT_TRUE(PathService::Override(my_special_key, fake_cache_dir1));
EXPECT_TRUE(base::PathExists(fake_cache_dir1));
- ASSERT_EQ(1, file_util::WriteFile(fake_cache_dir1.AppendASCII("t1"), ".", 1));
+ ASSERT_EQ(1, base::WriteFile(fake_cache_dir1.AppendASCII("t1"), ".", 1));
base::FilePath fake_cache_dir2(temp_dir.path().AppendASCII("2"));
EXPECT_TRUE(PathService::Override(my_special_key + 1, fake_cache_dir2));
EXPECT_TRUE(base::PathExists(fake_cache_dir2));
- ASSERT_EQ(1, file_util::WriteFile(fake_cache_dir2.AppendASCII("t2"), ".", 1));
+ ASSERT_EQ(1, base::WriteFile(fake_cache_dir2.AppendASCII("t2"), ".", 1));
base::FilePath result;
EXPECT_TRUE(PathService::Get(my_special_key, &result));
diff --git a/base/process/memory_linux.cc b/base/process/memory_linux.cc
index e5e21b3..a40c270 100644
--- a/base/process/memory_linux.cc
+++ b/base/process/memory_linux.cc
@@ -161,9 +161,7 @@ bool AdjustOOMScore(ProcessId process, int score) {
DVLOG(1) << "Adjusting oom_score_adj of " << process << " to "
<< score_str;
int score_len = static_cast<int>(score_str.length());
- return (score_len == file_util::WriteFile(oom_file,
- score_str.c_str(),
- score_len));
+ return (score_len == WriteFile(oom_file, score_str.c_str(), score_len));
}
// If the oom_score_adj file doesn't exist, then we write the old
@@ -178,9 +176,7 @@ bool AdjustOOMScore(ProcessId process, int score) {
std::string score_str = IntToString(converted_score);
DVLOG(1) << "Adjusting oom_adj of " << process << " to " << score_str;
int score_len = static_cast<int>(score_str.length());
- return (score_len == file_util::WriteFile(oom_file,
- score_str.c_str(),
- score_len));
+ return (score_len == WriteFile(oom_file, score_str.c_str(), score_len));
}
return false;
diff --git a/base/process/process_linux.cc b/base/process/process_linux.cc
index b12e994..c5acf1b 100644
--- a/base/process/process_linux.cc
+++ b/base/process/process_linux.cc
@@ -95,7 +95,7 @@ bool Process::SetProcessBackgrounded(bool background) {
const base::FilePath file =
background ?
cgroups.Get().background_file : cgroups.Get().foreground_file;
- return file_util::WriteFile(file, pid.c_str(), pid.size()) > 0;
+ return base::WriteFile(file, pid.c_str(), pid.size()) > 0;
}
#endif // OS_CHROMEOS
diff --git a/base/sync_socket_posix.cc b/base/sync_socket_posix.cc
index 5bb893a..6d397ff 100644
--- a/base/sync_socket_posix.cc
+++ b/base/sync_socket_posix.cc
@@ -36,7 +36,7 @@ size_t SendHelper(SyncSocket::Handle handle,
DCHECK_LE(length, kMaxMessageLength);
DCHECK_NE(handle, SyncSocket::kInvalidHandle);
const char* charbuffer = static_cast<const char*>(buffer);
- const int len = file_util::WriteFileDescriptor(handle, charbuffer, length);
+ const int len = WriteFileDescriptor(handle, charbuffer, length);
return len < 0 ? 0 : static_cast<size_t>(len);
}
diff --git a/base/win/shortcut_unittest.cc b/base/win/shortcut_unittest.cc
index 75ee9ab..7a6f41d 100644
--- a/base/win/shortcut_unittest.cc
+++ b/base/win/shortcut_unittest.cc
@@ -34,8 +34,7 @@ class ShortcutTest : public testing::Test {
// Shortcut 1's properties
{
const FilePath target_file(temp_dir_.path().Append(L"Target 1.txt"));
- file_util::WriteFile(target_file, kFileContents,
- arraysize(kFileContents));
+ WriteFile(target_file, kFileContents, arraysize(kFileContents));
link_properties_.set_target(target_file);
link_properties_.set_working_dir(temp_dir_.path());
@@ -49,11 +48,10 @@ class ShortcutTest : public testing::Test {
// Shortcut 2's properties (all different from properties of shortcut 1).
{
const FilePath target_file_2(temp_dir_.path().Append(L"Target 2.txt"));
- file_util::WriteFile(target_file_2, kFileContents2,
- arraysize(kFileContents2));
+ WriteFile(target_file_2, kFileContents2, arraysize(kFileContents2));
FilePath icon_path_2;
- base::CreateTemporaryFileInDir(temp_dir_.path(), &icon_path_2);
+ CreateTemporaryFileInDir(temp_dir_.path(), &icon_path_2);
link_properties_2_.set_target(target_file_2);
link_properties_2_.set_working_dir(temp_dir_2_.path());
diff --git a/cc/test/pixel_test_utils.cc b/cc/test/pixel_test_utils.cc
index f6b2a8c..99970b8 100644
--- a/cc/test/pixel_test_utils.cc
+++ b/cc/test/pixel_test_utils.cc
@@ -23,7 +23,7 @@ bool WritePNGFile(const SkBitmap& bitmap, const base::FilePath& file_path,
base::CreateDirectory(file_path.DirName())) {
char* data = reinterpret_cast<char*>(&png_data[0]);
int size = static_cast<int>(png_data.size());
- return file_util::WriteFile(file_path, data, size) == size;
+ return base::WriteFile(file_path, data, size) == size;
}
return false;
}
diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc
index 327392f..7ebee0d 100644
--- a/chrome/browser/browser_shutdown.cc
+++ b/chrome/browser/browser_shutdown.cc
@@ -269,7 +269,7 @@ void ShutdownPostThreadsStop(bool restart_last_session) {
base::Int64ToString(shutdown_delta.InMilliseconds());
int len = static_cast<int>(shutdown_ms.length()) + 1;
base::FilePath shutdown_ms_file = GetShutdownMsPath();
- file_util::WriteFile(shutdown_ms_file, shutdown_ms.c_str(), len);
+ base::WriteFile(shutdown_ms_file, shutdown_ms.c_str(), len);
}
#if defined(OS_CHROMEOS)
diff --git a/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc b/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc
index cc56690..971550a 100644
--- a/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc
+++ b/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc
@@ -42,14 +42,14 @@ class BrowsingDataDatabaseHelperTest : public InProcessBrowserTest {
base::FilePath db_path1 =
db_tracker->GetFullDBFilePath(kTestIdentifier1, db_name);
base::CreateDirectory(db_path1.DirName());
- ASSERT_EQ(0, file_util::WriteFile(db_path1, NULL, 0));
+ ASSERT_EQ(0, base::WriteFile(db_path1, NULL, 0));
db_tracker->DatabaseOpened(kTestIdentifierExtension, db_name, description,
1, &size);
db_tracker->DatabaseClosed(kTestIdentifierExtension, db_name);
base::FilePath db_path2 =
db_tracker->GetFullDBFilePath(kTestIdentifierExtension, db_name);
base::CreateDirectory(db_path2.DirName());
- ASSERT_EQ(0, file_util::WriteFile(db_path2, NULL, 0));
+ ASSERT_EQ(0, base::WriteFile(db_path2, NULL, 0));
std::vector<webkit_database::OriginInfo> origins;
db_tracker->GetAllOriginsInfo(&origins);
ASSERT_EQ(2U, origins.size());
diff --git a/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc b/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc
index 564e07f9..b6a69d6 100644
--- a/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc
+++ b/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc
@@ -60,7 +60,7 @@ class BrowsingDataLocalStorageHelperTest : public InProcessBrowserTest {
};
for (size_t i = 0; i < arraysize(kFilesToCreate); ++i) {
base::FilePath file_path = storage_path.Append(kFilesToCreate[i]);
- file_util::WriteFile(file_path, NULL, 0);
+ base::WriteFile(file_path, NULL, 0);
}
}
diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
index 091989b..e267683 100644
--- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
@@ -562,10 +562,10 @@ class RemoveLocalStorageTester {
base::CreateDirectory(storage_path);
// Write some files.
- file_util::WriteFile(storage_path.Append(kDomStorageOrigin1), NULL, 0);
- file_util::WriteFile(storage_path.Append(kDomStorageOrigin2), NULL, 0);
- file_util::WriteFile(storage_path.Append(kDomStorageOrigin3), NULL, 0);
- file_util::WriteFile(storage_path.Append(kDomStorageExt), NULL, 0);
+ base::WriteFile(storage_path.Append(kDomStorageOrigin1), NULL, 0);
+ base::WriteFile(storage_path.Append(kDomStorageOrigin2), NULL, 0);
+ base::WriteFile(storage_path.Append(kDomStorageOrigin3), NULL, 0);
+ base::WriteFile(storage_path.Append(kDomStorageExt), NULL, 0);
// Tweak their dates.
base::Time now = base::Time::Now();
diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_data.cc b/chrome/browser/chromeos/app_mode/kiosk_app_data.cc
index 05a0a89..d97c75d 100644
--- a/chrome/browser/chromeos/app_mode/kiosk_app_data.cc
+++ b/chrome/browser/chromeos/app_mode/kiosk_app_data.cc
@@ -58,8 +58,8 @@ void SaveIconToLocalOnBlockingPool(
CHECK(base::CreateDirectory(dir));
CHECK_EQ(static_cast<int>(raw_icon->size()),
- file_util::WriteFile(icon_path,
- raw_icon->data().c_str(), raw_icon->size()));
+ base::WriteFile(icon_path,
+ raw_icon->data().c_str(), raw_icon->size()));
}
// Returns true for valid kiosk app manifest.
diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_update_service_browsertest.cc b/chrome/browser/chromeos/app_mode/kiosk_app_update_service_browsertest.cc
index 8675103..89234a0 100644
--- a/chrome/browser/chromeos/app_mode/kiosk_app_update_service_browsertest.cc
+++ b/chrome/browser/chromeos/app_mode/kiosk_app_update_service_browsertest.cc
@@ -52,7 +52,7 @@ class KioskAppUpdateServiceTest : public extensions::PlatformAppBrowserTest {
base::DoubleToString(uptime.InSecondsF());
const base::FilePath uptime_file = temp_dir.Append("uptime");
ASSERT_EQ(static_cast<int>(uptime_seconds.size()),
- file_util::WriteFile(
+ base::WriteFile(
uptime_file, uptime_seconds.c_str(), uptime_seconds.size()));
uptime_file_override_.reset(
new base::ScopedPathOverride(chromeos::FILE_UPTIME, uptime_file));
diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc
index 451c6a0..6d3c820 100644
--- a/chrome/browser/chromeos/boot_times_loader.cc
+++ b/chrome/browser/chromeos/boot_times_loader.cc
@@ -209,8 +209,7 @@ void BootTimesLoader::WriteTimes(
}
output += '\n';
- file_util::WriteFile(
- log_path.Append(base_name), output.data(), output.size());
+ base::WriteFile(log_path.Append(base_name), output.data(), output.size());
}
void BootTimesLoader::LoginDone() {
diff --git a/chrome/browser/chromeos/contacts/contact_database_unittest.cc b/chrome/browser/chromeos/contacts/contact_database_unittest.cc
index 5bd26c3..8942da0 100644
--- a/chrome/browser/chromeos/contacts/contact_database_unittest.cc
+++ b/chrome/browser/chromeos/contacts/contact_database_unittest.cc
@@ -319,7 +319,7 @@ TEST_F(ContactDatabaseTest, DeleteWhenCorrupt) {
database_path(), false, base::FileEnumerator::FILES);
for (base::FilePath path = enumerator.Next(); !path.empty();
path = enumerator.Next()) {
- file_util::WriteFile(path, " ", 1);
+ base::WriteFile(path, " ", 1);
}
CreateDatabase();
diff --git a/chrome/browser/chromeos/drive/file_system_util.cc b/chrome/browser/chromeos/drive/file_system_util.cc
index cdc6d39..283772e 100644
--- a/chrome/browser/chromeos/drive/file_system_util.cc
+++ b/chrome/browser/chromeos/drive/file_system_util.cc
@@ -365,7 +365,7 @@ bool CreateGDocFile(const base::FilePath& file_path,
std::string content = base::StringPrintf(
"{\"url\": \"%s\", \"resource_id\": \"%s\"}",
url.spec().c_str(), resource_id.c_str());
- return file_util::WriteFile(file_path, content.data(), content.size()) ==
+ return base::WriteFile(file_path, content.data(), content.size()) ==
static_cast<int>(content.size());
}
diff --git a/chrome/browser/chromeos/drive/file_write_watcher_unittest.cc b/chrome/browser/chromeos/drive/file_write_watcher_unittest.cc
index 3bb06b1..00378bb 100644
--- a/chrome/browser/chromeos/drive/file_write_watcher_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_write_watcher_unittest.cc
@@ -47,7 +47,7 @@ void WriteSomethingAfterStartWatch(const base::FilePath& path,
EXPECT_TRUE(watch_success) << path.value();
const char kDummy[] = "hello";
- ASSERT_TRUE(file_util::WriteFile(path, kDummy, arraysize(kDummy)));
+ ASSERT_TRUE(base::WriteFile(path, kDummy, arraysize(kDummy)));
}
class FileWriteWatcherTest : public testing::Test {
diff --git a/chrome/browser/chromeos/extensions/default_app_order_unittest.cc b/chrome/browser/chromeos/extensions/default_app_order_unittest.cc
index e89af59..39b7aab 100644
--- a/chrome/browser/chromeos/extensions/default_app_order_unittest.cc
+++ b/chrome/browser/chromeos/extensions/default_app_order_unittest.cc
@@ -56,7 +56,7 @@ class DefaultAppOrderTest : public testing::Test {
void CreateExternalOrderFile(const std::string& content) {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
base::FilePath external_file = temp_dir_.path().Append(kTestFile);
- file_util::WriteFile(external_file, content.c_str(), content.size());
+ base::WriteFile(external_file, content.c_str(), content.size());
SetExternalFile(external_file);
}
diff --git a/chrome/browser/chromeos/extensions/external_cache_unittest.cc b/chrome/browser/chromeos/extensions/external_cache_unittest.cc
index 8f566a9..066240d 100644
--- a/chrome/browser/chromeos/extensions/external_cache_unittest.cc
+++ b/chrome/browser/chromeos/extensions/external_cache_unittest.cc
@@ -110,7 +110,7 @@ class ExternalCacheTest : public testing::Test,
}
void CreateFile(const base::FilePath& file) {
- EXPECT_EQ(file_util::WriteFile(file, NULL, 0), 0);
+ EXPECT_EQ(base::WriteFile(file, NULL, 0), 0);
}
base::FilePath GetExtensionFile(const base::FilePath& dir,
diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
index 23105fc..2b98284 100644
--- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
+++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
@@ -72,8 +72,7 @@ bool SaveData(int key, const std::string& file_name, const std::string& data) {
base::FilePath file_path = data_dir.Append(file_name);
return base::PathExists(file_path) ||
- (file_util::WriteFile(file_path, data.c_str(),
- data.size()) != -1);
+ (base::WriteFile(file_path, data.c_str(), data.size()) != -1);
}
// Gets |file_name| from directory with |key|. Return false if the directory can
diff --git a/chrome/browser/chromeos/external_metrics.cc b/chrome/browser/chromeos/external_metrics.cc
index e11d8e0..47a363e 100644
--- a/chrome/browser/chromeos/external_metrics.cc
+++ b/chrome/browser/chromeos/external_metrics.cc
@@ -90,7 +90,7 @@ void SetupProgressiveScanFieldTrial() {
// Write the group to the file to be read by ChromeOS.
int size = static_cast<int>(group_char.length());
- if (file_util::WriteFile(group_file_path, group_char.c_str(), size) == size) {
+ if (base::WriteFile(group_file_path, group_char.c_str(), size) == size) {
VLOG(1) << "Configured in group '" << trial->group_name()
<< "' ('" << group_char << "') for "
<< name_of_experiment << " field trial";
diff --git a/chrome/browser/chromeos/file_manager/zip_file_creator_browsertest.cc b/chrome/browser/chromeos/file_manager/zip_file_creator_browsertest.cc
index 618d5d5..e8788f5 100644
--- a/chrome/browser/chromeos/file_manager/zip_file_creator_browsertest.cc
+++ b/chrome/browser/chromeos/file_manager/zip_file_creator_browsertest.cc
@@ -81,9 +81,9 @@ IN_PROC_BROWSER_TEST_F(ZipFileCreatorTest, SomeFilesZip) {
const int kRandomDataSize = 100000;
const std::string kRandomData = base::RandBytesAsString(kRandomDataSize);
base::CreateDirectory(zip_base_dir().Append(kDir1));
- file_util::WriteFile(zip_base_dir().Append(kFile1), "123", 3);
- file_util::WriteFile(zip_base_dir().Append(kFile2),
- kRandomData.c_str(), kRandomData.size());
+ base::WriteFile(zip_base_dir().Append(kFile1), "123", 3);
+ base::WriteFile(zip_base_dir().Append(kFile2),
+ kRandomData.c_str(), kRandomData.size());
base::RunLoop run_loop;
TestObserver observer(content::GetQuitTaskForRunLoop(&run_loop));
diff --git a/chrome/browser/chromeos/login/managed/locally_managed_user_creation_controller.cc b/chrome/browser/chromeos/login/managed/locally_managed_user_creation_controller.cc
index c88738b..62a2de1 100644
--- a/chrome/browser/chromeos/login/managed/locally_managed_user_creation_controller.cc
+++ b/chrome/browser/chromeos/login/managed/locally_managed_user_creation_controller.cc
@@ -43,7 +43,7 @@ bool StoreManagedUserFiles(const std::string& token,
base::CreateDirectory(base_path);
}
base::FilePath token_file = base_path.Append(kManagedUserTokenFilename);
- int bytes = file_util::WriteFile(token_file, token.c_str(), token.length());
+ int bytes = base::WriteFile(token_file, token.c_str(), token.length());
return bytes >= 0;
}
diff --git a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc
index 0ad3bdd..dad81fc 100644
--- a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc
+++ b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc
@@ -97,7 +97,7 @@ class ParallelAuthenticatorTest : public testing::Test {
base::FilePath out;
FILE* tmp_file = base::CreateAndOpenTemporaryFile(&out);
EXPECT_NE(tmp_file, static_cast<FILE*>(NULL));
- EXPECT_EQ(file_util::WriteFile(out, data, data_len), data_len);
+ EXPECT_EQ(base::WriteFile(out, data, data_len), data_len);
EXPECT_TRUE(base::CloseFile(tmp_file));
return out;
}
diff --git a/chrome/browser/chromeos/login/resource_loader_browsertest.cc b/chrome/browser/chromeos/login/resource_loader_browsertest.cc
index 2b91a32..668a373 100644
--- a/chrome/browser/chromeos/login/resource_loader_browsertest.cc
+++ b/chrome/browser/chromeos/login/resource_loader_browsertest.cc
@@ -23,7 +23,7 @@ namespace {
GURL CreateResource(const std::string& content) {
base::FilePath path;
EXPECT_TRUE(base::CreateTemporaryFile(&path));
- EXPECT_TRUE(file_util::WriteFile(path, content.c_str(), content.size()));
+ EXPECT_TRUE(base::WriteFile(path, content.c_str(), content.size()));
return GURL("file:///" + path.AsUTF8Unsafe());
}
diff --git a/chrome/browser/chromeos/login/user_image_manager_browsertest.cc b/chrome/browser/chromeos/login/user_image_manager_browsertest.cc
index df96eb6..03d3064 100644
--- a/chrome/browser/chromeos/login/user_image_manager_browsertest.cc
+++ b/chrome/browser/chromeos/login/user_image_manager_browsertest.cc
@@ -199,7 +199,7 @@ class UserImageManagerTest : public LoginManagerTest,
scoped_refptr<base::RefCountedStaticMemory> image_data(
ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
resource_id, ui::SCALE_FACTOR_100P));
- int written = file_util::WriteFile(
+ int written = base::WriteFile(
image_path,
reinterpret_cast<const char*>(image_data->front()),
image_data->size());
@@ -599,7 +599,7 @@ class UserImageManagerPolicyTest : public UserImageManagerTest,
std::vector<uint8> user_key_bits;
ASSERT_TRUE(user_policy_.GetSigningKey()->ExportPublicKey(&user_key_bits));
ASSERT_TRUE(base::CreateDirectory(user_key_file.DirName()));
- ASSERT_EQ(file_util::WriteFile(
+ ASSERT_EQ(base::WriteFile(
user_key_file,
reinterpret_cast<const char*>(user_key_bits.data()),
user_key_bits.size()),
diff --git a/chrome/browser/chromeos/login/user_image_manager_impl.cc b/chrome/browser/chromeos/login/user_image_manager_impl.cc
index 08d0cc5..d73c123 100644
--- a/chrome/browser/chromeos/login/user_image_manager_impl.cc
+++ b/chrome/browser/chromeos/login/user_image_manager_impl.cc
@@ -171,9 +171,9 @@ bool SaveImage(const UserImage& user_image, const base::FilePath& image_path) {
}
if (!encoded_image->size() ||
- file_util::WriteFile(image_path,
- reinterpret_cast<const char*>(&(*encoded_image)[0]),
- encoded_image->size()) == -1) {
+ base::WriteFile(image_path,
+ reinterpret_cast<const char*>(&(*encoded_image)[0]),
+ encoded_image->size()) == -1) {
LOG(ERROR) << "Failed to save image to file.";
return false;
}
diff --git a/chrome/browser/chromeos/login/wallpaper_manager.cc b/chrome/browser/chromeos/login/wallpaper_manager.cc
index 14cfbf3..f5219da 100644
--- a/chrome/browser/chromeos/login/wallpaper_manager.cc
+++ b/chrome/browser/chromeos/login/wallpaper_manager.cc
@@ -1321,7 +1321,7 @@ void WallpaperManager::RecordUma(User::WallpaperType type, int index) {
void WallpaperManager::SaveWallpaperInternal(const base::FilePath& path,
const char* data,
int size) {
- int written_bytes = file_util::WriteFile(path, data, size);
+ int written_bytes = base::WriteFile(path, data, size);
DCHECK(written_bytes == size);
}
diff --git a/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc b/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc
index ae17295..22e6a63 100644
--- a/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc
+++ b/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc
@@ -130,7 +130,7 @@ class WallpaperManagerBrowserTest : public InProcessBrowserTest,
scoped_refptr<base::RefCountedStaticMemory> image_data(
ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
resource_id, ui::SCALE_FACTOR_100P));
- int written = file_util::WriteFile(
+ int written = base::WriteFile(
wallpaper_path,
reinterpret_cast<const char*>(image_data->front()),
image_data->size());
diff --git a/chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc b/chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc
index 0318205..4797ee4 100644
--- a/chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc
+++ b/chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc
@@ -50,9 +50,9 @@ void DevicePolicyCrosTestHelper::MarkAsEnterpriseOwned() {
const std::string install_attrs_blob(
install_attrs_proto.SerializeAsString());
ASSERT_EQ(static_cast<int>(install_attrs_blob.size()),
- file_util::WriteFile(install_attrs_file,
- install_attrs_blob.c_str(),
- install_attrs_blob.size()));
+ base::WriteFile(install_attrs_file,
+ install_attrs_blob.c_str(),
+ install_attrs_blob.size()));
ASSERT_TRUE(PathService::Override(chromeos::FILE_INSTALL_ATTRIBUTES,
install_attrs_file));
}
@@ -62,8 +62,7 @@ void DevicePolicyCrosTestHelper::InstallOwnerKey() {
std::vector<uint8> owner_key_bits;
ASSERT_TRUE(
device_policy()->GetSigningKey()->ExportPublicKey(&owner_key_bits));
- ASSERT_EQ(
- file_util::WriteFile(
+ ASSERT_EQ(base::WriteFile(
owner_key_file,
reinterpret_cast<const char*>(vector_as_array(&owner_key_bits)),
owner_key_bits.size()),
diff --git a/chrome/browser/chromeos/policy/enterprise_install_attributes_unittest.cc b/chrome/browser/chromeos/policy/enterprise_install_attributes_unittest.cc
index 87f093f..338735a 100644
--- a/chrome/browser/chromeos/policy/enterprise_install_attributes_unittest.cc
+++ b/chrome/browser/chromeos/policy/enterprise_install_attributes_unittest.cc
@@ -234,7 +234,7 @@ TEST_F(EnterpriseInstallAttributesTest, ReadCacheFile) {
EnterpriseInstallAttributes::kAttrEnterpriseUser, kTestUser);
const std::string blob(install_attrs_proto.SerializeAsString());
ASSERT_EQ(static_cast<int>(blob.size()),
- file_util::WriteFile(GetTempPath(), blob.c_str(), blob.size()));
+ base::WriteFile(GetTempPath(), blob.c_str(), blob.size()));
install_attributes_.ReadCacheFile(GetTempPath());
EXPECT_EQ(DEVICE_MODE_ENTERPRISE, install_attributes_.GetMode());
EXPECT_EQ(kTestDomain, install_attributes_.GetDomain());
@@ -248,7 +248,7 @@ TEST_F(EnterpriseInstallAttributesTest, ReadCacheFileForConsumerKiosk) {
EnterpriseInstallAttributes::kAttrConsumerKioskEnabled, "true");
const std::string blob(install_attrs_proto.SerializeAsString());
ASSERT_EQ(static_cast<int>(blob.size()),
- file_util::WriteFile(GetTempPath(), blob.c_str(), blob.size()));
+ base::WriteFile(GetTempPath(), blob.c_str(), blob.size()));
install_attributes_.ReadCacheFile(GetTempPath());
EXPECT_EQ(DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH,
install_attributes_.GetMode());
diff --git a/chrome/browser/chromeos/policy/power_policy_browsertest.cc b/chrome/browser/chromeos/policy/power_policy_browsertest.cc
index 75719935..51aa2d4 100644
--- a/chrome/browser/chromeos/policy/power_policy_browsertest.cc
+++ b/chrome/browser/chromeos/policy/power_policy_browsertest.cc
@@ -210,7 +210,7 @@ void PowerPolicyBrowserTestBase::InstallUserKey() {
std::vector<uint8> user_key_bits;
ASSERT_TRUE(user_policy_.GetSigningKey()->ExportPublicKey(&user_key_bits));
ASSERT_TRUE(base::CreateDirectory(user_key_file.DirName()));
- ASSERT_EQ(file_util::WriteFile(
+ ASSERT_EQ(base::WriteFile(
user_key_file,
reinterpret_cast<const char*>(user_key_bits.data()),
user_key_bits.size()),
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc
index 2d1f764..6ab114b 100644
--- a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc
+++ b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc
@@ -127,9 +127,9 @@ class UserCloudPolicyStoreChromeOSTest : public testing::Test {
void StoreUserPolicyKey(const std::vector<uint8>& public_key) {
ASSERT_TRUE(base::CreateDirectory(user_policy_key_file().DirName()));
ASSERT_TRUE(
- file_util::WriteFile(user_policy_key_file(),
- reinterpret_cast<const char*>(public_key.data()),
- public_key.size()));
+ base::WriteFile(user_policy_key_file(),
+ reinterpret_cast<const char*>(public_key.data()),
+ public_key.size()));
}
// Stores the current |policy_| and verifies that it is published.
@@ -400,12 +400,12 @@ TEST_F(UserCloudPolicyStoreChromeOSTest, MigrationFull) {
credentials.set_device_token(kLegacyToken);
credentials.set_device_id(kLegacyDeviceId);
ASSERT_TRUE(credentials.SerializeToString(&data));
- ASSERT_NE(-1, file_util::WriteFile(token_file(), data.c_str(), data.size()));
+ ASSERT_NE(-1, base::WriteFile(token_file(), data.c_str(), data.size()));
em::CachedCloudPolicyResponse cached_policy;
cached_policy.mutable_cloud_policy()->CopyFrom(policy_.policy());
ASSERT_TRUE(cached_policy.SerializeToString(&data));
- ASSERT_NE(-1, file_util::WriteFile(policy_file(), data.c_str(), data.size()));
+ ASSERT_NE(-1, base::WriteFile(policy_file(), data.c_str(), data.size()));
EXPECT_CALL(observer_, OnStoreLoaded(store_.get()));
ASSERT_NO_FATAL_FAILURE(PerformPolicyLoad(""));
@@ -432,7 +432,7 @@ TEST_F(UserCloudPolicyStoreChromeOSTest, MigrationNoToken) {
em::CachedCloudPolicyResponse cached_policy;
cached_policy.mutable_cloud_policy()->CopyFrom(policy_.policy());
ASSERT_TRUE(cached_policy.SerializeToString(&data));
- ASSERT_NE(-1, file_util::WriteFile(policy_file(), data.c_str(), data.size()));
+ ASSERT_NE(-1, base::WriteFile(policy_file(), data.c_str(), data.size()));
EXPECT_CALL(observer_, OnStoreLoaded(store_.get()));
ASSERT_NO_FATAL_FAILURE(PerformPolicyLoad(""));
@@ -457,7 +457,7 @@ TEST_F(UserCloudPolicyStoreChromeOSTest, MigrationNoPolicy) {
credentials.set_device_token(kLegacyToken);
credentials.set_device_id(kLegacyDeviceId);
ASSERT_TRUE(credentials.SerializeToString(&data));
- ASSERT_NE(-1, file_util::WriteFile(token_file(), data.c_str(), data.size()));
+ ASSERT_NE(-1, base::WriteFile(token_file(), data.c_str(), data.size()));
EXPECT_CALL(observer_, OnStoreLoaded(store_.get()));
ASSERT_NO_FATAL_FAILURE(PerformPolicyLoad(""));
@@ -482,7 +482,7 @@ TEST_F(UserCloudPolicyStoreChromeOSTest, MigrationAndStoreNew) {
em::CachedCloudPolicyResponse cached_policy;
cached_policy.mutable_cloud_policy()->CopyFrom(policy_.policy());
ASSERT_TRUE(cached_policy.SerializeToString(&data));
- ASSERT_NE(-1, file_util::WriteFile(policy_file(), data.c_str(), data.size()));
+ ASSERT_NE(-1, base::WriteFile(policy_file(), data.c_str(), data.size()));
EXPECT_CALL(observer_, OnStoreLoaded(store_.get()));
ASSERT_NO_FATAL_FAILURE(PerformPolicyLoad(""));
diff --git a/chrome/browser/chromeos/policy/user_policy_disk_cache.cc b/chrome/browser/chromeos/policy/user_policy_disk_cache.cc
index cab8020..7a3c6ca 100644
--- a/chrome/browser/chromeos/policy/user_policy_disk_cache.cc
+++ b/chrome/browser/chromeos/policy/user_policy_disk_cache.cc
@@ -131,7 +131,7 @@ void UserPolicyDiskCache::StoreOnFileThread(
}
int size = data.size();
- if (file_util::WriteFile(backing_file_path_, data.c_str(), size) != size) {
+ if (base::WriteFile(backing_file_path_, data.c_str(), size) != size) {
LOG(WARNING) << "Failed to write " << backing_file_path_.value();
UMA_HISTOGRAM_ENUMERATION(policy::kMetricPolicy,
kMetricPolicyStoreFailed,
diff --git a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
index 7ba63e5..1da5a9b 100644
--- a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
+++ b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
@@ -246,7 +246,7 @@ TEST_F(DeviceSettingsProviderTest, StatsReportingMigration) {
base::FilePath consent_file;
ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &consent_file));
consent_file = consent_file.AppendASCII("Consent To Send Stats");
- ASSERT_EQ(1, file_util::WriteFile(consent_file, "0", 1));
+ ASSERT_EQ(1, base::WriteFile(consent_file, "0", 1));
// This should trigger migration because the metrics policy isn't in the blob.
device_settings_test_helper_.set_policy_blob(std::string());
diff --git a/chrome/browser/chromeos/settings/owner_key_util_unittest.cc b/chrome/browser/chromeos/settings/owner_key_util_unittest.cc
index b009c33..c5ec00c 100644
--- a/chrome/browser/chromeos/settings/owner_key_util_unittest.cc
+++ b/chrome/browser/chromeos/settings/owner_key_util_unittest.cc
@@ -71,7 +71,7 @@ TEST_F(OwnerKeyUtilTest, ImportPublicKey) {
std::vector<uint8> public_key(kTestKeyData,
kTestKeyData + sizeof(kTestKeyData));
ASSERT_EQ(static_cast<int>(public_key.size()),
- file_util::WriteFile(
+ base::WriteFile(
key_file_,
reinterpret_cast<const char*>(vector_as_array(&public_key)),
public_key.size()));
@@ -91,7 +91,7 @@ TEST_F(OwnerKeyUtilTest, ImportPublicKeyFailed) {
// Next try empty file. This should fail and the array should be empty.
from_disk.resize(10);
- ASSERT_EQ(0, file_util::WriteFile(key_file_, "", 0));
+ ASSERT_EQ(0, base::WriteFile(key_file_, "", 0));
EXPECT_TRUE(util_->IsPublicKeyPresent());
EXPECT_FALSE(util_->ImportPublicKey(&from_disk));
EXPECT_FALSE(from_disk.size());
diff --git a/chrome/browser/chromeos/system/automatic_reboot_manager.cc b/chrome/browser/chromeos/system/automatic_reboot_manager.cc
index 5ac91e7..1e00316 100644
--- a/chrome/browser/chromeos/system/automatic_reboot_manager.cc
+++ b/chrome/browser/chromeos/system/automatic_reboot_manager.cc
@@ -117,9 +117,8 @@ void SaveUpdateRebootNeededUptime() {
std::string update_reboot_needed_uptime =
base::DoubleToString(uptime.InSecondsF());
- file_util::WriteFileDescriptor(fd,
- update_reboot_needed_uptime.c_str(),
- update_reboot_needed_uptime.size());
+ base::WriteFileDescriptor(fd, update_reboot_needed_uptime.c_str(),
+ update_reboot_needed_uptime.size());
}
} // namespace
diff --git a/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc b/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc
index b6e8ecc..f3204b6 100644
--- a/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc
+++ b/chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc
@@ -212,9 +212,8 @@ void SaveUptimeToFile(const base::FilePath& path,
const std::string uptime_seconds = base::DoubleToString(uptime.InSecondsF());
ASSERT_EQ(static_cast<int>(uptime_seconds.size()),
- file_util::WriteFile(path,
- uptime_seconds.c_str(),
- uptime_seconds.size()));
+ base::WriteFile(path, uptime_seconds.c_str(),
+ uptime_seconds.size()));
}
MockTimeSingleThreadTaskRunner::MockTimeSingleThreadTaskRunner() {
@@ -347,11 +346,10 @@ void AutomaticRebootManagerBasicTest::SetUp() {
const base::FilePath& temp_dir = temp_dir_.path();
const base::FilePath uptime_file = temp_dir.Append("uptime");
task_runner_->SetUptimeFile(uptime_file);
- ASSERT_FALSE(file_util::WriteFile(uptime_file, NULL, 0));
+ ASSERT_FALSE(base::WriteFile(uptime_file, NULL, 0));
update_reboot_needed_uptime_file_ =
temp_dir.Append("update_reboot_needed_uptime");
- ASSERT_FALSE(file_util::WriteFile(
- update_reboot_needed_uptime_file_, NULL, 0));
+ ASSERT_FALSE(base::WriteFile(update_reboot_needed_uptime_file_, NULL, 0));
ASSERT_TRUE(PathService::Override(chromeos::FILE_UPTIME, uptime_file));
ASSERT_TRUE(PathService::Override(chromeos::FILE_UPDATE_REBOOT_NEEDED_UPTIME,
update_reboot_needed_uptime_file_));
diff --git a/chrome/browser/component_updater/component_unpacker.cc b/chrome/browser/component_updater/component_unpacker.cc
index a8903db..4134b3e 100644
--- a/chrome/browser/component_updater/component_unpacker.cc
+++ b/chrome/browser/component_updater/component_unpacker.cc
@@ -240,7 +240,7 @@ void ComponentUnpacker::EndPatching(Error error, int extended_error) {
void ComponentUnpacker::Install() {
// Write the fingerprint to disk.
if (static_cast<int>(fingerprint_.size()) !=
- file_util::WriteFile(
+ base::WriteFile(
unpack_path_.Append(FILE_PATH_LITERAL("manifest.fingerprint")),
fingerprint_.c_str(),
fingerprint_.size())) {
diff --git a/chrome/browser/component_updater/widevine_cdm_component_installer.cc b/chrome/browser/component_updater/widevine_cdm_component_installer.cc
index bbfdd0f..d6195e2 100644
--- a/chrome/browser/component_updater/widevine_cdm_component_installer.cc
+++ b/chrome/browser/component_updater/widevine_cdm_component_installer.cc
@@ -343,7 +343,7 @@ void WidevineCdmComponentInstallerTraits::UpdateCdmAdapter(
if (!base::ReadFileToString(adapter_version_path, &adapter_version) ||
adapter_version != chrome_version ||
!base::PathExists(adapter_install_path)) {
- int bytes_written = file_util::WriteFile(
+ int bytes_written = base::WriteFile(
adapter_version_path, chrome_version.data(), chrome_version.size());
if (bytes_written < 0 ||
static_cast<size_t>(bytes_written) != chrome_version.size()) {
diff --git a/chrome/browser/devtools/devtools_file_helper.cc b/chrome/browser/devtools/devtools_file_helper.cc
index 9ec7f90..f3a10b5 100644
--- a/chrome/browser/devtools/devtools_file_helper.cc
+++ b/chrome/browser/devtools/devtools_file_helper.cc
@@ -122,7 +122,7 @@ void WriteToFile(const base::FilePath& path, const std::string& content) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
DCHECK(!path.empty());
- file_util::WriteFile(path, content.c_str(), content.length());
+ base::WriteFile(path, content.c_str(), content.length());
}
void AppendToFile(const base::FilePath& path, const std::string& content) {
diff --git a/chrome/browser/diagnostics/diagnostics_controller_unittest.cc b/chrome/browser/diagnostics/diagnostics_controller_unittest.cc
index 0a408bb..369dde6 100644
--- a/chrome/browser/diagnostics/diagnostics_controller_unittest.cc
+++ b/chrome/browser/diagnostics/diagnostics_controller_unittest.cc
@@ -75,7 +75,7 @@ class DiagnosticsControllerTest : public testing::Test {
// Just write some random characters into the file tInvaludUsero "corrupt"
// it.
const char bogus_data[] = "wwZ2uNYNuyUVzFbDm3DL";
- file_util::WriteFile(path, bogus_data, arraysize(bogus_data));
+ base::WriteFile(path, bogus_data, arraysize(bogus_data));
}
scoped_ptr<DiagnosticsModel> model_;
diff --git a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc
index 01422f1..b650fa0 100644
--- a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc
@@ -386,7 +386,7 @@ TEST_F(ChromeDownloadManagerDelegateTest, CheckForFileExistence) {
base::FilePath existing_path = default_download_path().AppendASCII("foo");
base::FilePath non_existent_path =
default_download_path().AppendASCII("bar");
- file_util::WriteFile(existing_path, kData, kDataLength);
+ base::WriteFile(existing_path, kData, kDataLength);
scoped_ptr<content::MockDownloadItem> download_item(
CreateActiveDownloadItem(1));
diff --git a/chrome/browser/download/download_path_reservation_tracker_unittest.cc b/chrome/browser/download/download_path_reservation_tracker_unittest.cc
index 5703da3..1a2728d 100644
--- a/chrome/browser/download/download_path_reservation_tracker_unittest.cc
+++ b/chrome/browser/download/download_path_reservation_tracker_unittest.cc
@@ -281,9 +281,9 @@ TEST_F(DownloadPathReservationTrackerTest, ConflictingFiles) {
base::FilePath path1(
GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo (1).txt")));
// Create a file at |path|, and a .crdownload file at |path1|.
- ASSERT_EQ(0, file_util::WriteFile(path, "", 0));
+ ASSERT_EQ(0, base::WriteFile(path, "", 0));
ASSERT_EQ(0,
- file_util::WriteFile(
+ base::WriteFile(
DownloadTargetDeterminer::GetCrDownloadPath(path1), "", 0));
ASSERT_TRUE(IsPathInUse(path));
@@ -647,8 +647,8 @@ TEST_F(DownloadPathReservationTrackerTest, TruncationConflict) {
// "aaa...aaaaaaa.txt" (truncated path) and
// "aaa...aaa (1).txt" (truncated and first uniquification try) exists.
// "aaa...aaa (2).txt" should be used.
- ASSERT_EQ(0, file_util::WriteFile(path0, "", 0));
- ASSERT_EQ(0, file_util::WriteFile(path1, "", 0));
+ ASSERT_EQ(0, base::WriteFile(path0, "", 0));
+ ASSERT_EQ(0, base::WriteFile(path1, "", 0));
base::FilePath reserved_path;
bool verified = false;
diff --git a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
index 55f4150..8898363 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
@@ -709,7 +709,7 @@ class HTML5FileWriter {
// Create a temp file.
base::FilePath temp_file;
if (!base::CreateTemporaryFile(&temp_file) ||
- file_util::WriteFile(temp_file, data, length) != length) {
+ base::WriteFile(temp_file, data, length) != length) {
return false;
}
// Invoke the fileapi to copy it into the sandboxed filesystem.
@@ -1039,7 +1039,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
base::FilePath real_path = all_downloads[0]->GetTargetFilePath();
base::FilePath fake_path = all_downloads[1]->GetTargetFilePath();
- EXPECT_EQ(0, file_util::WriteFile(real_path, "", 0));
+ EXPECT_EQ(0, base::WriteFile(real_path, "", 0));
ASSERT_TRUE(base::PathExists(real_path));
ASSERT_FALSE(base::PathExists(fake_path));
diff --git a/chrome/browser/extensions/api/image_writer_private/destroy_partitions_operation.cc b/chrome/browser/extensions/api/image_writer_private/destroy_partitions_operation.cc
index 9c1871b..1ad6d98 100644
--- a/chrome/browser/extensions/api/image_writer_private/destroy_partitions_operation.cc
+++ b/chrome/browser/extensions/api/image_writer_private/destroy_partitions_operation.cc
@@ -32,7 +32,7 @@ void DestroyPartitionsOperation::StartImpl() {
scoped_ptr<char[]> buffer(new char[kPartitionTableSize]);
memset(buffer.get(), 0, kPartitionTableSize);
- if (file_util::WriteFile(image_path_, buffer.get(), kPartitionTableSize) !=
+ if (base::WriteFile(image_path_, buffer.get(), kPartitionTableSize) !=
kPartitionTableSize) {
Error(error::kTempFileError);
return;
diff --git a/chrome/browser/extensions/api/image_writer_private/test_utils.cc b/chrome/browser/extensions/api/image_writer_private/test_utils.cc
index eac159c..74cd9d2 100644
--- a/chrome/browser/extensions/api/image_writer_private/test_utils.cc
+++ b/chrome/browser/extensions/api/image_writer_private/test_utils.cc
@@ -167,7 +167,7 @@ bool ImageWriterUnitTestBase::FillFile(const base::FilePath& file,
scoped_ptr<char[]> buffer(new char[length]);
memset(buffer.get(), pattern, length);
- return file_util::WriteFile(file, buffer.get(), length) == length;
+ return base::WriteFile(file, buffer.get(), length) == length;
}
} // namespace image_writer
diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc b/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc
index 9cbd5f4..a65d24f 100644
--- a/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc
+++ b/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc
@@ -359,9 +359,8 @@ class MediaGalleriesPlatformAppBrowserTest : public PlatformAppBrowserTest {
&xml_contents, 0, std::string("$path2"), in_both_jpg.value());
base::FilePath album_xml = iphoto_data_root.AppendASCII("AlbumData.xml");
- ASSERT_NE(-1, file_util::WriteFile(album_xml,
- xml_contents.c_str(),
- xml_contents.size()));
+ ASSERT_NE(-1, base::WriteFile(album_xml,
+ xml_contents.c_str(), xml_contents.size()));
}
#endif // defined(OS_MACOSX)
@@ -558,17 +557,17 @@ IN_PROC_BROWSER_TEST_F(MediaGalleriesPlatformAppBrowserTest, MAYBE_Scan) {
dummy_data.resize(1);
ASSERT_TRUE(base::CreateDirectory(scan_root.path().AppendASCII("a/b")));
ASSERT_EQ(static_cast<int>(dummy_data.size()),
- file_util::WriteFile(scan_root.path().AppendASCII("a/b/c.jpg"),
- dummy_data.c_str(), dummy_data.size()));
+ base::WriteFile(scan_root.path().AppendASCII("a/b/c.jpg"),
+ dummy_data.c_str(), dummy_data.size()));
ASSERT_TRUE(base::CreateDirectory(scan_root.path().AppendASCII("a/d")));
dummy_data.resize(201 * 1024); // 200k is the min size for the folder finder.
ASSERT_EQ(static_cast<int>(dummy_data.size()),
- file_util::WriteFile(scan_root.path().AppendASCII("a/d/e.txt"),
- dummy_data.c_str(), dummy_data.size()));
+ base::WriteFile(scan_root.path().AppendASCII("a/d/e.txt"),
+ dummy_data.c_str(), dummy_data.size()));
ASSERT_TRUE(base::CreateDirectory(scan_root.path().AppendASCII("f")));
ASSERT_EQ(static_cast<int>(dummy_data.size()),
- file_util::WriteFile(scan_root.path().AppendASCII("f/g.jpg"),
- dummy_data.c_str(), dummy_data.size()));
+ base::WriteFile(scan_root.path().AppendASCII("f/g.jpg"),
+ dummy_data.c_str(), dummy_data.size()));
ASSERT_TRUE(RunMediaGalleriesTest("scan")) << message_;
}
diff --git a/chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc b/chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc
index 5a16da4..9564818 100644
--- a/chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc
+++ b/chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc
@@ -106,8 +106,8 @@ class MediaGalleriesPrivateGalleryWatchApiTest : public ExtensionApiTest {
base::FilePath gallery_file =
gallery_dir.Append(FILE_PATH_LITERAL("test1.txt"));
std::string content("new content");
- int write_size = file_util::WriteFile(gallery_file, content.c_str(),
- content.length());
+ int write_size = base::WriteFile(gallery_file, content.c_str(),
+ content.length());
return (write_size == static_cast<int>(content.length()));
}
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc
index c182b29..a57fb74 100644
--- a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc
+++ b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc
@@ -147,7 +147,7 @@ class NativeMessagingTest : public ::testing::Test,
return base::FilePath();
std::string message_with_header = FormatMessage(message);
- int bytes_written = file_util::WriteFile(
+ int bytes_written = base::WriteFile(
filename, message_with_header.data(), message_with_header.size());
if (bytes_written < 0 ||
(message_with_header.size() != static_cast<size_t>(bytes_written))) {
diff --git a/chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc b/chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc
index 841ace2..015710e 100644
--- a/chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc
+++ b/chrome/browser/extensions/api/messaging/native_messaging_host_manifest_unittest.cc
@@ -46,7 +46,7 @@ class NativeMessagingHostManifestTest : public ::testing::Test {
}
bool WriteManifest(const std::string& manifest_content) {
- return file_util::WriteFile(
+ return base::WriteFile(
manifest_path_, manifest_content.data(), manifest_content.size());
}
diff --git a/chrome/browser/extensions/app_background_page_apitest.cc b/chrome/browser/extensions/app_background_page_apitest.cc
index db030f0..c423a8c 100644
--- a/chrome/browser/extensions/app_background_page_apitest.cc
+++ b/chrome/browser/extensions/app_background_page_apitest.cc
@@ -51,9 +51,9 @@ class AppBackgroundPageApiTest : public ExtensionApiTest {
return false;
}
base::FilePath manifest_path = app_dir_.path().AppendASCII("manifest.json");
- int bytes_written = file_util::WriteFile(manifest_path,
- app_manifest.data(),
- app_manifest.size());
+ int bytes_written = base::WriteFile(manifest_path,
+ app_manifest.data(),
+ app_manifest.size());
if (bytes_written != static_cast<int>(app_manifest.size())) {
LOG(ERROR) << "Unable to write complete manifest to file. Return code="
<< bytes_written;
diff --git a/chrome/browser/extensions/convert_web_app.cc b/chrome/browser/extensions/convert_web_app.cc
index cb4a490..90d0446 100644
--- a/chrome/browser/extensions/convert_web_app.cc
+++ b/chrome/browser/extensions/convert_web_app.cc
@@ -149,7 +149,7 @@ scoped_refptr<Extension> ConvertWebAppToExtension(
const char* image_data_ptr = reinterpret_cast<const char*>(&image_data[0]);
int size = base::checked_cast<int>(image_data.size());
- if (file_util::WriteFile(icon_file, image_data_ptr, size) != size) {
+ if (base::WriteFile(icon_file, image_data_ptr, size) != size) {
LOG(ERROR) << "Could not write icon file.";
return NULL;
}
diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc
index c31a399..e77e222 100644
--- a/chrome/browser/extensions/extension_creator.cc
+++ b/chrome/browser/extensions/extension_creator.cc
@@ -180,7 +180,7 @@ crypto::RSAPrivateKey* ExtensionCreator::GenerateKey(const base::FilePath&
}
if (!output_private_key_path.empty()) {
- if (-1 == file_util::WriteFile(output_private_key_path,
+ if (-1 == base::WriteFile(output_private_key_path,
pem_output.c_str(), pem_output.size())) {
error_message_ =
l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_FAILED_TO_OUTPUT);
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index d150ab0..ab5bfe9 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -2252,7 +2252,7 @@ TEST_F(ExtensionServiceTest, PackExtension) {
// Try packing with an invalid manifest.
std::string invalid_manifest_content = "I am not a manifest.";
- ASSERT_TRUE(file_util::WriteFile(
+ ASSERT_TRUE(base::WriteFile(
temp_dir2.path().Append(extensions::kManifestFilename),
invalid_manifest_content.c_str(), invalid_manifest_content.size()));
creator.reset(new ExtensionCreator());
@@ -4456,7 +4456,7 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) {
base::FilePath lso_file_path = lso_dir_path.AppendASCII(origin_id)
.AddExtension(FILE_PATH_LITERAL(".localstorage"));
EXPECT_TRUE(base::CreateDirectory(lso_dir_path));
- EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0));
+ EXPECT_EQ(0, base::WriteFile(lso_file_path, NULL, 0));
EXPECT_TRUE(base::PathExists(lso_file_path));
// Create indexed db. Similarly, it is enough to only simulate this by
@@ -4572,7 +4572,7 @@ TEST_F(ExtensionServiceTest, ClearAppData) {
base::FilePath lso_file_path = lso_dir_path.AppendASCII(origin_id)
.AddExtension(FILE_PATH_LITERAL(".localstorage"));
EXPECT_TRUE(base::CreateDirectory(lso_dir_path));
- EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0));
+ EXPECT_EQ(0, base::WriteFile(lso_file_path, NULL, 0));
EXPECT_TRUE(base::PathExists(lso_file_path));
// Create indexed db. Similarly, it is enough to only simulate this by
diff --git a/chrome/browser/extensions/sandboxed_unpacker.cc b/chrome/browser/extensions/sandboxed_unpacker.cc
index f7625e70..618cb36 100644
--- a/chrome/browser/extensions/sandboxed_unpacker.cc
+++ b/chrome/browser/extensions/sandboxed_unpacker.cc
@@ -132,7 +132,7 @@ bool VerifyJunctionFreeLocation(base::FilePath* temp_dir) {
// NormalizeFilePath requires a non-empty file, so write some data.
// If you change the exit points of this function please make sure all
// exit points delete this temp file!
- if (file_util::WriteFile(temp_file, ".", 1) != 1)
+ if (base::WriteFile(temp_file, ".", 1) != 1)
return false;
base::FilePath normalized_temp_file;
@@ -629,7 +629,7 @@ base::DictionaryValue* SandboxedUnpacker::RewriteManifestFile(
base::FilePath manifest_path =
extension_root_.Append(kManifestFilename);
int size = base::checked_cast<int>(manifest_json.size());
- if (file_util::WriteFile(manifest_path, manifest_json.data(), size) != size) {
+ if (base::WriteFile(manifest_path, manifest_json.data(), size) != size) {
// Error saving manifest.json.
ReportFailure(
ERROR_SAVING_MANIFEST_JSON,
@@ -742,7 +742,7 @@ bool SandboxedUnpacker::RewriteImageFiles(SkBitmap* install_icon) {
// so we can be sure the directory exists.
const char* image_data_ptr = reinterpret_cast<const char*>(&image_data[0]);
int size = base::checked_cast<int>(image_data.size());
- if (file_util::WriteFile(path, image_data_ptr, size) != size) {
+ if (base::WriteFile(path, image_data_ptr, size) != size) {
// Error saving theme image.
ReportFailure(
ERROR_SAVING_THEME_IMAGE,
@@ -811,7 +811,7 @@ bool SandboxedUnpacker::RewriteCatalogFiles() {
// Note: we're overwriting existing files that the utility process read,
// so we can be sure the directory exists.
int size = base::checked_cast<int>(catalog_json.size());
- if (file_util::WriteFile(path, catalog_json.c_str(), size) != size) {
+ if (base::WriteFile(path, catalog_json.c_str(), size) != size) {
// Error saving catalog.
ReportFailure(
ERROR_SAVING_CATALOG,
diff --git a/chrome/browser/extensions/test_extension_dir.cc b/chrome/browser/extensions/test_extension_dir.cc
index a99e5be..8da0667 100644
--- a/chrome/browser/extensions/test_extension_dir.cc
+++ b/chrome/browser/extensions/test_extension_dir.cc
@@ -32,7 +32,7 @@ void TestExtensionDir::WriteFile(const base::FilePath::StringType& filename,
base::StringPiece contents) {
EXPECT_EQ(
base::checked_cast<int>(contents.size()),
- file_util::WriteFile(
+ base::WriteFile(
dir_.path().Append(filename), contents.data(), contents.size()));
}
diff --git a/chrome/browser/extensions/updater/local_extension_cache_unittest.cc b/chrome/browser/extensions/updater/local_extension_cache_unittest.cc
index e4f4636..f232d5e 100644
--- a/chrome/browser/extensions/updater/local_extension_cache_unittest.cc
+++ b/chrome/browser/extensions/updater/local_extension_cache_unittest.cc
@@ -79,7 +79,7 @@ class LocalExtensionCacheTest : public testing::Test {
size_t size,
const base::Time& timestamp) {
std::string data(size, 0);
- EXPECT_EQ(file_util::WriteFile(file, data.data(), data.size()), int(size));
+ EXPECT_EQ(base::WriteFile(file, data.data(), data.size()), int(size));
EXPECT_TRUE(base::TouchFile(file, timestamp, timestamp));
}
diff --git a/chrome/browser/extensions/user_script_master_unittest.cc b/chrome/browser/extensions/user_script_master_unittest.cc
index 585edd74..8347cbe 100644
--- a/chrome/browser/extensions/user_script_master_unittest.cc
+++ b/chrome/browser/extensions/user_script_master_unittest.cc
@@ -232,7 +232,7 @@ TEST_F(UserScriptMasterTest, Parse8) {
TEST_F(UserScriptMasterTest, SkipBOMAtTheBeginning) {
base::FilePath path = temp_dir_.path().AppendASCII("script.user.js");
const std::string content("\xEF\xBB\xBF alert('hello');");
- size_t written = file_util::WriteFile(path, content.c_str(), content.size());
+ size_t written = base::WriteFile(path, content.c_str(), content.size());
ASSERT_EQ(written, content.size());
UserScript user_script;
@@ -255,7 +255,7 @@ TEST_F(UserScriptMasterTest, SkipBOMAtTheBeginning) {
TEST_F(UserScriptMasterTest, LeaveBOMNotAtTheBeginning) {
base::FilePath path = temp_dir_.path().AppendASCII("script.user.js");
const std::string content("alert('here's a BOOM: \xEF\xBB\xBF');");
- size_t written = file_util::WriteFile(path, content.c_str(), content.size());
+ size_t written = base::WriteFile(path, content.c_str(), content.size());
ASSERT_EQ(written, content.size());
UserScript user_script;
diff --git a/chrome/browser/feedback/feedback_util.cc b/chrome/browser/feedback/feedback_util.cc
index 2a795a5..bc3a9a2 100644
--- a/chrome/browser/feedback/feedback_util.cc
+++ b/chrome/browser/feedback/feedback_util.cc
@@ -254,8 +254,8 @@ bool ZipString(const base::FilePath& filename,
// another temporary file to receive the zip file in.
if (!base::CreateNewTempDirectory(base::FilePath::StringType(), &temp_path))
return false;
- if (file_util::WriteFile(temp_path.Append(filename),
- data.c_str(), data.size()) == -1)
+ if (base::WriteFile(temp_path.Append(filename), data.c_str(), data.size()) ==
+ -1)
return false;
bool succeed = base::CreateTemporaryFile(&zip_file) &&
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc
index a5e826d..d89e76b 100644
--- a/chrome/browser/first_run/first_run.cc
+++ b/chrome/browser/first_run/first_run.cc
@@ -568,7 +568,7 @@ bool CreateSentinel() {
base::FilePath first_run_sentinel;
if (!internal::GetFirstRunSentinelFilePath(&first_run_sentinel))
return false;
- return file_util::WriteFile(first_run_sentinel, "", 0) != -1;
+ return base::WriteFile(first_run_sentinel, "", 0) != -1;
}
// -- Platform-specific functions --
diff --git a/chrome/browser/first_run/first_run_browsertest.cc b/chrome/browser/first_run/first_run_browsertest.cc
index c295df9..d1f65e7 100644
--- a/chrome/browser/first_run/first_run_browsertest.cc
+++ b/chrome/browser/first_run/first_run_browsertest.cc
@@ -89,8 +89,7 @@ class FirstRunMasterPrefsBrowserTestBase : public InProcessBrowserTest {
ASSERT_TRUE(text_.get());
ASSERT_TRUE(base::CreateTemporaryFile(&prefs_file_));
- EXPECT_TRUE(file_util::WriteFile(prefs_file_, text_->c_str(),
- text_->size()));
+ EXPECT_TRUE(base::WriteFile(prefs_file_, text_->c_str(), text_->size()));
first_run::SetMasterPrefsPathForTesting(prefs_file_);
// This invokes BrowserMain, and does the import, so must be done last.
diff --git a/chrome/browser/first_run/first_run_internal_win.cc b/chrome/browser/first_run/first_run_internal_win.cc
index bcc7911..2225cc8 100644
--- a/chrome/browser/first_run/first_run_internal_win.cc
+++ b/chrome/browser/first_run/first_run_internal_win.cc
@@ -108,7 +108,7 @@ bool WriteEULAtoTempFile(base::FilePath* eula_path) {
std::string terms = l10n_util::GetStringUTF8(IDS_TERMS_HTML);
return (!terms.empty() &&
base::CreateTemporaryFile(eula_path) &&
- file_util::WriteFile(*eula_path, terms.data(), terms.size()) != -1);
+ base::WriteFile(*eula_path, terms.data(), terms.size()) != -1);
}
// Creates the sentinel indicating that the EULA was required and has been
@@ -119,7 +119,7 @@ bool CreateEULASentinel() {
return false;
return (base::CreateDirectory(eula_sentinel.DirName()) &&
- file_util::WriteFile(eula_sentinel, "", 0) != -1);
+ base::WriteFile(eula_sentinel, "", 0) != -1);
}
} // namespace
diff --git a/chrome/browser/google/google_update_settings_posix.cc b/chrome/browser/google/google_update_settings_posix.cc
index b861576..ac66192 100644
--- a/chrome/browser/google/google_update_settings_posix.cc
+++ b/chrome/browser/google/google_update_settings_posix.cc
@@ -48,7 +48,7 @@ bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) {
!google_update::posix_guid().empty())) {
const char* c_str = google_update::posix_guid().c_str();
int size = google_update::posix_guid().size();
- return file_util::WriteFile(consent_file, c_str, size) == size;
+ return base::WriteFile(consent_file, c_str, size) == size;
}
} else {
google_update::posix_guid().clear();
diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc
index 9a12517..f53763f 100644
--- a/chrome/browser/history/history_backend_unittest.cc
+++ b/chrome/browser/history/history_backend_unittest.cc
@@ -2838,10 +2838,10 @@ TEST_F(HistoryBackendTest, DeleteFTSIndexDatabases) {
// Setup dummy index database files.
const char* data = "Dummy";
const size_t data_len = 5;
- ASSERT_TRUE(file_util::WriteFile(db1, data, data_len));
- ASSERT_TRUE(file_util::WriteFile(db1_journal, data, data_len));
- ASSERT_TRUE(file_util::WriteFile(db1_wal, data, data_len));
- ASSERT_TRUE(file_util::WriteFile(db2_actual, data, data_len));
+ ASSERT_TRUE(base::WriteFile(db1, data, data_len));
+ ASSERT_TRUE(base::WriteFile(db1_journal, data, data_len));
+ ASSERT_TRUE(base::WriteFile(db1_wal, data, data_len));
+ ASSERT_TRUE(base::WriteFile(db2_actual, data, data_len));
#if defined(OS_POSIX)
EXPECT_TRUE(base::CreateSymbolicLink(db2_actual, db2_symlink));
#endif
diff --git a/chrome/browser/history/redirect_browsertest.cc b/chrome/browser/history/redirect_browsertest.cc
index 0a85700..342ac0b 100644
--- a/chrome/browser/history/redirect_browsertest.cc
+++ b/chrome/browser/history/redirect_browsertest.cc
@@ -137,9 +137,9 @@ IN_PROC_BROWSER_TEST_F(RedirectTest, ClientEmptyReferer) {
ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory.path(),
&temp_file));
ASSERT_EQ(static_cast<int>(file_redirect_contents.size()),
- file_util::WriteFile(temp_file,
- file_redirect_contents.data(),
- file_redirect_contents.size()));
+ base::WriteFile(temp_file,
+ file_redirect_contents.data(),
+ file_redirect_contents.size()));
// Navigate to the file through the browser. The client redirect will appear
// as two page visits in the browser.
diff --git a/chrome/browser/history/url_index_private_data.cc b/chrome/browser/history/url_index_private_data.cc
index 717d282..0d6718a 100644
--- a/chrome/browser/history/url_index_private_data.cc
+++ b/chrome/browser/history/url_index_private_data.cc
@@ -898,7 +898,7 @@ bool URLIndexPrivateData::SaveToFile(const base::FilePath& file_path) {
}
int size = data.size();
- if (file_util::WriteFile(file_path, data.c_str(), size) != size) {
+ if (base::WriteFile(file_path, data.c_str(), size) != size) {
LOG(WARNING) << "Failed to write " << file_path.value();
return false;
}
diff --git a/chrome/browser/importer/ie_importer_browsertest_win.cc b/chrome/browser/importer/ie_importer_browsertest_win.cc
index 33bf646..bd36899 100644
--- a/chrome/browser/importer/ie_importer_browsertest_win.cc
+++ b/chrome/browser/importer/ie_importer_browsertest_win.cc
@@ -203,7 +203,7 @@ bool CreateUrlFileWithFavicon(const base::FilePath& file,
return false;
// Write dummy favicon image data in NTFS alternate data stream.
- return favicon_url.empty() || (file_util::WriteFile(
+ return favicon_url.empty() || (base::WriteFile(
file.ReplaceExtension(kFaviconStreamSuffix), kDummyFaviconImageData,
sizeof kDummyFaviconImageData) != -1);
}
@@ -498,8 +498,8 @@ IN_PROC_BROWSER_TEST_F(IEImporterBrowserTest, IEImporter) {
L"http://www.links-sublink.com/"));
ASSERT_TRUE(CreateUrlFile(path.AppendASCII("IEDefaultLink.url"),
L"http://go.microsoft.com/fwlink/?linkid=140813"));
- file_util::WriteFile(path.AppendASCII("InvalidUrlFile.url"), "x", 1);
- file_util::WriteFile(path.AppendASCII("PlainTextFile.txt"), "x", 1);
+ base::WriteFile(path.AppendASCII("InvalidUrlFile.url"), "x", 1);
+ base::WriteFile(path.AppendASCII("PlainTextFile.txt"), "x", 1);
const base::char16* root_links[] = {
L"Links",
diff --git a/chrome/browser/local_discovery/pwg_raster_converter.cc b/chrome/browser/local_discovery/pwg_raster_converter.cc
index 2ea9cab..ce3e0ea 100644
--- a/chrome/browser/local_discovery/pwg_raster_converter.cc
+++ b/chrome/browser/local_discovery/pwg_raster_converter.cc
@@ -75,9 +75,7 @@ void FileHandlers::Init(base::RefCountedMemory* data) {
}
if (static_cast<int>(data->size()) !=
- file_util::WriteFile(GetPdfPath(),
- data->front_as<char>(),
- data->size())) {
+ base::WriteFile(GetPdfPath(), data->front_as<char>(), data->size())) {
return;
}
diff --git a/chrome/browser/media/webrtc_log_uploader.cc b/chrome/browser/media/webrtc_log_uploader.cc
index 5682c76..563cf9d 100644
--- a/chrome/browser/media/webrtc_log_uploader.cc
+++ b/chrome/browser/media/webrtc_log_uploader.cc
@@ -301,8 +301,8 @@ void WebRtcLogUploader::AddUploadedLogInfoToUploadListFile(
contents += base::DoubleToString(time_now.ToDoubleT()) +
"," + report_id + '\n';
- int written = file_util::WriteFile(upload_list_path, &contents[0],
- contents.size());
+ int written =
+ base::WriteFile(upload_list_path, &contents[0], contents.size());
DPCHECK(written == static_cast<int>(contents.size()));
}
diff --git a/chrome/browser/media_galleries/fileapi/iapps_finder_impl_win_browsertest.cc b/chrome/browser/media_galleries/fileapi/iapps_finder_impl_win_browsertest.cc
index 903d0f7..88649a0 100644
--- a/chrome/browser/media_galleries/fileapi/iapps_finder_impl_win_browsertest.cc
+++ b/chrome/browser/media_galleries/fileapi/iapps_finder_impl_win_browsertest.cc
@@ -31,7 +31,7 @@ std::string EncodePath(const base::FilePath& path) {
}
void TouchFile(const base::FilePath& file) {
- ASSERT_EQ(1, file_util::WriteFile(file, " ", 1));
+ ASSERT_EQ(1, base::WriteFile(file, " ", 1));
}
class ITunesFinderWinTest : public InProcessBrowserTest {
@@ -63,8 +63,8 @@ class ITunesFinderWinTest : public InProcessBrowserTest {
app_data_dir().AppendASCII("Apple Computer").AppendASCII("iTunes");
ASSERT_TRUE(base::CreateDirectory(pref_dir));
ASSERT_EQ(data.size(),
- file_util::WriteFile(pref_dir.AppendASCII("iTunesPrefs.xml"),
- data.data(), data.size()));
+ base::WriteFile(pref_dir.AppendASCII("iTunesPrefs.xml"),
+ data.data(), data.size()));
}
void TouchDefault() {
diff --git a/chrome/browser/media_galleries/fileapi/iphoto_data_provider_browsertest.cc b/chrome/browser/media_galleries/fileapi/iphoto_data_provider_browsertest.cc
index 10f1ebb..fe43d3f 100644
--- a/chrome/browser/media_galleries/fileapi/iphoto_data_provider_browsertest.cc
+++ b/chrome/browser/media_galleries/fileapi/iphoto_data_provider_browsertest.cc
@@ -141,7 +141,7 @@ class IPhotoDataProviderTest : public InProcessBrowserTest {
void WriteLibraryInternal() {
std::string xml = GetLibraryString();
ASSERT_EQ(static_cast<int>(xml.size()),
- file_util::WriteFile(XmlFile(), xml.c_str(), xml.size()));
+ base::WriteFile(XmlFile(), xml.c_str(), xml.size()));
}
base::ScopedTempDir library_dir_;
@@ -451,7 +451,7 @@ class IPhotoDataProviderInvalidTest : public IPhotoDataProviderTest {
base::Unretained(data_provider()),
base::Bind(&IPhotoDataProviderInvalidTest::CheckInvalid,
base::Unretained(this))));
- EXPECT_EQ(1L, file_util::WriteFile(XmlFile(), " ", 1));
+ EXPECT_EQ(1L, base::WriteFile(XmlFile(), " ", 1));
}
void CheckInvalid(bool is_valid) {
diff --git a/chrome/browser/media_galleries/fileapi/iphoto_file_util_unittest.cc b/chrome/browser/media_galleries/fileapi/iphoto_file_util_unittest.cc
index 1ea2eda..d8dbbdf 100644
--- a/chrome/browser/media_galleries/fileapi/iphoto_file_util_unittest.cc
+++ b/chrome/browser/media_galleries/fileapi/iphoto_file_util_unittest.cc
@@ -168,13 +168,13 @@ class IPhotoFileUtilTest : public testing::Test {
ASSERT_TRUE(fake_library_dir_.CreateUniqueTempDir());
ASSERT_EQ(
0,
- file_util::WriteFile(
+ base::WriteFile(
fake_library_dir_.path().AppendASCII("a.jpg"),
NULL,
0));
ASSERT_EQ(
0,
- file_util::WriteFile(
+ base::WriteFile(
fake_library_dir_.path().AppendASCII("orig.jpg"),
NULL,
0));
diff --git a/chrome/browser/media_galleries/fileapi/itunes_data_provider_browsertest.cc b/chrome/browser/media_galleries/fileapi/itunes_data_provider_browsertest.cc
index e14acbf..e8a6c80 100644
--- a/chrome/browser/media_galleries/fileapi/itunes_data_provider_browsertest.cc
+++ b/chrome/browser/media_galleries/fileapi/itunes_data_provider_browsertest.cc
@@ -193,7 +193,7 @@ class ITunesDataProviderTest : public InProcessBrowserTest {
}
xml += "</dict></dict></plist>\n";
ASSERT_EQ(static_cast<int>(xml.size()),
- file_util::WriteFile(XmlFile(), xml.c_str(), xml.size()));
+ base::WriteFile(XmlFile(), xml.c_str(), xml.size()));
}
base::ScopedTempDir library_dir_;
@@ -343,7 +343,7 @@ class ITunesDataProviderInvalidTest : public ITunesDataProviderTest {
base::Unretained(data_provider()),
base::Bind(&ITunesDataProviderInvalidTest::CheckInvalid,
base::Unretained(this))));
- ASSERT_EQ(1L, file_util::WriteFile(XmlFile(), " ", 1));
+ ASSERT_EQ(1L, base::WriteFile(XmlFile(), " ", 1));
}
void CheckInvalid(bool is_valid) {
diff --git a/chrome/browser/media_galleries/fileapi/itunes_file_util_unittest.cc b/chrome/browser/media_galleries/fileapi/itunes_file_util_unittest.cc
index 4209613..7ef4765 100644
--- a/chrome/browser/media_galleries/fileapi/itunes_file_util_unittest.cc
+++ b/chrome/browser/media_galleries/fileapi/itunes_file_util_unittest.cc
@@ -142,7 +142,7 @@ class ItunesFileUtilTest : public testing::Test {
ASSERT_TRUE(fake_library_dir_.CreateUniqueTempDir());
ASSERT_EQ(
0,
- file_util::WriteFile(
+ base::WriteFile(
fake_library_dir_.path().AppendASCII(kITunesLibraryXML),
NULL,
0));
@@ -284,7 +284,7 @@ TEST_F(ItunesFileUtilTest, ItunesMediaDirectoryContentsAutoAdd) {
TEST_F(ItunesFileUtilTest, ItunesAutoAddDirEnumerate) {
data_provider()->SetProvideAutoAddDir(true);
- ASSERT_EQ(0, file_util::WriteFile(
+ ASSERT_EQ(0, base::WriteFile(
data_provider()->auto_add_path().AppendASCII("baz.ogg"), NULL, 0));
FileSystemOperation::FileEntryList contents;
@@ -306,7 +306,7 @@ TEST_F(ItunesFileUtilTest, ItunesAutoAddDirEnumerateNested) {
data_provider()->auto_add_path().AppendASCII("foo").AppendASCII("bar");
ASSERT_TRUE(base::CreateDirectory(nested_dir));
ASSERT_EQ(0,
- file_util::WriteFile(nested_dir.AppendASCII("baz.ogg"), NULL, 0));
+ base::WriteFile(nested_dir.AppendASCII("baz.ogg"), NULL, 0));
FileSystemOperation::FileEntryList contents;
FileSystemURL url = CreateURL(
diff --git a/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc b/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc
index cd4e89b..c2e3082 100644
--- a/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc
+++ b/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc
@@ -123,7 +123,7 @@ class MediaFileValidatorTest : public InProcessBrowserTest {
test_file_size_ = content.size();
base::FilePath test_file = src_path.AppendASCII(filename);
ASSERT_EQ(test_file_size_,
- file_util::WriteFile(test_file, content.data(), test_file_size_));
+ base::WriteFile(test_file, content.data(), test_file_size_));
base::FilePath dest_path = base.AppendASCII("dest_fs");
ASSERT_TRUE(base::CreateDirectory(dest_path));
diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc b/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc
index a835678..93a47c3 100644
--- a/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc
+++ b/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc
@@ -102,7 +102,7 @@ void PopulateDirectoryWithTestCases(const base::FilePath& dir,
} else {
ASSERT_TRUE(test_cases[i].content != NULL);
int len = strlen(test_cases[i].content);
- ASSERT_EQ(len, file_util::WriteFile(path, test_cases[i].content, len));
+ ASSERT_EQ(len, base::WriteFile(path, test_cases[i].content, len));
}
}
}
@@ -330,7 +330,7 @@ TEST_F(NativeMediaFileUtilTest, CopyDestFiltering) {
base::FilePath src_path = root_path().AppendASCII("foo.jpg");
FileSystemURL src_url = CreateURL(FPL("foo.jpg"));
static const char kDummyData[] = "dummy";
- ASSERT_TRUE(file_util::WriteFile(src_path, kDummyData, strlen(kDummyData)));
+ ASSERT_TRUE(base::WriteFile(src_path, kDummyData, strlen(kDummyData)));
for (size_t i = 0; i < arraysize(kFilteringTestCases); ++i) {
if (loop_count == 0 && kFilteringTestCases[i].is_directory) {
@@ -441,7 +441,7 @@ TEST_F(NativeMediaFileUtilTest, MoveDestFiltering) {
FileSystemURL src_url = CreateURL(FPL("foo.jpg"));
static const char kDummyData[] = "dummy";
ASSERT_TRUE(
- file_util::WriteFile(src_path, kDummyData, strlen(kDummyData)));
+ base::WriteFile(src_path, kDummyData, strlen(kDummyData)));
FileSystemURL root_url = CreateURL(FPL(""));
FileSystemURL url = CreateURL(kFilteringTestCases[i].path);
diff --git a/chrome/browser/media_galleries/fileapi/picasa_file_util_unittest.cc b/chrome/browser/media_galleries/fileapi/picasa_file_util_unittest.cc
index d3d59eb..3255ad1 100644
--- a/chrome/browser/media_galleries/fileapi/picasa_file_util_unittest.cc
+++ b/chrome/browser/media_galleries/fileapi/picasa_file_util_unittest.cc
@@ -49,7 +49,7 @@ base::Time::Exploded test_date_exploded = { 2013, 4, 0, 16, 0, 0, 0, 0 };
bool WriteJPEGHeader(const base::FilePath& path) {
const char kJpegHeader[] = "\xFF\xD8\xFF"; // Per HTML5 specification.
- return file_util::WriteFile(path, kJpegHeader, arraysize(kJpegHeader)) != -1;
+ return base::WriteFile(path, kJpegHeader, arraysize(kJpegHeader)) != -1;
}
class TestFolder {
@@ -84,7 +84,7 @@ class TestFolder {
for (unsigned int i = 0; i < non_image_files_; ++i) {
base::FilePath path = folder_dir_.path().AppendASCII(
base::StringPrintf("hello%05d.txt", i));
- if (file_util::WriteFile(path, NULL, 0) == -1)
+ if (base::WriteFile(path, NULL, 0) == -1)
return false;
}
diff --git a/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm b/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm
index 922410a..d4d3f17 100644
--- a/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm
+++ b/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm
@@ -102,8 +102,8 @@ const char kTestFileContents[] = "test";
saveAsFilename += ".jpg";
base::FilePath toBeSaved = saveDir.Append(saveAsFilename);
ASSERT_EQ(static_cast<int>(strlen(kTestFileContents)),
- file_util::WriteFile(toBeSaved, kTestFileContents,
- strlen(kTestFileContents)));
+ base::WriteFile(toBeSaved, kTestFileContents,
+ strlen(kTestFileContents)));
NSMutableDictionary* returnOptions =
[NSMutableDictionary dictionaryWithDictionary:options];
diff --git a/chrome/browser/media_galleries/media_folder_finder_unittest.cc b/chrome/browser/media_galleries/media_folder_finder_unittest.cc
index eadc8a6..4e7fb92 100644
--- a/chrome/browser/media_galleries/media_folder_finder_unittest.cc
+++ b/chrome/browser/media_galleries/media_folder_finder_unittest.cc
@@ -131,7 +131,7 @@ class MediaFolderFinderTest : public testing::Test {
dummy_data.resize(filesize);
int bytes_written =
- file_util::WriteFile(test_file, dummy_data.c_str(), filesize);
+ base::WriteFile(test_file, dummy_data.c_str(), filesize);
ASSERT_GE(bytes_written, 0);
ASSERT_EQ(filesize, static_cast<size_t>(bytes_written));
}
diff --git a/chrome/browser/nacl_host/test/mock_nacl_gdb.cc b/chrome/browser/nacl_host/test/mock_nacl_gdb.cc
index 097f1f9..36ff08c 100644
--- a/chrome/browser/nacl_host/test/mock_nacl_gdb.cc
+++ b/chrome/browser/nacl_host/test/mock_nacl_gdb.cc
@@ -50,15 +50,15 @@ int main(int argc, char** argv) {
i += 2;
CHECK_LE(i, argc);
std::string nacl_gdb_script(argv[i - 1]);
- file_util::WriteFile(base::FilePath::FromUTF8Unsafe(nacl_gdb_script),
- kPass, strlen(kPass));
+ base::WriteFile(base::FilePath::FromUTF8Unsafe(nacl_gdb_script),
+ kPass, strlen(kPass));
continue;
}
// Unknown argument.
NOTREACHED() << "Invalid argument " << argv[i];
}
CHECK_EQ(i, argc);
- file_util::WriteFile(base::FilePath::FromUTF8Unsafe(mock_nacl_gdb_file),
- kPass, strlen(kPass));
+ base::WriteFile(base::FilePath::FromUTF8Unsafe(mock_nacl_gdb_file),
+ kPass, strlen(kPass));
return 0;
}
diff --git a/chrome/browser/net/crl_set_fetcher.cc b/chrome/browser/net/crl_set_fetcher.cc
index 6c62bcf..201faf9 100644
--- a/chrome/browser/net/crl_set_fetcher.cc
+++ b/chrome/browser/net/crl_set_fetcher.cc
@@ -171,7 +171,7 @@ bool CRLSetFetcher::Install(const base::DictionaryValue& manifest,
return false;
}
int size = base::checked_cast<int>(crl_set_bytes.size());
- if (file_util::WriteFile(save_to, crl_set_bytes.data(), size) != size) {
+ if (base::WriteFile(save_to, crl_set_bytes.data(), size) != size) {
LOG(WARNING) << "Failed to save new CRL set to disk";
// We don't return false here because we can still use this CRL set. When
// we restart we might revert to an older version, then we'll
@@ -187,7 +187,7 @@ bool CRLSetFetcher::Install(const base::DictionaryValue& manifest,
<< "->#" << new_crl_set->sequence();
const std::string new_crl_set_bytes = new_crl_set->Serialize();
int size = base::checked_cast<int>(new_crl_set_bytes.size());
- if (file_util::WriteFile(save_to, new_crl_set_bytes.data(), size) != size) {
+ if (base::WriteFile(save_to, new_crl_set_bytes.data(), size) != size) {
LOG(WARNING) << "Failed to save new CRL set to disk";
// We don't return false here because we can still use this CRL set. When
// we restart we might revert to an older version, then we'll
diff --git a/chrome/browser/parsers/metadata_parser_filebase_unittest.cc b/chrome/browser/parsers/metadata_parser_filebase_unittest.cc
index 312ab5a..2924128 100644
--- a/chrome/browser/parsers/metadata_parser_filebase_unittest.cc
+++ b/chrome/browser/parsers/metadata_parser_filebase_unittest.cc
@@ -25,8 +25,8 @@ class FileMetaDataParserTest : public testing::Test {
// Create the test file.
std::string content = "content";
- int write_size = file_util::WriteFile(test_file_, content.c_str(),
- content.length());
+ int write_size = base::WriteFile(test_file_, content.c_str(),
+ content.length());
ASSERT_EQ(static_cast<int>(content.length()), write_size);
}
diff --git a/chrome/browser/policy/cloud/cloud_policy_browsertest.cc b/chrome/browser/policy/cloud/cloud_policy_browsertest.cc
index 4c24434..16f4c20 100644
--- a/chrome/browser/policy/cloud/cloud_policy_browsertest.cc
+++ b/chrome/browser/policy/cloud/cloud_policy_browsertest.cc
@@ -246,8 +246,8 @@ class CloudPolicyTest : public InProcessBrowserTest,
}
void SetServerPolicy(const std::string& policy) {
- int result = file_util::WriteFile(policy_file_path(), policy.data(),
- policy.size());
+ int result = base::WriteFile(policy_file_path(), policy.data(),
+ policy.size());
ASSERT_EQ(static_cast<int>(policy.size()), result);
}
diff --git a/chrome/browser/policy/test/local_policy_test_server.cc b/chrome/browser/policy/test/local_policy_test_server.cc
index cca478e..99b843b 100644
--- a/chrome/browser/policy/test/local_policy_test_server.cc
+++ b/chrome/browser/policy/test/local_policy_test_server.cc
@@ -96,7 +96,7 @@ bool LocalPolicyTestServer::SetSigningKeyAndSignature(
return false;
policy_key_ = server_data_dir_.path().Append(kSigningKeyFileName);
- int bytes_written = file_util::WriteFile(
+ int bytes_written = base::WriteFile(
policy_key_,
reinterpret_cast<const char*>(vector_as_array(&signing_key_bits)),
signing_key_bits.size());
@@ -107,7 +107,7 @@ bool LocalPolicyTestServer::SetSigningKeyAndSignature(
// Write the signature data.
base::FilePath signature_file = server_data_dir_.path().Append(
kSigningKeySignatureFileName);
- bytes_written = file_util::WriteFile(
+ bytes_written = base::WriteFile(
signature_file,
signature.c_str(),
signature.size());
@@ -145,7 +145,7 @@ bool LocalPolicyTestServer::UpdatePolicy(const std::string& type,
base::FilePath policy_file = server_data_dir_.path().AppendASCII(
base::StringPrintf("policy_%s.bin", selector.c_str()));
- return file_util::WriteFile(policy_file, policy.c_str(), policy.size()) ==
+ return base::WriteFile(policy_file, policy.c_str(), policy.size()) ==
static_cast<int>(policy.size());
}
@@ -158,7 +158,7 @@ bool LocalPolicyTestServer::UpdatePolicyData(const std::string& type,
base::FilePath data_file = server_data_dir_.path().AppendASCII(
base::StringPrintf("policy_%s.data", selector.c_str()));
- return file_util::WriteFile(data_file, data.c_str(), data.size()) ==
+ return base::WriteFile(data_file, data.c_str(), data.size()) ==
static_cast<int>(data.size());
}
@@ -249,7 +249,7 @@ bool LocalPolicyTestServer::GenerateAdditionalArguments(
base::JSONWriter::Write(&clients_, &json);
base::FilePath client_state_file =
server_data_dir_.path().Append(kClientStateFileName);
- if (file_util::WriteFile(client_state_file, json.c_str(), json.size()) !=
+ if (base::WriteFile(client_state_file, json.c_str(), json.size()) !=
static_cast<int>(json.size())) {
return false;
}
diff --git a/chrome/browser/profile_resetter/automatic_profile_resetter_mementos.cc b/chrome/browser/profile_resetter/automatic_profile_resetter_mementos.cc
index 6bb94e2..101155b 100644
--- a/chrome/browser/profile_resetter/automatic_profile_resetter_mementos.cc
+++ b/chrome/browser/profile_resetter/automatic_profile_resetter_mementos.cc
@@ -120,7 +120,7 @@ void FileHostedPromptMemento::StoreValueOnFileThread(
const base::FilePath& memento_file_path,
const std::string& value) {
int retval =
- file_util::WriteFile(memento_file_path, value.c_str(), value.size());
+ base::WriteFile(memento_file_path, value.c_str(), value.size());
DCHECK_EQ(retval, (int)value.size());
}
diff --git a/chrome/browser/profiles/profile_browsertest.cc b/chrome/browser/profiles/profile_browsertest.cc
index affbc3a..fde3caf 100644
--- a/chrome/browser/profiles/profile_browsertest.cc
+++ b/chrome/browser/profiles/profile_browsertest.cc
@@ -38,7 +38,7 @@ void CreatePrefsFileInDirectory(const base::FilePath& directory_path) {
ASSERT_TRUE(file != base::kInvalidPlatformFileValue);
ASSERT_TRUE(base::ClosePlatformFile(file));
std::string data("{}");
- ASSERT_TRUE(file_util::WriteFile(pref_path, data.c_str(), data.size()));
+ ASSERT_TRUE(base::WriteFile(pref_path, data.c_str(), data.size()));
}
void CheckChromeVersion(Profile *profile, bool is_new) {
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 52acc0c..6b1932f 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -217,8 +217,8 @@ void EnsureReadmeFile(const base::FilePath& base) {
std::string product_name = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME);
std::string readme_text = base::StringPrintf(
kReadmeText, product_name.c_str(), product_name.c_str());
- if (file_util::WriteFile(
- readme_path, readme_text.data(), readme_text.size()) == -1) {
+ if (base::WriteFile(readme_path, readme_text.data(), readme_text.size()) ==
+ -1) {
LOG(ERROR) << "Could not create README file.";
}
}
diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc
index b06aaaf..8055c96 100644
--- a/chrome/browser/profiles/profile_info_cache.cc
+++ b/chrome/browser/profiles/profile_info_cache.cc
@@ -135,9 +135,8 @@ void SaveBitmap(ImageData* data,
return;
}
- if (file_util::WriteFile(image_path,
- reinterpret_cast<char*>(&(*data)[0]),
- data->size()) == -1) {
+ if (base::WriteFile(image_path, reinterpret_cast<char*>(&(*data)[0]),
+ data->size()) == -1) {
LOG(ERROR) << "Failed to save image to file.";
return;
}
diff --git a/chrome/browser/safe_browsing/download_feedback_service_unittest.cc b/chrome/browser/safe_browsing/download_feedback_service_unittest.cc
index 808c798..e1520bd 100644
--- a/chrome/browser/safe_browsing/download_feedback_service_unittest.cc
+++ b/chrome/browser/safe_browsing/download_feedback_service_unittest.cc
@@ -150,7 +150,7 @@ class DownloadFeedbackServiceTest : public testing::Test {
base::FilePath upload_file_path(
temp_dir_.path().AppendASCII("test file " + base::IntToString(n)));
const std::string upload_file_data = "data";
- int wrote = file_util::WriteFile(
+ int wrote = base::WriteFile(
upload_file_path, upload_file_data.data(), upload_file_data.size());
EXPECT_EQ(static_cast<int>(upload_file_data.size()), wrote);
return upload_file_path;
diff --git a/chrome/browser/safe_browsing/download_feedback_unittest.cc b/chrome/browser/safe_browsing/download_feedback_unittest.cc
index 6f42ff7..460c5ae 100644
--- a/chrome/browser/safe_browsing/download_feedback_unittest.cc
+++ b/chrome/browser/safe_browsing/download_feedback_unittest.cc
@@ -119,8 +119,8 @@ class DownloadFeedbackTest : public testing::Test {
upload_file_path_ = temp_dir_.path().AppendASCII("test file");
upload_file_data_ = "data";
ASSERT_EQ(static_cast<int>(upload_file_data_.size()),
- file_util::WriteFile(upload_file_path_, upload_file_data_.data(),
- upload_file_data_.size()));
+ base::WriteFile(upload_file_path_, upload_file_data_.data(),
+ upload_file_data_.size()));
TwoPhaseUploader::RegisterFactory(&two_phase_uploader_factory_);
}
diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc
index 34bcf1a..ee82e27 100644
--- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc
@@ -710,7 +710,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) {
base::ScopedTempDir zip_source_dir;
ASSERT_TRUE(zip_source_dir.CreateUniqueTempDir());
std::string file_contents = "dummy file";
- ASSERT_EQ(static_cast<int>(file_contents.size()), file_util::WriteFile(
+ ASSERT_EQ(static_cast<int>(file_contents.size()), base::WriteFile(
zip_source_dir.path().Append(FILE_PATH_LITERAL("file.txt")),
file_contents.data(), file_contents.size()));
ASSERT_TRUE(zip::Zip(zip_source_dir.path(), a_tmp, false));
@@ -725,7 +725,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) {
Mock::VerifyAndClearExpectations(signature_util_.get());
// Now check with an executable in the zip file as well.
- ASSERT_EQ(static_cast<int>(file_contents.size()), file_util::WriteFile(
+ ASSERT_EQ(static_cast<int>(file_contents.size()), base::WriteFile(
zip_source_dir.path().Append(FILE_PATH_LITERAL("file.exe")),
file_contents.data(), file_contents.size()));
ASSERT_TRUE(zip::Zip(zip_source_dir.path(), a_tmp, false));
@@ -787,7 +787,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadCorruptZip) {
EXPECT_CALL(item, GetRemoteAddress()).WillRepeatedly(Return(""));
std::string file_contents = "corrupt zip file";
- ASSERT_EQ(static_cast<int>(file_contents.size()), file_util::WriteFile(
+ ASSERT_EQ(static_cast<int>(file_contents.size()), base::WriteFile(
a_tmp, file_contents.data(), file_contents.size()));
download_service_->CheckClientDownload(
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index f19a375d..771a183 100644
--- a/chrome/browser/shell_integration_linux.cc
+++ b/chrome/browser/shell_integration_linux.cc
@@ -103,9 +103,9 @@ std::string CreateShortcutIcon(const gfx::ImageFamily& icon_images,
<< width << ".";
continue;
}
- int bytes_written = file_util::WriteFile(temp_file_path,
- png_data->front_as<char>(),
- png_data->size());
+ int bytes_written = base::WriteFile(temp_file_path,
+ png_data->front_as<char>(),
+ png_data->size());
if (bytes_written != static_cast<int>(png_data->size()))
return std::string();
@@ -155,8 +155,8 @@ bool CreateShortcutOnDesktop(const base::FilePath& shortcut_filename,
return false;
}
- ssize_t bytes_written = file_util::WriteFileDescriptor(fd, contents.data(),
- contents.length());
+ ssize_t bytes_written = base::WriteFileDescriptor(fd, contents.data(),
+ contents.length());
if (IGNORE_EINTR(close(fd)) < 0)
PLOG(ERROR) << "close";
@@ -196,9 +196,9 @@ bool CreateShortcutInApplicationsMenu(const base::FilePath& shortcut_filename,
if (!directory_filename.empty()) {
temp_directory_path = temp_dir.path().Append(directory_filename);
- int bytes_written = file_util::WriteFile(temp_directory_path,
- directory_contents.data(),
- directory_contents.length());
+ int bytes_written = base::WriteFile(temp_directory_path,
+ directory_contents.data(),
+ directory_contents.length());
if (bytes_written != static_cast<int>(directory_contents.length()))
return false;
@@ -206,8 +206,8 @@ bool CreateShortcutInApplicationsMenu(const base::FilePath& shortcut_filename,
base::FilePath temp_file_path = temp_dir.path().Append(shortcut_filename);
- int bytes_written = file_util::WriteFile(temp_file_path, contents.data(),
- contents.length());
+ int bytes_written = base::WriteFile(temp_file_path, contents.data(),
+ contents.length());
if (bytes_written != static_cast<int>(contents.length()))
return false;
diff --git a/chrome/browser/shell_integration_linux_unittest.cc b/chrome/browser/shell_integration_linux_unittest.cc
index 4c47e56..adf4378 100644
--- a/chrome/browser/shell_integration_linux_unittest.cc
+++ b/chrome/browser/shell_integration_linux_unittest.cc
@@ -186,7 +186,7 @@ TEST(ShellIntegrationTest, GetExistingShortcutLocations) {
MockEnvironment env;
ASSERT_TRUE(base::CreateDirectory(desktop_path));
- ASSERT_FALSE(file_util::WriteFile(
+ ASSERT_FALSE(base::WriteFile(
desktop_path.AppendASCII(kTemplateFilename),
"", 0));
ShellIntegration::ShortcutLocations result =
@@ -209,7 +209,7 @@ TEST(ShellIntegrationTest, GetExistingShortcutLocations) {
MockEnvironment env;
env.Set("XDG_DATA_HOME", temp_dir.path().value());
ASSERT_TRUE(base::CreateDirectory(apps_path));
- ASSERT_FALSE(file_util::WriteFile(
+ ASSERT_FALSE(base::WriteFile(
apps_path.AppendASCII(kTemplateFilename),
"", 0));
ShellIntegration::ShortcutLocations result =
@@ -232,7 +232,7 @@ TEST(ShellIntegrationTest, GetExistingShortcutLocations) {
MockEnvironment env;
env.Set("XDG_DATA_HOME", temp_dir.path().value());
ASSERT_TRUE(base::CreateDirectory(apps_path));
- ASSERT_TRUE(file_util::WriteFile(
+ ASSERT_TRUE(base::WriteFile(
apps_path.AppendASCII(kTemplateFilename),
kNoDisplayDesktopFile, strlen(kNoDisplayDesktopFile)));
ShellIntegration::ShortcutLocations result =
@@ -258,12 +258,12 @@ TEST(ShellIntegrationTest, GetExistingShortcutLocations) {
MockEnvironment env;
ASSERT_TRUE(base::CreateDirectory(desktop_path));
- ASSERT_FALSE(file_util::WriteFile(
+ ASSERT_FALSE(base::WriteFile(
desktop_path.AppendASCII(kTemplateFilename),
"", 0));
env.Set("XDG_DATA_HOME", temp_dir2.path().value());
ASSERT_TRUE(base::CreateDirectory(apps_path));
- ASSERT_FALSE(file_util::WriteFile(
+ ASSERT_FALSE(base::WriteFile(
apps_path.AppendASCII(kTemplateFilename),
"", 0));
ShellIntegration::ShortcutLocations result =
@@ -294,12 +294,12 @@ TEST(ShellIntegrationTest, GetExistingShortcutContents) {
MockEnvironment env;
env.Set("XDG_DATA_HOME", temp_dir.path().value());
// Create a file in a non-applications directory. This should be ignored.
- ASSERT_TRUE(file_util::WriteFile(
+ ASSERT_TRUE(base::WriteFile(
temp_dir.path().AppendASCII(kTemplateFilename),
kTestData2, strlen(kTestData2)));
ASSERT_TRUE(base::CreateDirectory(
temp_dir.path().AppendASCII("applications")));
- ASSERT_TRUE(file_util::WriteFile(
+ ASSERT_TRUE(base::WriteFile(
temp_dir.path().AppendASCII("applications")
.AppendASCII(kTemplateFilename),
kTestData1, strlen(kTestData1)));
@@ -319,7 +319,7 @@ TEST(ShellIntegrationTest, GetExistingShortcutContents) {
env.Set("HOME", temp_dir.path().value());
ASSERT_TRUE(base::CreateDirectory(
temp_dir.path().AppendASCII(".local/share/applications")));
- ASSERT_TRUE(file_util::WriteFile(
+ ASSERT_TRUE(base::WriteFile(
temp_dir.path().AppendASCII(".local/share/applications")
.AppendASCII(kTemplateFilename),
kTestData1, strlen(kTestData1)));
@@ -339,7 +339,7 @@ TEST(ShellIntegrationTest, GetExistingShortcutContents) {
env.Set("XDG_DATA_DIRS", temp_dir.path().value());
ASSERT_TRUE(base::CreateDirectory(
temp_dir.path().AppendASCII("applications")));
- ASSERT_TRUE(file_util::WriteFile(
+ ASSERT_TRUE(base::WriteFile(
temp_dir.path().AppendASCII("applications")
.AppendASCII(kTemplateFilename),
kTestData2, strlen(kTestData2)));
@@ -361,13 +361,13 @@ TEST(ShellIntegrationTest, GetExistingShortcutContents) {
env.Set("XDG_DATA_DIRS", temp_dir1.path().value() + ":" +
temp_dir2.path().value());
// Create a file in a non-applications directory. This should be ignored.
- ASSERT_TRUE(file_util::WriteFile(
+ ASSERT_TRUE(base::WriteFile(
temp_dir1.path().AppendASCII(kTemplateFilename),
kTestData1, strlen(kTestData1)));
// Only create a findable desktop file in the second path.
ASSERT_TRUE(base::CreateDirectory(
temp_dir2.path().AppendASCII("applications")));
- ASSERT_TRUE(file_util::WriteFile(
+ ASSERT_TRUE(base::WriteFile(
temp_dir2.path().AppendASCII("applications")
.AppendASCII(kTemplateFilename),
kTestData2, strlen(kTestData2)));
@@ -399,14 +399,14 @@ TEST(ShellIntegrationTest, GetExistingProfileShortcutFilenames) {
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
ASSERT_EQ(0,
- file_util::WriteFile(
+ base::WriteFile(
temp_dir.path().AppendASCII(kApp1Filename), "", 0));
ASSERT_EQ(0,
- file_util::WriteFile(
+ base::WriteFile(
temp_dir.path().AppendASCII(kApp2Filename), "", 0));
// This file should not be returned in the results.
ASSERT_EQ(0,
- file_util::WriteFile(
+ base::WriteFile(
temp_dir.path().AppendASCII(kUnrelatedAppFilename), "", 0));
std::vector<base::FilePath> paths =
ShellIntegrationLinux::GetExistingProfileShortcutFilenames(
diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc b/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc
index 9323be7..1011242 100644
--- a/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc
+++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc
@@ -226,7 +226,7 @@ TEST_F(SpellcheckCustomDictionaryTest, LegacyEmptyDictionaryShouldBeConverted) {
profile_.GetPath().Append(chrome::kCustomDictionaryFileName);
std::string content;
- file_util::WriteFile(path, content.c_str(), content.length());
+ base::WriteFile(path, content.c_str(), content.length());
WordList loaded_custom_words = LoadDictionaryFile(path);
EXPECT_TRUE(loaded_custom_words.empty());
}
@@ -239,7 +239,7 @@ TEST_F(SpellcheckCustomDictionaryTest,
profile_.GetPath().Append(chrome::kCustomDictionaryFileName);
std::string content = "foo\nbar\nfoo\n";
- file_util::WriteFile(path, content.c_str(), content.length());
+ base::WriteFile(path, content.c_str(), content.length());
WordList loaded_custom_words = LoadDictionaryFile(path);
WordList expected;
expected.push_back("bar");
@@ -257,7 +257,7 @@ TEST_F(SpellcheckCustomDictionaryTest,
std::string content = "foo\n foo bar \n\n \nbar\n"
"01234567890123456789012345678901234567890123456789"
"01234567890123456789012345678901234567890123456789";
- file_util::WriteFile(path, content.c_str(), content.length());
+ base::WriteFile(path, content.c_str(), content.length());
WordList loaded_custom_words = LoadDictionaryFile(path);
WordList expected;
expected.push_back("bar");
@@ -274,7 +274,7 @@ TEST_F(SpellcheckCustomDictionaryTest, CorruptedWriteShouldBeRecovered) {
profile_.GetPath().Append(chrome::kCustomDictionaryFileName);
std::string content = "foo\nbar";
- file_util::WriteFile(path, content.c_str(), content.length());
+ base::WriteFile(path, content.c_str(), content.length());
WordList loaded_custom_words = LoadDictionaryFile(path);
WordList expected;
expected.push_back("bar");
@@ -287,7 +287,7 @@ TEST_F(SpellcheckCustomDictionaryTest, CorruptedWriteShouldBeRecovered) {
content.clear();
base::ReadFileToString(path, &content);
content.append("corruption");
- file_util::WriteFile(path, content.c_str(), content.length());
+ base::WriteFile(path, content.c_str(), content.length());
loaded_custom_words = LoadDictionaryFile(path);
EXPECT_EQ(expected, loaded_custom_words);
}
diff --git a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc
index 6cc0fa2..003477d 100644
--- a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc
+++ b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc
@@ -133,7 +133,7 @@ bool SaveDictionaryData(scoped_ptr<std::string> data,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
size_t bytes_written =
- file_util::WriteFile(path, data->data(), data->length());
+ base::WriteFile(path, data->data(), data->length());
if (bytes_written != data->length()) {
bool success = false;
#if defined(OS_WIN)
@@ -142,7 +142,7 @@ bool SaveDictionaryData(scoped_ptr<std::string> data,
base::FilePath fallback_file_path =
dict_dir.Append(path.BaseName());
bytes_written =
- file_util::WriteFile(fallback_file_path, data->data(), data->length());
+ base::WriteFile(fallback_file_path, data->data(), data->length());
if (bytes_written == data->length())
success = true;
#endif
diff --git a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc
index 3d82910..ab49c94 100644
--- a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc
+++ b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc
@@ -50,7 +50,7 @@ IN_PROC_BROWSER_TEST_F(SpellcheckServiceBrowserTest, DeleteCorruptedBDICT) {
base::FilePath bdict_path =
chrome::spellcheck_common::GetVersionedFileName("en-US", dict_dir);
- size_t actual = file_util::WriteFile(bdict_path,
+ size_t actual = base::WriteFile(bdict_path,
reinterpret_cast<const char*>(kCorruptedBDICT),
arraysize(kCorruptedBDICT));
EXPECT_EQ(arraysize(kCorruptedBDICT), actual);
diff --git a/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc b/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc
index 2154721..483d53b 100644
--- a/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc
+++ b/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc
@@ -697,7 +697,7 @@ TEST_F(SyncBackendHostTest, TestStartupWithOldSyncData) {
profile_->GetPath().AppendASCII("Sync Data");
base::FilePath sync_file = temp_directory.AppendASCII("SyncData.sqlite3");
ASSERT_TRUE(base::CreateDirectory(temp_directory));
- ASSERT_NE(-1, file_util::WriteFile(sync_file, nonsense, strlen(nonsense)));
+ ASSERT_NE(-1, base::WriteFile(sync_file, nonsense, strlen(nonsense)));
InitializeBackend(true);
diff --git a/chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc b/chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc
index 76d5d5a..b234bbf 100644
--- a/chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc
+++ b/chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc
@@ -344,7 +344,7 @@ base::FilePath FakeDriveServiceHelper::WriteToTempFile(
base::FilePath temp_file;
EXPECT_TRUE(base::CreateTemporaryFileInDir(temp_dir_, &temp_file));
EXPECT_EQ(static_cast<int>(content.size()),
- file_util::WriteFile(temp_file, content.data(), content.size()));
+ base::WriteFile(temp_file, content.data(), content.size()));
return temp_file;
}
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc
index 8c8a02e..a532037 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc
@@ -801,11 +801,11 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForAddOrUpdate) {
const base::FilePath kFilePath2(temp_dir.path().Append(FPL("file2")));
ASSERT_EQ(static_cast<int>(arraysize(kTestFileData1) - 1),
- file_util::WriteFile(kFilePath1, kTestFileData1,
- arraysize(kTestFileData1) - 1));
+ base::WriteFile(kFilePath1, kTestFileData1,
+ arraysize(kTestFileData1) - 1));
ASSERT_EQ(static_cast<int>(arraysize(kTestFileData2) - 1),
- file_util::WriteFile(kFilePath2, kTestFileData2,
- arraysize(kTestFileData2) - 1));
+ base::WriteFile(kFilePath2, kTestFileData2,
+ arraysize(kTestFileData2) - 1));
// Record the usage.
int64 usage = -1, new_usage = -1;
@@ -932,8 +932,8 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForAddOrUpdate_NoParent) {
// Prepare a temporary file which represents remote file data.
const base::FilePath kFilePath(temp_dir.path().Append(FPL("file")));
ASSERT_EQ(static_cast<int>(arraysize(kTestFileData) - 1),
- file_util::WriteFile(kFilePath, kTestFileData,
- arraysize(kTestFileData) - 1));
+ base::WriteFile(kFilePath, kTestFileData,
+ arraysize(kTestFileData) - 1));
// Calling ApplyChange's with kFilePath should create
// kFile along with kDir.
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc
index d68ddae..7bfe283 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc
@@ -218,7 +218,7 @@ TEST_F(LocalFileSyncServiceTest, RemoteSyncStepsSimple) {
base::FilePath local_path;
ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &local_path));
ASSERT_EQ(kTestFileDataSize,
- file_util::WriteFile(local_path, kTestFileData, kTestFileDataSize));
+ base::WriteFile(local_path, kTestFileData, kTestFileDataSize));
// Run PrepareForProcessRemoteChange for kFile.
SyncFileMetadata expected_metadata;
diff --git a/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc b/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc
index 51f9dd7..0415698 100644
--- a/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc
+++ b/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc
@@ -355,7 +355,7 @@ TEST_F(SyncableFileOperationRunnerTest, CopyInForeignFile) {
base::FilePath temp_path;
ASSERT_TRUE(CreateTempFile(&temp_path));
ASSERT_EQ(static_cast<int>(kTestData.size()),
- file_util::WriteFile(
+ base::WriteFile(
temp_path, kTestData.data(), kTestData.size()));
sync_status()->StartSyncing(URL(kFile));
diff --git a/chrome/browser/task_profiler/task_profiler_data_serializer.cc b/chrome/browser/task_profiler/task_profiler_data_serializer.cc
index 8dc34f5..b52cc25 100644
--- a/chrome/browser/task_profiler/task_profiler_data_serializer.cc
+++ b/chrome/browser/task_profiler/task_profiler_data_serializer.cc
@@ -164,7 +164,7 @@ bool TaskProfilerDataSerializer::WriteToFile(const base::FilePath& path) {
serializer.Serialize(*root);
int data_size = static_cast<int>(output.size());
- return data_size == file_util::WriteFile(path, output.data(), data_size);
+ return data_size == base::WriteFile(path, output.data(), data_size);
}
} // namespace task_profiler
diff --git a/chrome/browser/ui/app_list/search/history_data_store_unittest.cc b/chrome/browser/ui/app_list/search/history_data_store_unittest.cc
index 3d71554..a831b30 100644
--- a/chrome/browser/ui/app_list/search/history_data_store_unittest.cc
+++ b/chrome/browser/ui/app_list/search/history_data_store_unittest.cc
@@ -72,7 +72,7 @@ class HistoryDataStoreTest : public testing::Test {
void WriteDataFile(const std::string& file_name,
const std::string& data) {
- file_util::WriteFile(
+ base::WriteFile(
temp_dir_.path().AppendASCII(file_name), data.c_str(), data.size());
}
diff --git a/chrome/browser/ui/ash/screenshot_taker.cc b/chrome/browser/ui/ash/screenshot_taker.cc
index e0fecd4..4c5f72d 100644
--- a/chrome/browser/ui/ash/screenshot_taker.cc
+++ b/chrome/browser/ui/ash/screenshot_taker.cc
@@ -192,7 +192,7 @@ void SaveScreenshotInternal(const ShowNotificationCallback& callback,
DCHECK(!local_path.empty());
ScreenshotTakerObserver::Result result =
ScreenshotTakerObserver::SCREENSHOT_SUCCESS;
- if (static_cast<size_t>(file_util::WriteFile(
+ if (static_cast<size_t>(base::WriteFile(
local_path,
reinterpret_cast<char*>(&(png_data->data()[0])),
png_data->size())) != png_data->size()) {
diff --git a/chrome/browser/ui/certificate_dialogs.cc b/chrome/browser/ui/certificate_dialogs.cc
index cb32713..0712dd7 100644
--- a/chrome/browser/ui/certificate_dialogs.cc
+++ b/chrome/browser/ui/certificate_dialogs.cc
@@ -25,7 +25,7 @@ using content::WebContents;
namespace {
void WriterCallback(const base::FilePath& path, const std::string& data) {
- int bytes_written = file_util::WriteFile(path, data.data(), data.size());
+ int bytes_written = base::WriteFile(path, data.data(), data.size());
if (bytes_written != static_cast<ssize_t>(data.size())) {
LOG(ERROR) << "Writing " << path.value() << " ("
<< data.size() << "B) returned " << bytes_written;
diff --git a/chrome/browser/ui/libgtk2ui/app_indicator_icon.cc b/chrome/browser/ui/libgtk2ui/app_indicator_icon.cc
index 097a8fc..1586288 100644
--- a/chrome/browser/ui/libgtk2ui/app_indicator_icon.cc
+++ b/chrome/browser/ui/libgtk2ui/app_indicator_icon.cc
@@ -144,9 +144,8 @@ base::FilePath CreateTempImageFile(gfx::ImageSkia* image_ptr,
new_file_path =
temp_dir.Append(id + base::StringPrintf("_%d.png", icon_change_count));
int bytes_written =
- file_util::WriteFile(new_file_path,
- png_data->front_as<char>(),
- png_data->size());
+ base::WriteFile(new_file_path,
+ png_data->front_as<char>(), png_data->size());
if (bytes_written != static_cast<int>(png_data->size()))
return base::FilePath();
diff --git a/chrome/browser/ui/metro_pin_tab_helper_win.cc b/chrome/browser/ui/metro_pin_tab_helper_win.cc
index 10736d9..15a47e2 100644
--- a/chrome/browser/ui/metro_pin_tab_helper_win.cc
+++ b/chrome/browser/ui/metro_pin_tab_helper_win.cc
@@ -108,9 +108,9 @@ bool CreateSiteSpecificLogo(const SkBitmap& bitmap,
return false;
*logo_path = logo_dir.Append(tile_id).ReplaceExtension(L".png");
- return file_util::WriteFile(*logo_path,
- reinterpret_cast<char*>(&logo_png[0]),
- logo_png.size()) > 0;
+ return base::WriteFile(*logo_path,
+ reinterpret_cast<char*>(&logo_png[0]),
+ logo_png.size()) > 0;
}
// Get the path to the backup logo. If the backup logo already exists in
diff --git a/chrome/browser/ui/network_profile_bubble.cc b/chrome/browser/ui/network_profile_bubble.cc
index 7e3d385..b611d59b 100644
--- a/chrome/browser/ui/network_profile_bubble.cc
+++ b/chrome/browser/ui/network_profile_bubble.cc
@@ -127,7 +127,7 @@ void NetworkProfileBubble::CheckNetworkProfile(
// Try to create some non-empty temp file in the profile dir and use
// it to check if there is a reparse-point free path to it.
if (base::CreateTemporaryFileInDir(profile_folder, &temp_file) &&
- (file_util::WriteFile(temp_file, ".", 1) == 1)) {
+ (base::WriteFile(temp_file, ".", 1) == 1)) {
base::FilePath normalized_temp_file;
if (!base::NormalizeFilePath(temp_file, &normalized_temp_file))
profile_on_network = true;
diff --git a/chrome/browser/ui/pdf/pdf_browsertest.cc b/chrome/browser/ui/pdf/pdf_browsertest.cc
index aeb9683..cceea4b 100644
--- a/chrome/browser/ui/pdf/pdf_browsertest.cc
+++ b/chrome/browser/ui/pdf/pdf_browsertest.cc
@@ -186,7 +186,7 @@ class PDFBrowserTest : public InProcessBrowserTest,
std::vector<unsigned char> png_data;
gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_data);
if (base::CreateTemporaryFile(&snapshot_filename_)) {
- file_util::WriteFile(snapshot_filename_,
+ base::WriteFile(snapshot_filename_,
reinterpret_cast<char*>(&png_data[0]), png_data.size());
}
}
diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc
index 703e136..b9400c2 100644
--- a/chrome/browser/ui/startup/startup_browser_creator.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -240,8 +240,8 @@ void DumpBrowserHistograms(const base::FilePath& output_file) {
base::ThreadRestrictions::AssertIOAllowed();
std::string output_string(base::StatisticsRecorder::ToJSON(std::string()));
- file_util::WriteFile(output_file, output_string.data(),
- static_cast<int>(output_string.size()));
+ base::WriteFile(output_file, output_string.data(),
+ static_cast<int>(output_string.size()));
}
} // namespace
diff --git a/chrome/browser/ui/webui/options/certificate_manager_handler.cc b/chrome/browser/ui/webui/options/certificate_manager_handler.cc
index 4034c70..2b7481a 100644
--- a/chrome/browser/ui/webui/options/certificate_manager_handler.cc
+++ b/chrome/browser/ui/webui/options/certificate_manager_handler.cc
@@ -282,7 +282,7 @@ void FileAccessProvider::DoWrite(const base::FilePath& path,
const std::string& data,
int* saved_errno,
int* bytes_written) {
- *bytes_written = file_util::WriteFile(path, data.data(), data.size());
+ *bytes_written = base::WriteFile(path, data.data(), data.size());
*saved_errno = *bytes_written >= 0 ? 0 : errno;
}
diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm
index fb576d4..ba8e4f6 100644
--- a/chrome/browser/web_applications/web_app_mac.mm
+++ b/chrome/browser/web_applications/web_app_mac.mm
@@ -145,7 +145,7 @@ base::FilePath GetWritableApplicationsDirectory() {
// Create a zero-byte ".localized" file to inherit localizations from OSX
// for folders that have special meaning.
- file_util::WriteFile(path.Append(".localized"), NULL, 0);
+ base::WriteFile(path.Append(".localized"), NULL, 0);
}
return base::PathIsWritable(path) ? path : base::FilePath();
}
diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc
index dc7a7ef..1cf4800 100644
--- a/chrome/browser/web_applications/web_app_win.cc
+++ b/chrome/browser/web_applications/web_app_win.cc
@@ -64,9 +64,9 @@ bool SaveIconWithCheckSum(const base::FilePath& icon_file,
GetImageCheckSum(image, &digest);
base::FilePath cheksum_file(icon_file.ReplaceExtension(kIconChecksumFileExt));
- return file_util::WriteFile(cheksum_file,
- reinterpret_cast<const char*>(&digest),
- sizeof(digest)) == sizeof(digest);
+ return base::WriteFile(cheksum_file,
+ reinterpret_cast<const char*>(&digest),
+ sizeof(digest)) == sizeof(digest);
}
// Returns true if |icon_file| is missing or different from |image|.
diff --git a/chrome/common/auto_start_linux.cc b/chrome/common/auto_start_linux.cc
index c9c3fcc..42d02a0 100644
--- a/chrome/common/auto_start_linux.cc
+++ b/chrome/common/auto_start_linux.cc
@@ -47,8 +47,8 @@ bool AutoStart::AddApplication(const std::string& autostart_filename,
"Exec=" + command_line + "\n"
"Name=" + application_name + "\n";
std::string::size_type content_length = autostart_file_contents.length();
- if (file_util::WriteFile(autostart_file, autostart_file_contents.c_str(),
- content_length) !=
+ if (base::WriteFile(autostart_file, autostart_file_contents.c_str(),
+ content_length) !=
static_cast<int>(content_length)) {
base::DeleteFile(autostart_file, false);
return false;
diff --git a/chrome/common/extensions/api/storage/storage_schema_manifest_handler_unittest.cc b/chrome/common/extensions/api/storage/storage_schema_manifest_handler_unittest.cc
index 10300f3..29d27f8 100644
--- a/chrome/common/extensions/api/storage/storage_schema_manifest_handler_unittest.cc
+++ b/chrome/common/extensions/api/storage/storage_schema_manifest_handler_unittest.cc
@@ -46,7 +46,7 @@ class StorageSchemaManifestHandlerTest : public testing::Test {
if (schema.empty()) {
base::DeleteFile(schema_path, false);
} else {
- if (file_util::WriteFile(schema_path, schema.data(), schema.size()) !=
+ if (base::WriteFile(schema_path, schema.data(), schema.size()) !=
static_cast<int>(schema.size())) {
return NULL;
}
diff --git a/chrome/common/extensions/extension_file_util_unittest.cc b/chrome/common/extensions/extension_file_util_unittest.cc
index 5258847..ff5595f 100644
--- a/chrome/common/extensions/extension_file_util_unittest.cc
+++ b/chrome/common/extensions/extension_file_util_unittest.cc
@@ -143,8 +143,8 @@ TEST_F(ExtensionFileUtilTest, CheckIllegalFilenamesNoUnderscores) {
ASSERT_TRUE(base::CreateDirectory(src_path));
std::string data = "{ \"name\": { \"message\": \"foobar\" } }";
- ASSERT_TRUE(file_util::WriteFile(src_path.AppendASCII("some_file.txt"),
- data.c_str(), data.length()));
+ ASSERT_TRUE(base::WriteFile(src_path.AppendASCII("some_file.txt"),
+ data.c_str(), data.length()));
std::string error;
EXPECT_TRUE(extension_file_util::CheckForIllegalFilenames(temp.path(),
&error));
@@ -272,7 +272,7 @@ TEST_F(ExtensionFileUtilTest, ValidateThemeUTF8) {
std::string non_ascii_file = "\xC3\xA0\xC3\xA8\xC3\xB2.png";
base::FilePath non_ascii_path =
temp.path().Append(base::FilePath::FromUTF8Unsafe(non_ascii_file));
- file_util::WriteFile(non_ascii_path, "", 0);
+ base::WriteFile(non_ascii_path, "", 0);
std::string kManifest =
base::StringPrintf(
@@ -361,16 +361,16 @@ TEST_F(ExtensionFileUtilTest, FindPrivateKeyFiles) {
base::FilePath src_path = temp.path().AppendASCII("some_dir");
ASSERT_TRUE(base::CreateDirectory(src_path));
- ASSERT_TRUE(file_util::WriteFile(src_path.AppendASCII("a_key.pem"),
- private_key, arraysize(private_key)));
- ASSERT_TRUE(file_util::WriteFile(src_path.AppendASCII("second_key.pem"),
- private_key, arraysize(private_key)));
+ ASSERT_TRUE(base::WriteFile(src_path.AppendASCII("a_key.pem"),
+ private_key, arraysize(private_key)));
+ ASSERT_TRUE(base::WriteFile(src_path.AppendASCII("second_key.pem"),
+ private_key, arraysize(private_key)));
// Shouldn't find a key with a different extension.
- ASSERT_TRUE(file_util::WriteFile(src_path.AppendASCII("key.diff_ext"),
- private_key, arraysize(private_key)));
+ ASSERT_TRUE(base::WriteFile(src_path.AppendASCII("key.diff_ext"),
+ private_key, arraysize(private_key)));
// Shouldn't find a key that isn't parsable.
- ASSERT_TRUE(file_util::WriteFile(src_path.AppendASCII("unparsable_key.pem"),
- private_key, arraysize(private_key) - 30));
+ ASSERT_TRUE(base::WriteFile(src_path.AppendASCII("unparsable_key.pem"),
+ private_key, arraysize(private_key) - 30));
std::vector<base::FilePath> private_keys =
extension_file_util::FindPrivateKeyFiles(temp.path());
EXPECT_EQ(2U, private_keys.size());
@@ -394,10 +394,10 @@ TEST_F(ExtensionFileUtilTest, WarnOnPrivateKey) {
" \"manifest_version\": 2,\n"
" \"description\": \"The first extension that I made.\"\n"
"}\n";
- ASSERT_TRUE(file_util::WriteFile(ext_path.AppendASCII("manifest.json"),
- manifest, strlen(manifest)));
- ASSERT_TRUE(file_util::WriteFile(ext_path.AppendASCII("a_key.pem"),
- private_key, strlen(private_key)));
+ ASSERT_TRUE(base::WriteFile(ext_path.AppendASCII("manifest.json"),
+ manifest, strlen(manifest)));
+ ASSERT_TRUE(base::WriteFile(ext_path.AppendASCII("a_key.pem"),
+ private_key, strlen(private_key)));
std::string error;
scoped_refptr<Extension> extension(extension_file_util::LoadExtension(
diff --git a/chrome/common/extensions/extension_l10n_util_unittest.cc b/chrome/common/extensions/extension_l10n_util_unittest.cc
index 74f4645..c5ed18a 100644
--- a/chrome/common/extensions/extension_l10n_util_unittest.cc
+++ b/chrome/common/extensions/extension_l10n_util_unittest.cc
@@ -39,7 +39,7 @@ TEST(ExtensionL10nUtil, ValidateLocalesWithBadLocale) {
base::FilePath messages_file = locale.Append(kMessagesFilename);
std::string data = "{ \"name\":";
- ASSERT_TRUE(file_util::WriteFile(messages_file, data.c_str(), data.length()));
+ ASSERT_TRUE(base::WriteFile(messages_file, data.c_str(), data.length()));
base::DictionaryValue manifest;
manifest.SetString(keys::kDefaultLocale, "en");
@@ -94,7 +94,7 @@ TEST(ExtensionL10nUtil, GetValidLocalesWithUnsupportedLocale) {
base::FilePath locale_1 = src_path.AppendASCII("sr");
ASSERT_TRUE(base::CreateDirectory(locale_1));
std::string data("whatever");
- ASSERT_TRUE(file_util::WriteFile(
+ ASSERT_TRUE(base::WriteFile(
locale_1.Append(kMessagesFilename),
data.c_str(), data.length()));
// Unsupported locale.
@@ -187,7 +187,7 @@ TEST(ExtensionL10nUtil, LoadMessageCatalogsBadJSONFormat) {
std::string data = "{ \"name\":";
base::FilePath messages_file = locale.Append(kMessagesFilename);
- ASSERT_TRUE(file_util::WriteFile(messages_file, data.c_str(), data.length()));
+ ASSERT_TRUE(base::WriteFile(messages_file, data.c_str(), data.length()));
std::set<std::string> valid_locales;
valid_locales.insert("sr");
@@ -219,16 +219,14 @@ TEST(ExtensionL10nUtil, LoadMessageCatalogsDuplicateKeys) {
std::string data =
"{ \"name\": { \"message\": \"something\" }, "
"\"name\": { \"message\": \"something else\" } }";
- ASSERT_TRUE(
- file_util::WriteFile(locale_1.Append(kMessagesFilename),
- data.c_str(), data.length()));
+ ASSERT_TRUE(base::WriteFile(locale_1.Append(kMessagesFilename),
+ data.c_str(), data.length()));
base::FilePath locale_2 = src_path.AppendASCII("sr");
ASSERT_TRUE(base::CreateDirectory(locale_2));
- ASSERT_TRUE(
- file_util::WriteFile(locale_2.Append(kMessagesFilename),
- data.c_str(), data.length()));
+ ASSERT_TRUE(base::WriteFile(locale_2.Append(kMessagesFilename),
+ data.c_str(), data.length()));
std::set<std::string> valid_locales;
valid_locales.insert("sr");
diff --git a/chrome/common/importer/firefox_importer_utils_unittest.cc b/chrome/common/importer/firefox_importer_utils_unittest.cc
index 7d3468d..987b0e9 100644
--- a/chrome/common/importer/firefox_importer_utils_unittest.cc
+++ b/chrome/common/importer/firefox_importer_utils_unittest.cc
@@ -107,9 +107,9 @@ TEST(FirefoxImporterUtilsTest, GetFirefoxImporterName) {
const base::FilePath app_ini_file(
temp_dir.path().AppendASCII("application.ini"));
for (size_t i = 0; i < arraysize(GetFirefoxImporterNameCases); ++i) {
- file_util::WriteFile(app_ini_file,
- GetFirefoxImporterNameCases[i].app_ini_content.c_str(),
- GetFirefoxImporterNameCases[i].app_ini_content.size());
+ base::WriteFile(app_ini_file,
+ GetFirefoxImporterNameCases[i].app_ini_content.c_str(),
+ GetFirefoxImporterNameCases[i].app_ini_content.size());
EXPECT_EQ(GetFirefoxImporterName(temp_dir.path()),
l10n_util::GetStringUTF16(GetFirefoxImporterNameCases[i].resource_id));
}
diff --git a/chrome/common/mac/mock_launchd.cc b/chrome/common/mac/mock_launchd.cc
index 63975fe..10494a0 100644
--- a/chrome/common/mac/mock_launchd.cc
+++ b/chrome/common/mac/mock_launchd.cc
@@ -42,7 +42,7 @@ bool MockLaunchd::MakeABundle(const base::FilePath& dst,
}
const char *data = "#! testbundle\n";
int len = strlen(data);
- if (file_util::WriteFile(*executable, data, len) != len) {
+ if (base::WriteFile(*executable, data, len) != len) {
return false;
}
if (chmod(executable->value().c_str(), 0555) != 0) {
@@ -77,7 +77,7 @@ bool MockLaunchd::MakeABundle(const base::FilePath& dst,
name.c_str(),
version_info.Version().c_str());
len = info_plist_data.length();
- if (file_util::WriteFile(info_plist, info_plist_data.c_str(), len) != len) {
+ if (base::WriteFile(info_plist, info_plist_data.c_str(), len) != len) {
return false;
}
const UInt8* bundle_root_path =
diff --git a/chrome/common/media_galleries/picasa_test_util.cc b/chrome/common/media_galleries/picasa_test_util.cc
index d998075..de926fa9 100644
--- a/chrome/common/media_galleries/picasa_test_util.cc
+++ b/chrome/common/media_galleries/picasa_test_util.cc
@@ -99,17 +99,17 @@ void WriteTestAlbumsImagesIndex(const base::FilePath& test_folder_1_path,
"[InSecondAlbumOnly.jpg]\n"
"albums=uid5\n";
ASSERT_TRUE(
- file_util::WriteFile(test_folder_1_path.AppendASCII(kPicasaINIFilename),
- folder_1_test_ini,
- arraysize(folder_1_test_ini)));
+ base::WriteFile(test_folder_1_path.AppendASCII(kPicasaINIFilename),
+ folder_1_test_ini,
+ arraysize(folder_1_test_ini)));
const char folder_2_test_ini[] =
"[InFirstAlbumOnly.jpg]\n"
"albums=uid3\n";
ASSERT_TRUE(
- file_util::WriteFile(test_folder_2_path.AppendASCII(kPicasaINIFilename),
- folder_2_test_ini,
- arraysize(folder_2_test_ini)));
+ base::WriteFile(test_folder_2_path.AppendASCII(kPicasaINIFilename),
+ folder_2_test_ini,
+ arraysize(folder_2_test_ini)));
}
} // namespace picasa
diff --git a/chrome/common/media_galleries/pmp_test_util.cc b/chrome/common/media_galleries/pmp_test_util.cc
index b06e341..6caa6b6 100644
--- a/chrome/common/media_galleries/pmp_test_util.cc
+++ b/chrome/common/media_galleries/pmp_test_util.cc
@@ -61,7 +61,7 @@ bool PmpTestUtil::WriteIndicatorFile(
base::FilePath indicator_path = column_file_destination.Append(
base::FilePath::FromUTF8Unsafe(table_name + "_0"));
- return file_util::WriteFile(indicator_path, NULL, 0) == 0;
+ return base::WriteFile(indicator_path, NULL, 0) == 0;
}
template<class T>
@@ -78,7 +78,7 @@ bool PmpTestUtil::WriteColumnFileFromVector(
std::vector<char> data = PmpTestUtil::MakeHeaderAndBody(
field_type, elements_vector.size(), elements_vector);
- size_t bytes_written = file_util::WriteFile(path, &data[0], data.size());
+ size_t bytes_written = base::WriteFile(path, &data[0], data.size());
return (bytes_written == data.size());
}
diff --git a/chrome/common/net/url_fixer_upper_unittest.cc b/chrome/common/net/url_fixer_upper_unittest.cc
index 46d41c6..a6d4cce 100644
--- a/chrome/common/net/url_fixer_upper_unittest.cc
+++ b/chrome/common/net/url_fixer_upper_unittest.cc
@@ -225,7 +225,7 @@ static bool MakeTempFile(const base::FilePath& dir,
const base::FilePath& file_name,
base::FilePath* full_path) {
*full_path = dir.Append(file_name);
- return file_util::WriteFile(*full_path, "", 0) == 0;
+ return base::WriteFile(*full_path, "", 0) == 0;
}
// Returns true if the given URL is a file: URL that matches the given file
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index 3aed444..dbf2581 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -352,7 +352,7 @@ bool CreateVisualElementsManifest(const base::FilePath& src_path,
// Write the manifest to |src_path|.
const std::string manifest(UTF16ToUTF8(manifest16));
int size = base::checked_cast<int>(manifest.size());
- if (file_util::WriteFile(
+ if (base::WriteFile(
src_path.Append(installer::kVisualElementsManifest),
manifest.c_str(), size) == size) {
VLOG(1) << "Successfully wrote " << installer::kVisualElementsManifest
diff --git a/chrome/installer/setup/install_unittest.cc b/chrome/installer/setup/install_unittest.cc
index 99337d0..10fe418 100644
--- a/chrome/installer/setup/install_unittest.cc
+++ b/chrome/installer/setup/install_unittest.cc
@@ -76,7 +76,7 @@ class InstallShortcutTest : public testing::Test {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
chrome_exe_ = temp_dir_.path().Append(installer::kChromeExe);
- EXPECT_EQ(0, file_util::WriteFile(chrome_exe_, "", 0));
+ EXPECT_EQ(0, base::WriteFile(chrome_exe_, "", 0));
ShellUtil::ShortcutProperties chrome_properties(ShellUtil::CURRENT_USER);
product_->AddDefaultShortcutProperties(chrome_exe_, &chrome_properties);
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index 0a4b615c..69a2e93 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -860,7 +860,7 @@ bool CreateEULASentinel(BrowserDistribution* dist) {
}
return (base::CreateDirectory(eula_sentinel.DirName()) &&
- file_util::WriteFile(eula_sentinel, "", 0) != -1);
+ base::WriteFile(eula_sentinel, "", 0) != -1);
}
void ActivateMetroChrome() {
diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc
index c08e2b7..7f58d89 100644
--- a/chrome/installer/setup/setup_util_unittest.cc
+++ b/chrome/installer/setup/setup_util_unittest.cc
@@ -137,7 +137,7 @@ TEST_F(SetupUtilTestWithDir, DeleteFileFromTempProcess) {
base::FilePath test_file;
base::CreateTemporaryFileInDir(test_dir_.path(), &test_file);
ASSERT_TRUE(base::PathExists(test_file));
- file_util::WriteFile(test_file, "foo", 3);
+ base::WriteFile(test_file, "foo", 3);
EXPECT_TRUE(installer::DeleteFileFromTempProcess(test_file, 0));
base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(200));
EXPECT_FALSE(base::PathExists(test_file));
@@ -307,10 +307,10 @@ class FindArchiveToPatchTest : public SetupUtilTestWithDir {
// Create archives in the two version dirs.
ASSERT_TRUE(
base::CreateDirectory(GetProductVersionArchivePath().DirName()));
- ASSERT_EQ(1, file_util::WriteFile(GetProductVersionArchivePath(), "a", 1));
+ ASSERT_EQ(1, base::WriteFile(GetProductVersionArchivePath(), "a", 1));
ASSERT_TRUE(
base::CreateDirectory(GetMaxVersionArchivePath().DirName()));
- ASSERT_EQ(1, file_util::WriteFile(GetMaxVersionArchivePath(), "b", 1));
+ ASSERT_EQ(1, base::WriteFile(GetMaxVersionArchivePath(), "b", 1));
}
virtual void TearDown() OVERRIDE {
diff --git a/chrome/installer/test/alternate_version_generator.cc b/chrome/installer/test/alternate_version_generator.cc
index aaeb3c2..774ee4f 100644
--- a/chrome/installer/test/alternate_version_generator.cc
+++ b/chrome/installer/test/alternate_version_generator.cc
@@ -543,9 +543,9 @@ bool GenerateAlternateVersion(const base::FilePath& original_installer_path,
if (!resource_loader.Load(&kSetupEx_[0], &kBl[0], &resource_data))
return false;
int written =
- file_util::WriteFile(setup_ex_,
- reinterpret_cast<const char*>(resource_data.first),
- static_cast<int>(resource_data.second));
+ base::WriteFile(setup_ex_,
+ reinterpret_cast<const char*>(resource_data.first),
+ static_cast<int>(resource_data.second));
if (written != resource_data.second) {
LOG(DFATAL) << "Failed writing \"" << setup_ex_.value() << "\"";
return false;
@@ -555,9 +555,9 @@ bool GenerateAlternateVersion(const base::FilePath& original_installer_path,
if (!resource_loader.Load(&kChromePacked7z[0], &kB7[0], &resource_data))
return false;
written =
- file_util::WriteFile(chrome_packed_7z,
- reinterpret_cast<const char*>(resource_data.first),
- static_cast<int>(resource_data.second));
+ base::WriteFile(chrome_packed_7z,
+ reinterpret_cast<const char*>(resource_data.first),
+ static_cast<int>(resource_data.second));
if (written != resource_data.second) {
LOG(DFATAL) << "Failed writing \"" << chrome_packed_7z.value() << "\"";
return false;
diff --git a/chrome/installer/util/install_util_unittest.cc b/chrome/installer/util/install_util_unittest.cc
index 9d37df5..f1234b8 100644
--- a/chrome/installer/util/install_util_unittest.cc
+++ b/chrome/installer/util/install_util_unittest.cc
@@ -417,7 +417,7 @@ TEST_F(InstallUtilTest, ProgramCompare) {
// Tests where the expected file exists.
static const char data[] = "data";
ASSERT_TRUE(base::CreateDirectory(some_long_dir));
- ASSERT_NE(-1, file_util::WriteFile(expect, data, arraysize(data) - 1));
+ ASSERT_NE(-1, base::WriteFile(expect, data, arraysize(data) - 1));
// Paths don't match.
EXPECT_FALSE(InstallUtil::ProgramCompare(expect).Evaluate(
L"\"" + other.value() + L"\""));
diff --git a/chrome/installer/util/logging_installer.cc b/chrome/installer/util/logging_installer.cc
index 75f3bc9..18a734e 100644
--- a/chrome/installer/util/logging_installer.cc
+++ b/chrome/installer/util/logging_installer.cc
@@ -54,9 +54,8 @@ TruncateResult TruncateLogFileIfNeeded(const base::FilePath& log_file) {
&old_log_data[0],
kTruncatedInstallerLogFileSize);
if (bytes_read > 0 &&
- (bytes_read == file_util::WriteFile(log_file,
- &old_log_data[0],
- bytes_read) ||
+ (bytes_read == base::WriteFile(log_file, &old_log_data[0],
+ bytes_read) ||
base::PathExists(log_file))) {
result = LOGFILE_TRUNCATED;
}
diff --git a/chrome/installer/util/logging_installer_unittest.cc b/chrome/installer/util/logging_installer_unittest.cc
index ccd080b..19eef2f 100644
--- a/chrome/installer/util/logging_installer_unittest.cc
+++ b/chrome/installer/util/logging_installer_unittest.cc
@@ -20,7 +20,7 @@ TEST(LoggingInstallerTest, TestTruncate) {
base::FilePath temp_file = temp_dir.path().Append(L"temp");
EXPECT_EQ(test_data.size(),
- file_util::WriteFile(temp_file, &test_data[0], test_data.size()));
+ base::WriteFile(temp_file, &test_data[0], test_data.size()));
ASSERT_TRUE(base::PathExists(temp_file));
int64 file_size = 0;
@@ -45,7 +45,7 @@ TEST(LoggingInstallerTest, TestTruncationNotNeeded) {
base::FilePath temp_file = temp_dir.path().Append(L"temp");
EXPECT_EQ(test_data.size(),
- file_util::WriteFile(temp_file, &test_data[0], test_data.size()));
+ base::WriteFile(temp_file, &test_data[0], test_data.size()));
ASSERT_TRUE(base::PathExists(temp_file));
int64 file_size = 0;
@@ -67,7 +67,7 @@ TEST(LoggingInstallerTest, TestInUseNeedsTruncation) {
base::FilePath temp_file = temp_dir.path().Append(L"temp");
EXPECT_EQ(test_data.size(),
- file_util::WriteFile(temp_file, &test_data[0], test_data.size()));
+ base::WriteFile(temp_file, &test_data[0], test_data.size()));
ASSERT_TRUE(base::PathExists(temp_file));
int64 file_size = 0;
EXPECT_TRUE(base::GetFileSize(temp_file, &file_size));
@@ -95,7 +95,7 @@ TEST(LoggingInstallerTest, TestMoveFailsNeedsTruncation) {
base::FilePath temp_file = temp_dir.path().Append(L"temp");
EXPECT_EQ(test_data.size(),
- file_util::WriteFile(temp_file, &test_data[0], test_data.size()));
+ base::WriteFile(temp_file, &test_data[0], test_data.size()));
ASSERT_TRUE(base::PathExists(temp_file));
int64 file_size = 0;
EXPECT_TRUE(base::GetFileSize(temp_file, &file_size));
diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc
index ba8edfc..4a6182f 100644
--- a/chrome/installer/util/master_preferences_unittest.cc
+++ b/chrome/installer/util/master_preferences_unittest.cc
@@ -76,7 +76,7 @@ TEST_F(MasterPreferencesTest, ParseDistroParams) {
" }\n"
"} \n";
- EXPECT_TRUE(file_util::WriteFile(prefs_file(), text, strlen(text)));
+ EXPECT_TRUE(base::WriteFile(prefs_file(), text, strlen(text)));
installer::MasterPreferences prefs(prefs_file());
EXPECT_TRUE(prefs.read_from_file());
@@ -135,7 +135,7 @@ TEST_F(MasterPreferencesTest, ParseMissingDistroParams) {
" }\n"
"} \n";
- EXPECT_TRUE(file_util::WriteFile(prefs_file(), text, strlen(text)));
+ EXPECT_TRUE(base::WriteFile(prefs_file(), text, strlen(text)));
installer::MasterPreferences prefs(prefs_file());
EXPECT_TRUE(prefs.read_from_file());
@@ -194,7 +194,7 @@ TEST_F(MasterPreferencesTest, FirstRunTabs) {
" ]\n"
"} \n";
- EXPECT_TRUE(file_util::WriteFile(prefs_file(), text, strlen(text)));
+ EXPECT_TRUE(base::WriteFile(prefs_file(), text, strlen(text)));
installer::MasterPreferences prefs(prefs_file());
typedef std::vector<std::string> TabsVector;
TabsVector tabs = prefs.GetFirstRunTabs();
@@ -252,7 +252,7 @@ TEST_F(MasterPreferencesTest, GetInstallPreferencesTest) {
" \"verbose_logging\": false\n"
" }\n"
"} \n";
- EXPECT_TRUE(file_util::WriteFile(prefs_file, text, strlen(text)));
+ EXPECT_TRUE(base::WriteFile(prefs_file, text, strlen(text)));
// Make sure command line values override the values in master preferences.
std::wstring cmd_str(
diff --git a/chrome/installer/util/self_cleaning_temp_dir_unittest.cc b/chrome/installer/util/self_cleaning_temp_dir_unittest.cc
index 7366211..9ff3425 100644
--- a/chrome/installer/util/self_cleaning_temp_dir_unittest.cc
+++ b/chrome/installer/util/self_cleaning_temp_dir_unittest.cc
@@ -161,8 +161,8 @@ TEST_F(SelfCleaningTempDirTest, LeaveUsedOnDestroy) {
EXPECT_TRUE(base::DirectoryExists(temp_dir.path()));
// Drop a file somewhere.
EXPECT_EQ(arraysize(kHiHon) - 1,
- file_util::WriteFile(parent_temp_dir.Append(GetRandomFilename()),
- kHiHon, arraysize(kHiHon) - 1));
+ base::WriteFile(parent_temp_dir.Append(GetRandomFilename()),
+ kHiHon, arraysize(kHiHon) - 1));
}
EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.Append(L"Three")));
EXPECT_TRUE(base::DirectoryExists(parent_temp_dir));
diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc
index be53622..03d2467 100644
--- a/chrome/installer/util/shell_util_unittest.cc
+++ b/chrome/installer/util/shell_util_unittest.cc
@@ -45,16 +45,16 @@ class ShellUtilShortcutTest : public testing::Test {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
chrome_exe_ = temp_dir_.path().Append(installer::kChromeExe);
- EXPECT_EQ(0, file_util::WriteFile(chrome_exe_, "", 0));
+ EXPECT_EQ(0, base::WriteFile(chrome_exe_, "", 0));
manganese_exe_ = temp_dir_.path().Append(kManganeseExe);
- EXPECT_EQ(0, file_util::WriteFile(manganese_exe_, "", 0));
+ EXPECT_EQ(0, base::WriteFile(manganese_exe_, "", 0));
iron_exe_ = temp_dir_.path().Append(kIronExe);
- EXPECT_EQ(0, file_util::WriteFile(iron_exe_, "", 0));
+ EXPECT_EQ(0, base::WriteFile(iron_exe_, "", 0));
other_ico_ = temp_dir_.path().Append(kOtherIco);
- EXPECT_EQ(0, file_util::WriteFile(other_ico_, "", 0));
+ EXPECT_EQ(0, base::WriteFile(other_ico_, "", 0));
ASSERT_TRUE(fake_user_desktop_.CreateUniqueTempDir());
ASSERT_TRUE(fake_common_desktop_.CreateUniqueTempDir());
@@ -773,7 +773,7 @@ TEST_F(ShellUtilShortcutTest, DontRemoveChromeShortcutIfPointsToAnotherChrome) {
ASSERT_TRUE(other_exe_dir.CreateUniqueTempDir());
base::FilePath other_chrome_exe =
other_exe_dir.path().Append(installer::kChromeExe);
- EXPECT_EQ(0, file_util::WriteFile(other_chrome_exe, "", 0));
+ EXPECT_EQ(0, base::WriteFile(other_chrome_exe, "", 0));
test_properties_.set_target(other_chrome_exe);
ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
diff --git a/chrome/renderer/mock_printer.cc b/chrome/renderer/mock_printer.cc
index 15213e6..5e43ab0 100644
--- a/chrome/renderer/mock_printer.cc
+++ b/chrome/renderer/mock_printer.cc
@@ -273,8 +273,8 @@ bool MockPrinter::SaveSource(
return false;
const uint8* source_data = pages_[page]->source_data();
uint32 source_size = pages_[page]->source_size();
- file_util::WriteFile(filepath, reinterpret_cast<const char*>(source_data),
- source_size);
+ base::WriteFile(filepath, reinterpret_cast<const char*>(source_data),
+ source_size);
return true;
}
diff --git a/chrome/service/cloud_print/connector_settings_unittest.cc b/chrome/service/cloud_print/connector_settings_unittest.cc
index 6645150..07f4717 100644
--- a/chrome/service/cloud_print/connector_settings_unittest.cc
+++ b/chrome/service/cloud_print/connector_settings_unittest.cc
@@ -60,7 +60,7 @@ class ConnectorSettingsTest : public testing::Test {
if (json) {
std::string content = json;
std::replace(content.begin(), content.end(), '\'', '"');
- file_util::WriteFile(file_name, content.c_str(), content.size());
+ base::WriteFile(file_name, content.c_str(), content.size());
}
ServiceProcessPrefs* prefs =
new ServiceProcessPrefs(file_name, message_loop_proxy_.get());
diff --git a/chrome/service/cloud_print/printer_job_handler.cc b/chrome/service/cloud_print/printer_job_handler.cc
index bb13def..f92ca1b 100644
--- a/chrome/service/cloud_print/printer_job_handler.cc
+++ b/chrome/service/cloud_print/printer_job_handler.cc
@@ -387,8 +387,8 @@ PrinterJobHandler::HandlePrintDataResponse(const net::URLFetcher* source,
if (base::CreateTemporaryFile(&job_details_.print_data_file_path_)) {
UMA_HISTOGRAM_ENUMERATION("CloudPrint.JobHandlerEvent", JOB_HANDLER_DATA,
JOB_HANDLER_MAX);
- int ret = file_util::WriteFile(job_details_.print_data_file_path_,
- data.c_str(), data.length());
+ int ret = base::WriteFile(job_details_.print_data_file_path_,
+ data.c_str(), data.length());
source->GetResponseHeaders()->GetMimeType(
&job_details_.print_data_mime_type_);
DCHECK(ret == static_cast<int>(data.length()));
diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc
index 02cab84..e682a43 100644
--- a/chrome/test/base/ui_test_utils.cc
+++ b/chrome/test/base/ui_test_utils.cc
@@ -487,7 +487,7 @@ bool SaveScreenSnapshotToDirectory(const base::FilePath& directory,
if (ui::GrabDesktopSnapshot(bounds, &png_data) &&
png_data.size() <= INT_MAX) {
int bytes = static_cast<int>(png_data.size());
- int written = file_util::WriteFile(
+ int written = base::WriteFile(
out_path, reinterpret_cast<char*>(&png_data[0]), bytes);
succeeded = (written == bytes);
}
diff --git a/chrome/test/chromedriver/chrome/zip_reader.cc b/chrome/test/chromedriver/chrome/zip_reader.cc
index 52bf815..718aea5 100644
--- a/chrome/test/chromedriver/chrome/zip_reader.cc
+++ b/chrome/test/chromedriver/chrome/zip_reader.cc
@@ -272,7 +272,7 @@ bool ZipReader::ExtractCurrentEntryToFd(const int fd) {
} else if (num_bytes_read > 0) {
// Some data is read. Write it to the output file descriptor.
if (num_bytes_read !=
- file_util::WriteFileDescriptor(fd, buf, num_bytes_read)) {
+ base::WriteFileDescriptor(fd, buf, num_bytes_read)) {
success = false;
break;
}
diff --git a/chrome/test/chromedriver/chrome_launcher.cc b/chrome/test/chromedriver/chrome_launcher.cc
index e006ff5..44a4ad8 100644
--- a/chrome/test/chromedriver/chrome_launcher.cc
+++ b/chrome/test/chromedriver/chrome_launcher.cc
@@ -65,7 +65,7 @@ Status UnpackAutomationExtension(const base::FilePath& temp_dir,
base::FilePath extension_zip = temp_dir.AppendASCII("internal.zip");
int size = static_cast<int>(decoded_extension.length());
- if (file_util::WriteFile(extension_zip, decoded_extension.c_str(), size)
+ if (base::WriteFile(extension_zip, decoded_extension.c_str(), size)
!= size) {
return Status(kUnknownError, "failed to write automation extension zip");
}
@@ -513,7 +513,7 @@ Status ProcessExtension(const std::string& extension,
return Status(kUnknownError, "cannot create temp dir");
base::FilePath extension_crx = temp_crx_dir.path().AppendASCII("temp.crx");
int size = static_cast<int>(decoded_extension.length());
- if (file_util::WriteFile(extension_crx, decoded_extension.c_str(), size) !=
+ if (base::WriteFile(extension_crx, decoded_extension.c_str(), size) !=
size) {
return Status(kUnknownError, "cannot write file");
}
@@ -553,7 +553,7 @@ Status ProcessExtension(const std::string& extension,
} else {
manifest->SetString("key", public_key_base64);
base::JSONWriter::Write(manifest, &manifest_data);
- if (file_util::WriteFile(
+ if (base::WriteFile(
manifest_path, manifest_data.c_str(), manifest_data.size()) !=
static_cast<int>(manifest_data.size())) {
return Status(kUnknownError, "cannot add 'key' to manifest");
@@ -651,7 +651,7 @@ Status WritePrefsFile(
base::JSONWriter::Write(prefs, &prefs_str);
VLOG(0) << "Populating " << path.BaseName().value()
<< " file: " << PrettyPrintValue(*prefs);
- if (static_cast<int>(prefs_str.length()) != file_util::WriteFile(
+ if (static_cast<int>(prefs_str.length()) != base::WriteFile(
path, prefs_str.c_str(), prefs_str.length())) {
return Status(kUnknownError, "failed to write prefs file");
}
@@ -682,7 +682,7 @@ Status PrepareUserDataDir(
// Write empty "First Run" file, otherwise Chrome will wipe the default
// profile that was written.
- if (file_util::WriteFile(
+ if (base::WriteFile(
user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) {
return Status(kUnknownError, "failed to write first run file");
}
diff --git a/chrome/test/chromedriver/util.cc b/chrome/test/chromedriver/util.cc
index 39dd768..f1fac34 100644
--- a/chrome/test/chromedriver/util.cc
+++ b/chrome/test/chromedriver/util.cc
@@ -90,7 +90,7 @@ Status UnzipArchive(const base::FilePath& unzip_dir,
base::FilePath archive = dir.path().AppendASCII("temp.zip");
int length = bytes.length();
- if (file_util::WriteFile(archive, bytes.c_str(), length) != length)
+ if (base::WriteFile(archive, bytes.c_str(), length) != length)
return Status(kUnknownError, "could not write file to temp dir");
if (!zip::Unzip(archive, unzip_dir))
diff --git a/chrome/test/perf/startup_test.cc b/chrome/test/perf/startup_test.cc
index 34a83dd..2f93bb0 100644
--- a/chrome/test/perf/startup_test.cc
+++ b/chrome/test/perf/startup_test.cc
@@ -137,7 +137,7 @@ class StartupTest : public UIPerfTest {
subst.push_back(base::WideToUTF16(user_data_dir_w));
const std::string prefs_string =
UTF16ToASCII(ReplaceStringPlaceholders(format_string, subst, NULL));
- EXPECT_TRUE(file_util::WriteFile(pref_path, prefs_string.c_str(),
+ EXPECT_TRUE(base::WriteFile(pref_path, prefs_string.c_str(),
prefs_string.size()));
file_util::EvictFileFromSystemCache(pref_path);
}
diff --git a/chrome/tools/convert_dict/convert_dict_unittest.cc b/chrome/tools/convert_dict/convert_dict_unittest.cc
index cbb92ac..eb7ed65 100644
--- a/chrome/tools/convert_dict/convert_dict_unittest.cc
+++ b/chrome/tools/convert_dict/convert_dict_unittest.cc
@@ -81,11 +81,11 @@ void RunDictionaryTest(const char* codepage,
// Create a temporary affix file and a dictionary file from the test data.
base::FilePath aff_file;
base::CreateTemporaryFile(&aff_file);
- file_util::WriteFile(aff_file, aff_data.c_str(), aff_data.length());
+ base::WriteFile(aff_file, aff_data.c_str(), aff_data.length());
base::FilePath dic_file;
base::CreateTemporaryFile(&dic_file);
- file_util::WriteFile(dic_file, dic_data.c_str(), dic_data.length());
+ base::WriteFile(dic_file, dic_data.c_str(), dic_data.length());
{
// Read the above affix file with AffReader and read the dictionary file
diff --git a/chrome/tools/profile_reset/jtl_compiler_frontend.cc b/chrome/tools/profile_reset/jtl_compiler_frontend.cc
index abc19446..b172205 100644
--- a/chrome/tools/profile_reset/jtl_compiler_frontend.cc
+++ b/chrome/tools/profile_reset/jtl_compiler_frontend.cc
@@ -100,7 +100,7 @@ int main(int argc, char* argv[]) {
base::FilePath bytecode_path =
MakeAbsoluteFilePath(cmd_line->GetSwitchValuePath(kOutputPath));
int bytes_written =
- file_util::WriteFile(cmd_line->GetSwitchValuePath(kOutputPath),
+ base::WriteFile(cmd_line->GetSwitchValuePath(kOutputPath),
bytecode.data(),
static_cast<int>(bytecode.size()));
if (bytes_written != static_cast<int>(bytecode.size())) {
diff --git a/chrome/tools/safe_browsing/sb_sigutil.cc b/chrome/tools/safe_browsing/sb_sigutil.cc
index 4a6d9db..4d2f75b 100644
--- a/chrome/tools/safe_browsing/sb_sigutil.cc
+++ b/chrome/tools/safe_browsing/sb_sigutil.cc
@@ -44,7 +44,7 @@ int main(int argc, char* argv[]) {
&signature_info);
std::string serialized_info = signature_info.SerializeAsString();
- int bytes_written = file_util::WriteFile(
+ int bytes_written = base::WriteFile(
cmd_line->GetSwitchValuePath(kOutputFile),
serialized_info.data(),
serialized_info.size());
diff --git a/chrome/utility/extensions/unpacker.cc b/chrome/utility/extensions/unpacker.cc
index f056fc3..1d74788 100644
--- a/chrome/utility/extensions/unpacker.cc
+++ b/chrome/utility/extensions/unpacker.cc
@@ -88,7 +88,7 @@ bool PathContainsParentDirectory(const base::FilePath& path) {
bool WritePickle(const IPC::Message& pickle, const base::FilePath& dest_path) {
int size = base::checked_cast<int>(pickle.size());
const char* data = static_cast<const char*>(pickle.data());
- int bytes_written = file_util::WriteFile(dest_path, data, size);
+ int bytes_written = base::WriteFile(dest_path, data, size);
return (bytes_written == size);
}
diff --git a/chrome/utility/extensions/unpacker_unittest.cc b/chrome/utility/extensions/unpacker_unittest.cc
index faf89ff..0eedf89 100644
--- a/chrome/utility/extensions/unpacker_unittest.cc
+++ b/chrome/utility/extensions/unpacker_unittest.cc
@@ -136,7 +136,7 @@ TEST_F(UnpackerTest, UnzipDirectoryError) {
SetupUnpacker("good_package.crx");
base::FilePath path =
temp_dir_.path().AppendASCII(kTempExtensionName);
- ASSERT_TRUE(file_util::WriteFile(path, "foo", 3));
+ ASSERT_TRUE(base::WriteFile(path, "foo", 3));
EXPECT_FALSE(unpacker_->Run());
EXPECT_TRUE(StartsWith(unpacker_->error_message(),
ASCIIToUTF16(kExpected),
diff --git a/chrome/utility/image_writer/image_writer_unittest.cc b/chrome/utility/image_writer/image_writer_unittest.cc
index bb7f31b9..0673e00 100644
--- a/chrome/utility/image_writer/image_writer_unittest.cc
+++ b/chrome/utility/image_writer/image_writer_unittest.cc
@@ -38,7 +38,7 @@ class ImageWriterUtilityTest : public testing::Test {
scoped_ptr<char[]> buffer(new char[kTestFileSize]);
memset(buffer.get(), pattern, kTestFileSize);
- ASSERT_TRUE(file_util::WriteFile(path, buffer.get(), kTestFileSize));
+ ASSERT_TRUE(base::WriteFile(path, buffer.get(), kTestFileSize));
}
void FillDefault(const base::FilePath& path) { FillFile(path, kTestPattern); }
diff --git a/chrome/utility/media_galleries/pmp_column_reader_unittest.cc b/chrome/utility/media_galleries/pmp_column_reader_unittest.cc
index eb6fee1b..4f7452ee 100644
--- a/chrome/utility/media_galleries/pmp_column_reader_unittest.cc
+++ b/chrome/utility/media_galleries/pmp_column_reader_unittest.cc
@@ -30,7 +30,7 @@ bool InitColumnReaderFromBytes(
return false;
// Explicit conversion from signed to unsigned.
- size_t bytes_written = file_util::WriteFile(temp_path, &data[0], data.size());
+ size_t bytes_written = base::WriteFile(temp_path, &data[0], data.size());
if (bytes_written != data.size())
return false;
diff --git a/chromeos/dbus/cros_disks_client.cc b/chromeos/dbus/cros_disks_client.cc
index d841959..fae607d 100644
--- a/chromeos/dbus/cros_disks_client.cc
+++ b/chromeos/dbus/cros_disks_client.cc
@@ -485,7 +485,7 @@ class CrosDisksClientStubImpl : public CrosDisksClient {
const base::FilePath dummy_file_path =
mounted_path.Append("SUCCESSFULLY_PERFORMED_FAKE_MOUNT.txt");
const std::string dummy_file_content = "This is a dummy file.";
- const int write_result = file_util::WriteFile(
+ const int write_result = base::WriteFile(
dummy_file_path, dummy_file_content.data(), dummy_file_content.size());
if (write_result != static_cast<int>(dummy_file_content.size())) {
DLOG(ERROR) << "Failed to put a dummy file at "
diff --git a/chromeos/dbus/session_manager_client.cc b/chromeos/dbus/session_manager_client.cc
index c01f28f..737a9be 100644
--- a/chromeos/dbus/session_manager_client.cc
+++ b/chromeos/dbus/session_manager_client.cc
@@ -611,7 +611,7 @@ class SessionManagerClientStubImpl : public SessionManagerClient {
const std::string& data) {
const int size = static_cast<int>(data.size());
if (!base::CreateDirectory(path.DirName()) ||
- file_util::WriteFile(path, data.data(), size) != size) {
+ base::WriteFile(path, data.data(), size) != size) {
LOG(WARNING) << "Failed to write policy key to " << path.value();
}
}
diff --git a/chromeos/process_proxy/process_output_watcher_unittest.cc b/chromeos/process_proxy/process_output_watcher_unittest.cc
index b45d137..5eeaf1a 100644
--- a/chromeos/process_proxy/process_output_watcher_unittest.cc
+++ b/chromeos/process_proxy/process_output_watcher_unittest.cc
@@ -118,14 +118,14 @@ public:
if (test_cases[i].should_send_terminating_null)
test_size += sizeof(*test_str.c_str());
EXPECT_EQ(test_size,
- file_util::WriteFileDescriptor(pt_pipe[1], test_str.c_str(),
- test_size));
+ base::WriteFileDescriptor(pt_pipe[1], test_str.c_str(),
+ test_size));
}
all_data_received_->Wait();
// Send stop signal. It is not important which string we send.
- EXPECT_EQ(1, file_util::WriteFileDescriptor(stop_pipe[1], "q", 1));
+ EXPECT_EQ(1, base::WriteFileDescriptor(stop_pipe[1], "q", 1));
EXPECT_NE(-1, IGNORE_EINTR(close(stop_pipe[1])));
EXPECT_NE(-1, IGNORE_EINTR(close(pt_pipe[1])));
diff --git a/chromeos/process_proxy/process_proxy.cc b/chromeos/process_proxy/process_proxy.cc
index 3ae1d21..5aa373f 100644
--- a/chromeos/process_proxy/process_proxy.cc
+++ b/chromeos/process_proxy/process_proxy.cc
@@ -132,8 +132,8 @@ bool ProcessProxy::StopWatching() {
// Signal Watcher that we are done. We use self-pipe trick to unblock watcher.
// Anything may be written to the pipe.
const char message[] = "q";
- return file_util::WriteFileDescriptor(shutdown_pipe_[PIPE_END_WRITE],
- message, sizeof(message));
+ return base::WriteFileDescriptor(shutdown_pipe_[PIPE_END_WRITE],
+ message, sizeof(message));
}
void ProcessProxy::Close() {
@@ -160,8 +160,8 @@ bool ProcessProxy::Write(const std::string& text) {
// We don't want to write '\0' to the pipe.
size_t data_size = text.length() * sizeof(*text.c_str());
int bytes_written =
- file_util::WriteFileDescriptor(pt_pair_[PT_MASTER_FD],
- text.c_str(), data_size);
+ base::WriteFileDescriptor(pt_pair_[PT_MASTER_FD],
+ text.c_str(), data_size);
return (bytes_written == static_cast<int>(data_size));
}
diff --git a/cloud_print/gcp20/prototype/print_job_handler.cc b/cloud_print/gcp20/prototype/print_job_handler.cc
index 48ba76e..e275266 100644
--- a/cloud_print/gcp20/prototype/print_job_handler.cc
+++ b/cloud_print/gcp20/prototype/print_job_handler.cc
@@ -235,15 +235,15 @@ bool PrintJobHandler::SavePrintJob(const std::string& content,
return false;
}
- int written = file_util::WriteFile(directory.AppendASCII("ticket.xml"),
- ticket.data(),
- static_cast<int>(ticket.size()));
+ int written = base::WriteFile(directory.AppendASCII("ticket.xml"),
+ ticket.data(),
+ static_cast<int>(ticket.size()));
if (static_cast<size_t>(written) != ticket.size()) {
LOG(WARNING) << "Cannot save ticket.";
return false;
}
- written = file_util::WriteFile(
+ written = base::WriteFile(
directory.AppendASCII("data." + file_extension),
content.data(), static_cast<int>(content.size()));
if (static_cast<size_t>(written) != content.size()) {
diff --git a/cloud_print/gcp20/prototype/printer_state.cc b/cloud_print/gcp20/prototype/printer_state.cc
index 0e12eee..17ccb6c 100644
--- a/cloud_print/gcp20/prototype/printer_state.cc
+++ b/cloud_print/gcp20/prototype/printer_state.cc
@@ -75,7 +75,7 @@ bool SaveToFile(const base::FilePath& path, const PrinterState& state) {
base::JSONWriter::OPTIONS_PRETTY_PRINT,
&json_str);
int size = base::checked_cast<int>(json_str.size());
- return (file_util::WriteFile(path, json_str.data(), size) == size);
+ return (base::WriteFile(path, json_str.data(), size) == size);
}
bool LoadFromFile(const base::FilePath& path, PrinterState* state) {
diff --git a/cloud_print/service/win/chrome_launcher.cc b/cloud_print/service/win/chrome_launcher.cc
index f6b863e..f0cac5e 100644
--- a/cloud_print/service/win/chrome_launcher.cc
+++ b/cloud_print/service/win/chrome_launcher.cc
@@ -292,9 +292,9 @@ std::string ChromeLauncher::CreateServiceStateFile(
printer_list.AppendStrings(printers);
std::string printers_json;
base::JSONWriter::Write(&printer_list, &printers_json);
- size_t written = file_util::WriteFile(printers_file,
- printers_json.c_str(),
- printers_json.size());
+ size_t written = base::WriteFile(printers_file,
+ printers_json.c_str(),
+ printers_json.size());
if (written != printers_json.size()) {
LOG(ERROR) << "Can't write file.";
return result;
diff --git a/cloud_print/service/win/cloud_print_service.cc b/cloud_print/service/win/cloud_print_service.cc
index e0998f0c..6f58095 100644
--- a/cloud_print/service/win/cloud_print_service.cc
+++ b/cloud_print/service/win/cloud_print_service.cc
@@ -351,7 +351,7 @@ class CloudPrintServiceModule
}
if (new_contents != contents) {
- size_t written = file_util::WriteFile(file, new_contents.c_str(),
+ size_t written = base::WriteFile(file, new_contents.c_str(),
new_contents.size());
if (written != new_contents.size()) {
return ReportError(cloud_print::GetLastHResult(),
diff --git a/cloud_print/service/win/cloud_print_service_config.cc b/cloud_print/service/win/cloud_print_service_config.cc
index 9556826..70f50c7 100644
--- a/cloud_print/service/win/cloud_print_service_config.cc
+++ b/cloud_print/service/win/cloud_print_service_config.cc
@@ -389,7 +389,7 @@ void SetupDialog::Install(const base::string16& user,
if (contents.empty())
return ShowError(IDS_ERROR_FAILED_CREATE_CONFIG);
- size_t written = file_util::WriteFile(file, contents.c_str(),
+ size_t written = base::WriteFile(file, contents.c_str(),
contents.size());
if (written != contents.size()) {
DWORD last_error = GetLastError();
diff --git a/components/autofill/core/browser/data_driven_test.cc b/components/autofill/core/browser/data_driven_test.cc
index 3218b17..757ddbb 100644
--- a/components/autofill/core/browser/data_driven_test.cc
+++ b/components/autofill/core/browser/data_driven_test.cc
@@ -24,8 +24,8 @@ bool ReadFile(const base::FilePath& file, std::string* content) {
// Write |content| to |file|. Returns true on success.
bool WriteFile(const base::FilePath& file, const std::string& content) {
- int write_size = file_util::WriteFile(file, content.c_str(),
- static_cast<int>(content.length()));
+ int write_size = base::WriteFile(file, content.c_str(),
+ static_cast<int>(content.length()));
return write_size == static_cast<int>(content.length());
}
diff --git a/components/browser_context_keyed_service/browser_context_dependency_manager.cc b/components/browser_context_keyed_service/browser_context_dependency_manager.cc
index bd45e7a..62fceb4 100644
--- a/components/browser_context_keyed_service/browser_context_dependency_manager.cc
+++ b/components/browser_context_keyed_service/browser_context_dependency_manager.cc
@@ -174,7 +174,7 @@ void BrowserContextDependencyManager::DumpBrowserContextDependencies(
std::string contents = dependency_graph_.DumpAsGraphviz(
"BrowserContext",
base::Bind(&BrowserContextKeyedBaseFactoryGetNodeName));
- file_util::WriteFile(dot_file, contents.c_str(), contents.size());
+ base::WriteFile(dot_file, contents.c_str(), contents.size());
}
}
#endif // NDEBUG
diff --git a/components/nacl/browser/nacl_browser.cc b/components/nacl/browser/nacl_browser.cc
index 77f9a36..f271af6 100644
--- a/components/nacl/browser/nacl_browser.cc
+++ b/components/nacl/browser/nacl_browser.cc
@@ -88,7 +88,7 @@ void ReadCache(const base::FilePath& filename, std::string* data) {
}
void WriteCache(const base::FilePath& filename, const Pickle* pickle) {
- file_util::WriteFile(filename, static_cast<const char*>(pickle->data()),
+ base::WriteFile(filename, static_cast<const char*>(pickle->data()),
pickle->size());
}
diff --git a/components/policy/core/common/cloud/resource_cache.cc b/components/policy/core/common/cloud/resource_cache.cc
index a68e66d..76221d1 100644
--- a/components/policy/core/common/cloud/resource_cache.cc
+++ b/components/policy/core/common/cloud/resource_cache.cc
@@ -85,7 +85,7 @@ bool ResourceCache::Store(const std::string& key,
int size = base::checked_cast<int>(data.size());
return VerifyKeyPathAndGetSubkeyPath(key, true, subkey, &subkey_path) &&
base::DeleteFile(subkey_path, false) &&
- (file_util::WriteFile(subkey_path, data.data(), size) == size);
+ (base::WriteFile(subkey_path, data.data(), size) == size);
}
bool ResourceCache::Load(const std::string& key,
diff --git a/components/policy/core/common/cloud/user_cloud_policy_store.cc b/components/policy/core/common/cloud/user_cloud_policy_store.cc
index 46706eb..3d298e6 100644
--- a/components/policy/core/common/cloud/user_cloud_policy_store.cc
+++ b/components/policy/core/common/cloud/user_cloud_policy_store.cc
@@ -107,7 +107,7 @@ bool WriteStringToFile(const base::FilePath path, const std::string& data) {
}
int size = data.size();
- if (file_util::WriteFile(path, data.c_str(), size) != size) {
+ if (base::WriteFile(path, data.c_str(), size) != size) {
DLOG(WARNING) << "Failed to write " << path.value();
return false;
}
diff --git a/components/policy/core/common/cloud/user_cloud_policy_store_unittest.cc b/components/policy/core/common/cloud/user_cloud_policy_store_unittest.cc
index 13142f7..6e828bf 100644
--- a/components/policy/core/common/cloud/user_cloud_policy_store_unittest.cc
+++ b/components/policy/core/common/cloud/user_cloud_policy_store_unittest.cc
@@ -42,7 +42,7 @@ bool WriteStringToFile(const base::FilePath path, const std::string& data) {
}
int size = data.size();
- if (file_util::WriteFile(path, data.c_str(), size) != size) {
+ if (base::WriteFile(path, data.c_str(), size) != size) {
DLOG(WARNING) << "Failed to write " << path.value();
return false;
}
@@ -168,9 +168,8 @@ TEST_F(UserCloudPolicyStoreTest, LoadWithInvalidFile) {
ASSERT_TRUE(base::CreateDirectory(policy_file().DirName()));
std::string bogus_data = "bogus_data";
int size = bogus_data.size();
- ASSERT_EQ(size, file_util::WriteFile(policy_file(),
- bogus_data.c_str(),
- bogus_data.size()));
+ ASSERT_EQ(size, base::WriteFile(policy_file(),
+ bogus_data.c_str(), bogus_data.size()));
ExpectError(store_.get(), CloudPolicyStore::STATUS_LOAD_ERROR);
store_->Load();
@@ -201,9 +200,8 @@ TEST_F(UserCloudPolicyStoreTest, LoadImmediatelyWithInvalidFile) {
ASSERT_TRUE(base::CreateDirectory(policy_file().DirName()));
std::string bogus_data = "bogus_data";
int size = bogus_data.size();
- ASSERT_EQ(size, file_util::WriteFile(policy_file(),
- bogus_data.c_str(),
- bogus_data.size()));
+ ASSERT_EQ(size, base::WriteFile(policy_file(),
+ bogus_data.c_str(), bogus_data.size()));
ExpectError(store_.get(), CloudPolicyStore::STATUS_LOAD_ERROR);
store_->LoadImmediately(); // Should load without running the message loop.
@@ -226,7 +224,7 @@ TEST_F(UserCloudPolicyStoreTest, Migration) {
ASSERT_TRUE(unsigned_builder.policy().SerializeToString(&data));
ASSERT_TRUE(base::CreateDirectory(policy_file().DirName()));
int size = data.size();
- ASSERT_EQ(size, file_util::WriteFile(policy_file(), data.c_str(), size));
+ ASSERT_EQ(size, base::WriteFile(policy_file(), data.c_str(), size));
// Now make sure the data can get loaded.
Sequence s;
diff --git a/components/policy/core/common/config_dir_policy_loader_unittest.cc b/components/policy/core/common/config_dir_policy_loader_unittest.cc
index de74964..41fc222 100644
--- a/components/policy/core/common/config_dir_policy_loader_unittest.cc
+++ b/components/policy/core/common/config_dir_policy_loader_unittest.cc
@@ -145,7 +145,7 @@ void TestHarness::WriteConfigFile(const base::DictionaryValue& dict,
ASSERT_TRUE(base::CreateDirectory(mandatory_dir));
const base::FilePath file_path(mandatory_dir.AppendASCII(file_name));
ASSERT_EQ((int) data.size(),
- file_util::WriteFile(file_path, data.c_str(), data.size()));
+ base::WriteFile(file_path, data.c_str(), data.size()));
}
std::string TestHarness::NextConfigFileName() {
diff --git a/components/policy/core/common/policy_loader_win_unittest.cc b/components/policy/core/common/policy_loader_win_unittest.cc
index 3383d04..4b066ee 100644
--- a/components/policy/core/common/policy_loader_win_unittest.cc
+++ b/components/policy/core/common/policy_loader_win_unittest.cc
@@ -468,7 +468,7 @@ void PRegTestHarness::SetUp() {
base::win::SetDomainStateForTesting(false);
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
preg_file_path_ = temp_dir_.path().Append(PolicyLoaderWin::kPRegFileName);
- ASSERT_TRUE(file_util::WriteFile(preg_file_path_,
+ ASSERT_TRUE(base::WriteFile(preg_file_path_,
preg_parser::kPRegFileHeader,
arraysize(preg_parser::kPRegFileHeader)));
diff --git a/components/storage_monitor/image_capture_device_manager_unittest.mm b/components/storage_monitor/image_capture_device_manager_unittest.mm
index 01a74df..5bdd830 100644
--- a/components/storage_monitor/image_capture_device_manager_unittest.mm
+++ b/components/storage_monitor/image_capture_device_manager_unittest.mm
@@ -110,8 +110,8 @@ const char kTestFileContents[] = "test";
saveAsFilename += ".jpg";
base::FilePath toBeSaved = saveDir.Append(saveAsFilename);
ASSERT_EQ(static_cast<int>(strlen(kTestFileContents)),
- file_util::WriteFile(toBeSaved, kTestFileContents,
- strlen(kTestFileContents)));
+ base::WriteFile(toBeSaved, kTestFileContents,
+ strlen(kTestFileContents)));
NSMutableDictionary* returnOptions =
[NSMutableDictionary dictionaryWithDictionary:options];
diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
index 0f376be..debe018 100644
--- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
+++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
@@ -233,7 +233,7 @@ void DumpAccessibilityTreeTest::RunTest(
base::FilePath(html_file.RemoveExtension().value() +
AccessibilityTreeFormatter::GetActualFileSuffix());
- EXPECT_TRUE(file_util::WriteFile(
+ EXPECT_TRUE(base::WriteFile(
actual_file, actual_contents.c_str(), actual_contents.size()));
ADD_FAILURE() << "No expectation found. Create it by doing:\n"
diff --git a/content/browser/dom_storage/dom_storage_database_unittest.cc b/content/browser/dom_storage/dom_storage_database_unittest.cc
index 76d5726..e20e399 100644
--- a/content/browser/dom_storage/dom_storage_database_unittest.cc
+++ b/content/browser/dom_storage/dom_storage_database_unittest.cc
@@ -346,7 +346,7 @@ TEST(DOMStorageDatabaseTest, TestCanOpenFileThatIsNotADatabase) {
temp_dir.path().AppendASCII("TestDOMStorageDatabase.db");
const char kData[] = "I am not a database.";
- file_util::WriteFile(file_name, kData, strlen(kData));
+ base::WriteFile(file_name, kData, strlen(kData));
{
sql::ScopedErrorIgnorer ignore_errors;
diff --git a/content/browser/download/base_file_posix.cc b/content/browser/download/base_file_posix.cc
index dd664af..4cf987c 100644
--- a/content/browser/download/base_file_posix.cc
+++ b/content/browser/download/base_file_posix.cc
@@ -18,7 +18,7 @@ DownloadInterruptReason BaseFile::MoveFileAndAdjustPermissions(
// First check the file existence and create an empty file if it doesn't
// exist.
if (!base::PathExists(new_path)) {
- int write_error = file_util::WriteFile(new_path, "", 0);
+ int write_error = base::WriteFile(new_path, "", 0);
if (write_error < 0)
return LogSystemError("WriteFile", errno);
}
diff --git a/content/browser/download/download_file_unittest.cc b/content/browser/download/download_file_unittest.cc
index 1418086..cc30d51 100644
--- a/content/browser/download/download_file_unittest.cc
+++ b/content/browser/download/download_file_unittest.cc
@@ -414,7 +414,7 @@ TEST_F(DownloadFileTest, RenameFileFinal) {
ASSERT_FALSE(base::PathExists(path_5));
static const char file_data[] = "xyzzy";
ASSERT_EQ(static_cast<int>(sizeof(file_data) - 1),
- file_util::WriteFile(path_5, file_data, sizeof(file_data) - 1));
+ base::WriteFile(path_5, file_data, sizeof(file_data) - 1));
ASSERT_TRUE(base::PathExists(path_5));
EXPECT_TRUE(base::ReadFileToString(path_5, &file_contents));
EXPECT_EQ(std::string(file_data), file_contents);
@@ -442,7 +442,7 @@ TEST_F(DownloadFileTest, RenameUniquifies) {
ASSERT_FALSE(base::PathExists(path_1));
static const char file_data[] = "xyzzy";
ASSERT_EQ(static_cast<int>(sizeof(file_data)),
- file_util::WriteFile(path_1, file_data, sizeof(file_data)));
+ base::WriteFile(path_1, file_data, sizeof(file_data)));
ASSERT_TRUE(base::PathExists(path_1));
EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, RenameAndUniquify(path_1, NULL));
diff --git a/content/browser/fileapi/blob_url_request_job_unittest.cc b/content/browser/fileapi/blob_url_request_job_unittest.cc
index 5940201..29c0e8f 100644
--- a/content/browser/fileapi/blob_url_request_job_unittest.cc
+++ b/content/browser/fileapi/blob_url_request_job_unittest.cc
@@ -148,7 +148,7 @@ class BlobURLRequestJobTest : public testing::Test {
temp_file1_ = temp_dir_.path().AppendASCII("BlobFile1.dat");
ASSERT_EQ(static_cast<int>(arraysize(kTestFileData1) - 1),
- file_util::WriteFile(temp_file1_, kTestFileData1,
+ base::WriteFile(temp_file1_, kTestFileData1,
arraysize(kTestFileData1) - 1));
base::File::Info file_info1;
base::GetFileInfo(temp_file1_, &file_info1);
@@ -156,7 +156,7 @@ class BlobURLRequestJobTest : public testing::Test {
temp_file2_ = temp_dir_.path().AppendASCII("BlobFile2.dat");
ASSERT_EQ(static_cast<int>(arraysize(kTestFileData2) - 1),
- file_util::WriteFile(temp_file2_, kTestFileData2,
+ base::WriteFile(temp_file2_, kTestFileData2,
arraysize(kTestFileData2) - 1));
base::File::Info file_info2;
base::GetFileInfo(temp_file2_, &file_info2);
@@ -336,7 +336,7 @@ TEST_F(BlobURLRequestJobTest, TestGetLargeFileRequest) {
for (int i = 0; i < kBufferSize * 5; ++i)
large_data.append(1, static_cast<char>(i % 256));
ASSERT_EQ(static_cast<int>(large_data.size()),
- file_util::WriteFile(large_temp_file, large_data.data(),
+ base::WriteFile(large_temp_file, large_data.data(),
large_data.size()));
blob_data_->AppendFile(large_temp_file, 0, -1, base::Time());
TestSuccessNonrangeRequest(large_data, large_data.size());
diff --git a/content/browser/fileapi/copy_or_move_operation_delegate_unittest.cc b/content/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
index cdbc553..1b7abf9 100644
--- a/content/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
+++ b/content/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
@@ -719,12 +719,12 @@ TEST(LocalFileSystemCopyOrMoveOperationTest, StreamCopyHelper) {
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
base::FilePath source_path = temp_dir.path().AppendASCII("source");
const char kTestData[] = "abcdefghijklmnopqrstuvwxyz0123456789";
- file_util::WriteFile(source_path, kTestData,
- arraysize(kTestData) - 1); // Exclude trailing '\0'.
+ base::WriteFile(source_path, kTestData,
+ arraysize(kTestData) - 1); // Exclude trailing '\0'.
base::FilePath dest_path = temp_dir.path().AppendASCII("dest");
// LocalFileWriter requires the file exists. So create an empty file here.
- file_util::WriteFile(dest_path, "", 0);
+ base::WriteFile(dest_path, "", 0);
base::MessageLoopForIO message_loop;
base::Thread file_thread("file_thread");
@@ -777,12 +777,12 @@ TEST(LocalFileSystemCopyOrMoveOperationTest, StreamCopyHelperWithFlush) {
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
base::FilePath source_path = temp_dir.path().AppendASCII("source");
const char kTestData[] = "abcdefghijklmnopqrstuvwxyz0123456789";
- file_util::WriteFile(source_path, kTestData,
- arraysize(kTestData) - 1); // Exclude trailing '\0'.
+ base::WriteFile(source_path, kTestData,
+ arraysize(kTestData) - 1); // Exclude trailing '\0'.
base::FilePath dest_path = temp_dir.path().AppendASCII("dest");
// LocalFileWriter requires the file exists. So create an empty file here.
- file_util::WriteFile(dest_path, "", 0);
+ base::WriteFile(dest_path, "", 0);
base::MessageLoopForIO message_loop;
base::Thread file_thread("file_thread");
@@ -831,12 +831,12 @@ TEST(LocalFileSystemCopyOrMoveOperationTest, StreamCopyHelper_Cancel) {
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
base::FilePath source_path = temp_dir.path().AppendASCII("source");
const char kTestData[] = "abcdefghijklmnopqrstuvwxyz0123456789";
- file_util::WriteFile(source_path, kTestData,
- arraysize(kTestData) - 1); // Exclude trailing '\0'.
+ base::WriteFile(source_path, kTestData,
+ arraysize(kTestData) - 1); // Exclude trailing '\0'.
base::FilePath dest_path = temp_dir.path().AppendASCII("dest");
// LocalFileWriter requires the file exists. So create an empty file here.
- file_util::WriteFile(dest_path, "", 0);
+ base::WriteFile(dest_path, "", 0);
base::MessageLoopForIO message_loop;
base::Thread file_thread("file_thread");
diff --git a/content/browser/fileapi/file_system_operation_impl_unittest.cc b/content/browser/fileapi/file_system_operation_impl_unittest.cc
index 1156b0e..89a06978 100644
--- a/content/browser/fileapi/file_system_operation_impl_unittest.cc
+++ b/content/browser/fileapi/file_system_operation_impl_unittest.cc
@@ -717,7 +717,7 @@ TEST_F(FileSystemOperationImplTest, TestCopyInForeignFileSuccess) {
base::CreateTemporaryFile(&src_local_disk_file_path);
const char test_data[] = "foo";
int data_size = ARRAYSIZE_UNSAFE(test_data);
- file_util::WriteFile(src_local_disk_file_path, test_data, data_size);
+ base::WriteFile(src_local_disk_file_path, test_data, data_size);
FileSystemURL dest_dir(CreateDirectory("dest"));
@@ -749,7 +749,7 @@ TEST_F(FileSystemOperationImplTest, TestCopyInForeignFileFailureByQuota) {
base::FilePath src_local_disk_file_path;
base::CreateTemporaryFile(&src_local_disk_file_path);
const char test_data[] = "foo";
- file_util::WriteFile(src_local_disk_file_path, test_data,
+ base::WriteFile(src_local_disk_file_path, test_data,
ARRAYSIZE_UNSAFE(test_data));
FileSystemURL dest_dir(CreateDirectory("dest"));
@@ -1037,7 +1037,7 @@ TEST_F(FileSystemOperationImplTest, TestTruncate) {
char test_data[] = "test data";
int data_size = static_cast<int>(sizeof(test_data));
EXPECT_EQ(data_size,
- file_util::WriteFile(platform_path, test_data, data_size));
+ base::WriteFile(platform_path, test_data, data_size));
// Check that its length is the size of the data written.
operation_runner()->GetMetadata(file, RecordMetadataCallback());
diff --git a/content/browser/fileapi/obfuscated_file_util_unittest.cc b/content/browser/fileapi/obfuscated_file_util_unittest.cc
index 61af79c..f436c7b 100644
--- a/content/browser/fileapi/obfuscated_file_util_unittest.cc
+++ b/content/browser/fileapi/obfuscated_file_util_unittest.cc
@@ -764,9 +764,9 @@ class ObfuscatedFileUtilTest : public testing::Test {
old_directory_db_path = data_dir_path().Append(path);
ASSERT_TRUE(base::CreateDirectory(old_directory_db_path));
EXPECT_EQ(static_cast<int>(kFakeDirectoryData.size()),
- file_util::WriteFile(old_directory_db_path.AppendASCII("dummy"),
- kFakeDirectoryData.data(),
- kFakeDirectoryData.size()));
+ base::WriteFile(old_directory_db_path.AppendASCII("dummy"),
+ kFakeDirectoryData.data(),
+ kFakeDirectoryData.size()));
}
storage_policy_->AddIsolated(origin_);
diff --git a/content/browser/indexed_db/indexed_db_quota_client_unittest.cc b/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
index cd2f146..ad99bed 100644
--- a/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
+++ b/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
@@ -135,7 +135,7 @@ class IndexedDBQuotaClientTest : public testing::Test {
void SetFileSizeTo(const base::FilePath& path, int size) {
std::string junk(size, 'a');
- ASSERT_EQ(size, file_util::WriteFile(path, junk.c_str(), size));
+ ASSERT_EQ(size, base::WriteFile(path, junk.c_str(), size));
}
void AddFakeIndexedDB(const GURL& origin, int size) {
diff --git a/content/browser/storage_partition_impl_unittest.cc b/content/browser/storage_partition_impl_unittest.cc
index 9a5c35f..bc2dca8 100644
--- a/content/browser/storage_partition_impl_unittest.cc
+++ b/content/browser/storage_partition_impl_unittest.cc
@@ -179,9 +179,9 @@ class RemoveLocalStorageTester {
base::CreateDirectory(storage_path);
// Write some files.
- file_util::WriteFile(storage_path.Append(kDomStorageOrigin1), NULL, 0);
- file_util::WriteFile(storage_path.Append(kDomStorageOrigin2), NULL, 0);
- file_util::WriteFile(storage_path.Append(kDomStorageOrigin3), NULL, 0);
+ base::WriteFile(storage_path.Append(kDomStorageOrigin1), NULL, 0);
+ base::WriteFile(storage_path.Append(kDomStorageOrigin2), NULL, 0);
+ base::WriteFile(storage_path.Append(kDomStorageOrigin3), NULL, 0);
// Tweak their dates.
base::Time now = base::Time::Now();
diff --git a/content/common/gpu/media/vaapi_h264_decoder_unittest.cc b/content/common/gpu/media/vaapi_h264_decoder_unittest.cc
index aa1946d..e242e3c 100644
--- a/content/common/gpu/media/vaapi_h264_decoder_unittest.cc
+++ b/content/common/gpu/media/vaapi_h264_decoder_unittest.cc
@@ -150,7 +150,7 @@ bool VaapiH264DecoderLoop::Initialize(base::FilePath input_file,
// This creates or truncates output_file.
// Without it, AppendToFile() will not work.
if (!output_file.empty()) {
- if (file_util::WriteFile(output_file, NULL, 0) != 0) {
+ if (base::WriteFile(output_file, NULL, 0) != 0) {
return false;
}
output_file_ = output_file;
diff --git a/content/common/gpu/media/video_decode_accelerator_unittest.cc b/content/common/gpu/media/video_decode_accelerator_unittest.cc
index 89ea1b6..e034a96 100644
--- a/content/common/gpu/media/video_decode_accelerator_unittest.cc
+++ b/content/common/gpu/media/video_decode_accelerator_unittest.cc
@@ -1370,7 +1370,7 @@ TEST_P(VideoDecodeAcceleratorParamTest, TestSimpleDecode) {
base::FilePath filepath(test_video_files_[0]->file_name);
filepath = filepath.AddExtension(FILE_PATH_LITERAL(".bad_thumbnails"));
filepath = filepath.AddExtension(FILE_PATH_LITERAL(".png"));
- int num_bytes = file_util::WriteFile(filepath,
+ int num_bytes = base::WriteFile(filepath,
reinterpret_cast<char*>(&png[0]),
png.size());
ASSERT_EQ(num_bytes, static_cast<int>(png.size()));
diff --git a/content/common/gpu/media/video_encode_accelerator_unittest.cc b/content/common/gpu/media/video_encode_accelerator_unittest.cc
index 2fa5217..3977b50 100644
--- a/content/common/gpu/media/video_encode_accelerator_unittest.cc
+++ b/content/common/gpu/media/video_encode_accelerator_unittest.cc
@@ -379,7 +379,7 @@ VEAClient::VEAClient(const TestStream& test_stream,
base::FilePath out_filename(test_stream_.out_filename);
// This creates or truncates out_filename.
// Without it, AppendToFile() will not work.
- EXPECT_EQ(0, file_util::WriteFile(out_filename, NULL, 0));
+ EXPECT_EQ(0, base::WriteFile(out_filename, NULL, 0));
}
thread_checker_.DetachFromThread();
diff --git a/content/common/sandbox_mac_fontloading_unittest.mm b/content/common/sandbox_mac_fontloading_unittest.mm
index 1285359..3373f63 100644
--- a/content/common/sandbox_mac_fontloading_unittest.mm
+++ b/content/common/sandbox_mac_fontloading_unittest.mm
@@ -114,7 +114,7 @@ TEST_F(MacSandboxTest, FontLoadingTest) {
EXPECT_GT(result.font_data_size, 0U);
EXPECT_GT(result.font_id, 0U);
- file_util::WriteFileDescriptor(fileno(temp_file),
+ base::WriteFileDescriptor(fileno(temp_file),
static_cast<const char *>(result.font_data.memory()),
result.font_data_size);
diff --git a/content/public/test/async_file_test_helper.cc b/content/public/test/async_file_test_helper.cc
index 2da0bf8..03376f9 100644
--- a/content/public/test/async_file_test_helper.cc
+++ b/content/public/test/async_file_test_helper.cc
@@ -181,7 +181,7 @@ base::File::Error AsyncFileTestHelper::CreateFileWithData(
if (!dir.CreateUniqueTempDir())
return base::File::FILE_ERROR_FAILED;
base::FilePath local_path = dir.path().AppendASCII("tmp");
- if (buf_size != file_util::WriteFile(local_path, buf, buf_size))
+ if (buf_size != base::WriteFile(local_path, buf, buf_size))
return base::File::FILE_ERROR_FAILED;
base::File::Error result = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
diff --git a/content/test/image_decoder_test.cc b/content/test/image_decoder_test.cc
index 351d491..00341c0 100644
--- a/content/test/image_decoder_test.cc
+++ b/content/test/image_decoder_test.cc
@@ -61,7 +61,7 @@ void SaveMD5Sum(const base::FilePath& path, const blink::WebImage& web_image) {
&digest);
// Write sum to disk.
- int bytes_written = file_util::WriteFile(path,
+ int bytes_written = base::WriteFile(path,
reinterpret_cast<const char*>(&digest), sizeof digest);
ASSERT_EQ(sizeof digest, bytes_written);
web_image.getSkBitmap().unlockPixels();
diff --git a/courgette/courgette_tool.cc b/courgette/courgette_tool.cc
index 3b5b5e6..23322fd 100644
--- a/courgette/courgette_tool.cc
+++ b/courgette/courgette_tool.cc
@@ -61,7 +61,7 @@ std::string ReadOrFail(const base::FilePath& file_name, const char* kind) {
void WriteSinkToFile(const courgette::SinkStream *sink,
const base::FilePath& output_file) {
int count =
- file_util::WriteFile(output_file,
+ base::WriteFile(output_file,
reinterpret_cast<const char*>(sink->Buffer()),
static_cast<int>(sink->Length()));
if (count == -1)
diff --git a/courgette/ensemble_apply.cc b/courgette/ensemble_apply.cc
index be3618b..967b4e4 100644
--- a/courgette/ensemble_apply.cc
+++ b/courgette/ensemble_apply.cc
@@ -416,7 +416,7 @@ Status ApplyEnsemblePatch(const base::FilePath::CharType* old_file_name,
// Write the patched data to |new_file_name|.
base::FilePath new_file_path(new_file_name);
int written =
- file_util::WriteFile(
+ base::WriteFile(
new_file_path,
reinterpret_cast<const char*>(new_sink_stream.Buffer()),
static_cast<int>(new_sink_stream.Length()));
diff --git a/courgette/third_party/bsdiff_apply.cc b/courgette/third_party/bsdiff_apply.cc
index 3ed346e..435acc0 100644
--- a/courgette/third_party/bsdiff_apply.cc
+++ b/courgette/third_party/bsdiff_apply.cc
@@ -200,7 +200,7 @@ BSDiffStatus ApplyBinaryPatch(const base::FilePath& old_file_path,
}
// Write the stream to disk.
- int written = file_util::WriteFile(
+ int written = base::WriteFile(
new_file_path,
reinterpret_cast<const char*>(new_sink_stream.Buffer()),
static_cast<int>(new_sink_stream.Length()));
diff --git a/extensions/browser/value_store/leveldb_value_store_unittest.cc b/extensions/browser/value_store/leveldb_value_store_unittest.cc
index 8582e1e..c278b54 100644
--- a/extensions/browser/value_store/leveldb_value_store_unittest.cc
+++ b/extensions/browser/value_store/leveldb_value_store_unittest.cc
@@ -166,7 +166,7 @@ TEST_F(LeveldbValueStoreUnitTest, RestoreFullDatabase) {
for (base::FilePath file = enumerator.Next(); !file.empty();
file = enumerator.Next()) {
// WriteFile() failure is a result of -1.
- ASSERT_NE(file_util::WriteFile(file, kLolCats.c_str(), kLolCats.length()),
+ ASSERT_NE(base::WriteFile(file, kLolCats.c_str(), kLolCats.length()),
-1);
}
OpenStore();
diff --git a/extensions/common/extension_resource_unittest.cc b/extensions/common/extension_resource_unittest.cc
index 499ba92..eb16e5b 100644
--- a/extensions/common/extension_resource_unittest.cc
+++ b/extensions/common/extension_resource_unittest.cc
@@ -55,8 +55,8 @@ TEST(ExtensionResourceTest, ResourcesOutsideOfPath) {
ASSERT_TRUE(base::CreateDirectory(sub_dir));
base::FilePath inner_file = inner_dir.AppendASCII("inner");
base::FilePath outer_file = temp.path().AppendASCII("outer");
- ASSERT_TRUE(file_util::WriteFile(outer_file, "X", 1));
- ASSERT_TRUE(file_util::WriteFile(inner_file, "X", 1));
+ ASSERT_TRUE(base::WriteFile(outer_file, "X", 1));
+ ASSERT_TRUE(base::WriteFile(inner_file, "X", 1));
std::string extension_id = id_util::GenerateId("test");
#if defined(OS_POSIX)
@@ -123,7 +123,7 @@ TEST(ExtensionResourceTest, CreateWithAllResourcesOnDisk) {
const char* filename = "res.ico";
base::FilePath root_resource = temp.path().AppendASCII(filename);
std::string data = "some foo";
- ASSERT_TRUE(file_util::WriteFile(root_resource, data.c_str(), data.length()));
+ ASSERT_TRUE(base::WriteFile(root_resource, data.c_str(), data.length()));
// Create l10n resources (for current locale and its parents).
base::FilePath l10n_path =
@@ -138,7 +138,7 @@ TEST(ExtensionResourceTest, CreateWithAllResourcesOnDisk) {
base::FilePath make_path;
make_path = l10n_path.AppendASCII(locales[i]);
ASSERT_TRUE(base::CreateDirectory(make_path));
- ASSERT_TRUE(file_util::WriteFile(make_path.AppendASCII(filename),
+ ASSERT_TRUE(base::WriteFile(make_path.AppendASCII(filename),
data.c_str(), data.length()));
}
diff --git a/extensions/common/file_util_unittest.cc b/extensions/common/file_util_unittest.cc
index f8f7b622..c872107 100644
--- a/extensions/common/file_util_unittest.cc
+++ b/extensions/common/file_util_unittest.cc
@@ -66,9 +66,9 @@ TEST_F(FileUtilTest, ExtensionResourceURLToFilePath) {
const char data[] = "Test Data";
base::FilePath resource_path = api_path.Append(FILE_PATH_LITERAL("test.js"));
- ASSERT_TRUE(file_util::WriteFile(resource_path, data, sizeof(data)));
+ ASSERT_TRUE(base::WriteFile(resource_path, data, sizeof(data)));
resource_path = api_path.Append(FILE_PATH_LITERAL("escape spaces.js"));
- ASSERT_TRUE(file_util::WriteFile(resource_path, data, sizeof(data)));
+ ASSERT_TRUE(base::WriteFile(resource_path, data, sizeof(data)));
#ifdef FILE_PATH_USES_WIN_SEPARATORS
#define SEP "\\"
diff --git a/google_apis/drive/test_util.cc b/google_apis/drive/test_util.cc
index 5aaac8c..e77d1cf 100644
--- a/google_apis/drive/test_util.cc
+++ b/google_apis/drive/test_util.cc
@@ -57,7 +57,7 @@ void RunAndQuit(base::RunLoop* run_loop, const base::Closure& closure) {
bool WriteStringToFile(const base::FilePath& file_path,
const std::string& content) {
- int result = file_util::WriteFile(
+ int result = base::WriteFile(
file_path, content.data(), static_cast<int>(content.size()));
return content.size() == static_cast<size_t>(result);
}
diff --git a/net/base/file_stream_unittest.cc b/net/base/file_stream_unittest.cc
index b055c78..d86010d 100644
--- a/net/base/file_stream_unittest.cc
+++ b/net/base/file_stream_unittest.cc
@@ -47,7 +47,7 @@ class FileStreamTest : public PlatformTest {
PlatformTest::SetUp();
base::CreateTemporaryFile(&temp_file_path_);
- file_util::WriteFile(temp_file_path_, kTestData, kTestDataSize);
+ base::WriteFile(temp_file_path_, kTestData, kTestDataSize);
}
virtual void TearDown() {
EXPECT_TRUE(base::DeleteFile(temp_file_path_, false));
@@ -145,7 +145,7 @@ TEST_F(FileStreamTest, AsyncOpenExplicitCloseOrphaned) {
TEST_F(FileStreamTest, FileHandleNotLeftOpen) {
bool created = false;
ASSERT_EQ(kTestDataSize,
- file_util::WriteFile(temp_file_path(), kTestData, kTestDataSize));
+ base::WriteFile(temp_file_path(), kTestData, kTestDataSize));
int flags = base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_READ;
base::PlatformFile file = base::CreatePlatformFile(
temp_file_path(), flags, &created, NULL);
@@ -169,7 +169,7 @@ TEST_F(FileStreamTest, UseFileHandle) {
// 1. Test reading with a file handle.
ASSERT_EQ(kTestDataSize,
- file_util::WriteFile(temp_file_path(), kTestData, kTestDataSize));
+ base::WriteFile(temp_file_path(), kTestData, kTestDataSize));
int flags = base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_READ;
base::PlatformFile file = base::CreatePlatformFile(
temp_file_path(), flags, &created, NULL);
diff --git a/net/base/upload_data_stream_unittest.cc b/net/base/upload_data_stream_unittest.cc
index fa6c437..90a78d2 100644
--- a/net/base/upload_data_stream_unittest.cc
+++ b/net/base/upload_data_stream_unittest.cc
@@ -174,7 +174,7 @@ TEST_F(UploadDataStreamTest, File) {
ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(),
&temp_file_path));
ASSERT_EQ(static_cast<int>(kTestDataSize),
- file_util::WriteFile(temp_file_path, kTestData, kTestDataSize));
+ base::WriteFile(temp_file_path, kTestData, kTestDataSize));
element_readers_.push_back(
new UploadFileElementReader(base::MessageLoopProxy::current().get(),
@@ -208,7 +208,7 @@ TEST_F(UploadDataStreamTest, FileSmallerThanLength) {
ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(),
&temp_file_path));
ASSERT_EQ(static_cast<int>(kTestDataSize),
- file_util::WriteFile(temp_file_path, kTestData, kTestDataSize));
+ base::WriteFile(temp_file_path, kTestData, kTestDataSize));
const uint64 kFakeSize = kTestDataSize*2;
UploadFileElementReader::ScopedOverridingContentLengthForTests
@@ -326,7 +326,7 @@ TEST_F(UploadDataStreamTest, FileAndBytes) {
ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(),
&temp_file_path));
ASSERT_EQ(static_cast<int>(kTestDataSize),
- file_util::WriteFile(temp_file_path, kTestData, kTestDataSize));
+ base::WriteFile(temp_file_path, kTestData, kTestDataSize));
const uint64 kFileRangeOffset = 1;
const uint64 kFileRangeLength = 4;
@@ -552,7 +552,7 @@ TEST_F(UploadDataStreamTest, FileChanged) {
ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(),
&temp_file_path));
ASSERT_EQ(static_cast<int>(kTestDataSize),
- file_util::WriteFile(temp_file_path, kTestData, kTestDataSize));
+ base::WriteFile(temp_file_path, kTestData, kTestDataSize));
base::File::Info file_info;
ASSERT_TRUE(base::GetFileInfo(temp_file_path, &file_info));
@@ -571,7 +571,7 @@ TEST_F(UploadDataStreamTest, MultipleInit) {
ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(),
&temp_file_path));
ASSERT_EQ(static_cast<int>(kTestDataSize),
- file_util::WriteFile(temp_file_path, kTestData, kTestDataSize));
+ base::WriteFile(temp_file_path, kTestData, kTestDataSize));
// Prepare data.
element_readers_.push_back(new UploadBytesElementReader(
@@ -615,7 +615,7 @@ TEST_F(UploadDataStreamTest, MultipleInitAsync) {
ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(),
&temp_file_path));
ASSERT_EQ(static_cast<int>(kTestDataSize),
- file_util::WriteFile(temp_file_path, kTestData, kTestDataSize));
+ base::WriteFile(temp_file_path, kTestData, kTestDataSize));
TestCompletionCallback test_callback;
// Prepare data.
@@ -658,7 +658,7 @@ TEST_F(UploadDataStreamTest, InitToReset) {
ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(),
&temp_file_path));
ASSERT_EQ(static_cast<int>(kTestDataSize),
- file_util::WriteFile(temp_file_path, kTestData, kTestDataSize));
+ base::WriteFile(temp_file_path, kTestData, kTestDataSize));
// Prepare data.
element_readers_.push_back(new UploadBytesElementReader(
@@ -715,7 +715,7 @@ TEST_F(UploadDataStreamTest, InitDuringAsyncInit) {
ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(),
&temp_file_path));
ASSERT_EQ(static_cast<int>(kTestDataSize),
- file_util::WriteFile(temp_file_path, kTestData, kTestDataSize));
+ base::WriteFile(temp_file_path, kTestData, kTestDataSize));
// Prepare data.
element_readers_.push_back(new UploadBytesElementReader(
@@ -763,7 +763,7 @@ TEST_F(UploadDataStreamTest, InitDuringAsyncRead) {
ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(),
&temp_file_path));
ASSERT_EQ(static_cast<int>(kTestDataSize),
- file_util::WriteFile(temp_file_path, kTestData, kTestDataSize));
+ base::WriteFile(temp_file_path, kTestData, kTestDataSize));
// Prepare data.
element_readers_.push_back(new UploadBytesElementReader(
diff --git a/net/base/upload_file_element_reader_unittest.cc b/net/base/upload_file_element_reader_unittest.cc
index d98262b..395b867 100644
--- a/net/base/upload_file_element_reader_unittest.cc
+++ b/net/base/upload_file_element_reader_unittest.cc
@@ -30,7 +30,7 @@ class UploadFileElementReaderTest : public PlatformTest {
&temp_file_path_));
ASSERT_EQ(
static_cast<int>(bytes_.size()),
- file_util::WriteFile(temp_file_path_, &bytes_[0], bytes_.size()));
+ base::WriteFile(temp_file_path_, &bytes_[0], bytes_.size()));
reader_.reset(
new UploadFileElementReader(base::MessageLoopProxy::current().get(),
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc
index 35fdebc..68da572 100644
--- a/net/disk_cache/backend_unittest.cc
+++ b/net/disk_cache/backend_unittest.cc
@@ -482,7 +482,7 @@ TEST_F(DiskCacheBackendTest, ExternalFiles) {
const int kSize = 50;
scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize));
CacheTestFillBuffer(buffer1->data(), kSize, false);
- ASSERT_EQ(kSize, file_util::WriteFile(filename, buffer1->data(), kSize));
+ ASSERT_EQ(kSize, base::WriteFile(filename, buffer1->data(), kSize));
// Now let's create a file with the cache.
disk_cache::Entry* entry;
@@ -671,7 +671,7 @@ TEST_F(DiskCacheBackendTest, ShutdownWithPendingCreate_Fast) {
TEST_F(DiskCacheTest, TruncatedIndex) {
ASSERT_TRUE(CleanupCacheDir());
base::FilePath index = cache_path_.AppendASCII("index");
- ASSERT_EQ(5, file_util::WriteFile(index, "hello", 5));
+ ASSERT_EQ(5, base::WriteFile(index, "hello", 5));
base::Thread cache_thread("CacheThread");
ASSERT_TRUE(cache_thread.StartWithOptions(
@@ -3317,7 +3317,7 @@ TEST_F(DiskCacheBackendTest, SimpleCacheOpenBadFile) {
header.initial_magic_number = GG_UINT64_C(0xbadf00d);
EXPECT_EQ(
implicit_cast<int>(sizeof(header)),
- file_util::WriteFile(entry_file1_path, reinterpret_cast<char*>(&header),
+ base::WriteFile(entry_file1_path, reinterpret_cast<char*>(&header),
sizeof(header)));
ASSERT_EQ(net::ERR_FAILED, OpenEntry(key, &entry));
}
diff --git a/net/disk_cache/blockfile/block_files_unittest.cc b/net/disk_cache/blockfile/block_files_unittest.cc
index 8e2995d..bbd8981 100644
--- a/net/disk_cache/blockfile/block_files_unittest.cc
+++ b/net/disk_cache/blockfile/block_files_unittest.cc
@@ -270,7 +270,7 @@ TEST_F(DiskCacheTest, BlockFiles_InvalidFile) {
char header[kBlockHeaderSize];
memset(header, 'a', kBlockHeaderSize);
EXPECT_EQ(kBlockHeaderSize,
- file_util::WriteFile(filename, header, kBlockHeaderSize));
+ base::WriteFile(filename, header, kBlockHeaderSize));
EXPECT_TRUE(NULL == files.GetFile(addr));
diff --git a/net/disk_cache/simple/simple_index_file.cc b/net/disk_cache/simple/simple_index_file.cc
index 9e28a12..0b375f4 100644
--- a/net/disk_cache/simple/simple_index_file.cc
+++ b/net/disk_cache/simple/simple_index_file.cc
@@ -66,7 +66,7 @@ void UmaRecordIndexInitMethod(IndexInitMethod method,
}
bool WritePickleFile(Pickle* pickle, const base::FilePath& file_name) {
- int bytes_written = file_util::WriteFile(
+ int bytes_written = base::WriteFile(
file_name, static_cast<const char*>(pickle->data()), pickle->size());
if (bytes_written != implicit_cast<int>(pickle->size())) {
base::DeleteFile(file_name, /* recursive = */ false);
diff --git a/net/disk_cache/simple/simple_index_file_unittest.cc b/net/disk_cache/simple/simple_index_file_unittest.cc
index 3f4b56f..212320b 100644
--- a/net/disk_cache/simple/simple_index_file_unittest.cc
+++ b/net/disk_cache/simple/simple_index_file_unittest.cc
@@ -170,9 +170,8 @@ TEST_F(SimpleIndexFileTest, LegacyIsIndexFileStale) {
WrappedSimpleIndexFile::LegacyIsIndexFileStale(cache_mtime, index_path));
const std::string kDummyData = "nothing to be seen here";
EXPECT_EQ(static_cast<int>(kDummyData.size()),
- file_util::WriteFile(index_path,
- kDummyData.data(),
- kDummyData.size()));
+ base::WriteFile(index_path,
+ kDummyData.data(), kDummyData.size()));
ASSERT_TRUE(simple_util::GetMTime(cache_path, &cache_mtime));
EXPECT_FALSE(
WrappedSimpleIndexFile::LegacyIsIndexFileStale(cache_mtime, index_path));
@@ -244,7 +243,7 @@ TEST_F(SimpleIndexFileTest, LoadCorruptIndex) {
const std::string kDummyData = "nothing to be seen here";
EXPECT_EQ(
implicit_cast<int>(kDummyData.size()),
- file_util::WriteFile(index_path, kDummyData.data(), kDummyData.size()));
+ base::WriteFile(index_path, kDummyData.data(), kDummyData.size()));
base::Time fake_cache_mtime;
ASSERT_TRUE(simple_util::GetMTime(simple_index_file.GetIndexFilePath(),
&fake_cache_mtime));
@@ -287,9 +286,9 @@ TEST_F(SimpleIndexFileTest, SimpleCacheUpgrade) {
const base::FilePath old_index_file =
cache_path.AppendASCII("the-real-index");
ASSERT_EQ(implicit_cast<int>(index_file_contents.size()),
- file_util::WriteFile(old_index_file,
- index_file_contents.data(),
- index_file_contents.size()));
+ base::WriteFile(old_index_file,
+ index_file_contents.data(),
+ index_file_contents.size()));
// Upgrade the cache.
ASSERT_TRUE(disk_cache::UpgradeSimpleCacheOnDisk(cache_path));
diff --git a/net/disk_cache/simple/simple_version_upgrade_unittest.cc b/net/disk_cache/simple/simple_version_upgrade_unittest.cc
index a5493f7..15f4fa1 100644
--- a/net/disk_cache/simple/simple_version_upgrade_unittest.cc
+++ b/net/disk_cache/simple/simple_version_upgrade_unittest.cc
@@ -39,7 +39,7 @@ bool WriteFakeIndexFileV5(const base::FilePath& cache_path) {
data.unused_must_be_zero2 = 0;
const base::FilePath file_name = cache_path.AppendASCII("index");
return sizeof(data) ==
- file_util::WriteFile(
+ base::WriteFile(
file_name, reinterpret_cast<const char*>(&data), sizeof(data));
}
@@ -55,7 +55,7 @@ TEST(SimpleVersionUpgradeTest, FailsToMigrateBackwards) {
data.unused_must_be_zero2 = 0;
const base::FilePath file_name = cache_path.AppendASCII(kFakeIndexFileName);
ASSERT_EQ(implicit_cast<int>(sizeof(data)),
- file_util::WriteFile(
+ base::WriteFile(
file_name, reinterpret_cast<const char*>(&data), sizeof(data)));
EXPECT_FALSE(disk_cache::UpgradeSimpleCacheOnDisk(cache_dir.path()));
}
@@ -69,7 +69,7 @@ TEST(SimpleVersionUpgradeTest, FakeIndexVersionGetsUpdated) {
const std::string file_contents("incorrectly serialized data");
const base::FilePath index_file = cache_path.AppendASCII(kIndexFileName);
ASSERT_EQ(implicit_cast<int>(file_contents.size()),
- file_util::WriteFile(
+ base::WriteFile(
index_file, file_contents.data(), file_contents.size()));
// Upgrade.
@@ -96,7 +96,7 @@ TEST(SimpleVersionUpgradeTest, UpgradeV5V6IndexMustDisappear) {
const std::string file_contents("incorrectly serialized data");
const base::FilePath index_file = cache_path.AppendASCII(kIndexFileName);
ASSERT_EQ(implicit_cast<int>(file_contents.size()),
- file_util::WriteFile(
+ base::WriteFile(
index_file, file_contents.data(), file_contents.size()));
// Create a few entry-like files.
@@ -109,7 +109,7 @@ TEST(SimpleVersionUpgradeTest, UpgradeV5V6IndexMustDisappear) {
file_contents +
base::StringPrintf(" %" PRIx64, implicit_cast<uint64>(entry_hash));
ASSERT_EQ(implicit_cast<int>(entry_contents.size()),
- file_util::WriteFile(cache_path.AppendASCII(file_name),
+ base::WriteFile(cache_path.AppendASCII(file_name),
entry_contents.data(),
entry_contents.size()));
}
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index e4edbb9..aa7967d 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -7861,7 +7861,7 @@ TEST_P(HttpNetworkTransactionTest, UploadUnreadableFile) {
base::FilePath temp_file;
ASSERT_TRUE(base::CreateTemporaryFile(&temp_file));
std::string temp_file_content("Unreadable file.");
- ASSERT_TRUE(file_util::WriteFile(temp_file, temp_file_content.c_str(),
+ ASSERT_TRUE(base::WriteFile(temp_file, temp_file_content.c_str(),
temp_file_content.length()));
ASSERT_TRUE(file_util::MakeFileUnreadable(temp_file));
diff --git a/net/http/transport_security_persister_unittest.cc b/net/http/transport_security_persister_unittest.cc
index 8c41f9e..114e933 100644
--- a/net/http/transport_security_persister_unittest.cc
+++ b/net/http/transport_security_persister_unittest.cc
@@ -127,8 +127,7 @@ TEST_F(TransportSecurityPersisterTest, SerializeData3) {
// than block.) Use a different basename just for cleanliness.
base::FilePath path =
temp_dir_.path().AppendASCII("TransportSecurityPersisterTest");
- EXPECT_TRUE(file_util::WriteFile(path, serialized.c_str(),
- serialized.size()));
+ EXPECT_TRUE(base::WriteFile(path, serialized.c_str(), serialized.size()));
// Read the data back.
std::string persisted;
diff --git a/net/proxy/proxy_config_service_linux_unittest.cc b/net/proxy/proxy_config_service_linux_unittest.cc
index 99a3b570b..5635a87 100644
--- a/net/proxy/proxy_config_service_linux_unittest.cc
+++ b/net/proxy/proxy_config_service_linux_unittest.cc
@@ -1502,8 +1502,8 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEConfigParser) {
new ProxyConfigServiceLinux(env));
ProxyConfig config;
// Overwrite the kioslaverc file.
- file_util::WriteFile(kioslaverc_, tests[i].kioslaverc.c_str(),
- tests[i].kioslaverc.length());
+ base::WriteFile(kioslaverc_, tests[i].kioslaverc.c_str(),
+ tests[i].kioslaverc.length());
sync_config_getter.SetupAndInitialFetch();
ProxyConfigService::ConfigAvailability availability =
sync_config_getter.SyncGetLatestProxyConfig(&config);
@@ -1526,7 +1526,7 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEHomePicker) {
GURL slaverc4_pac_url("http://wpad/wpad.dat");
// Overwrite the .kde kioslaverc file.
- file_util::WriteFile(kioslaverc_, slaverc3.c_str(), slaverc3.length());
+ base::WriteFile(kioslaverc_, slaverc3.c_str(), slaverc3.length());
// If .kde4 exists it will mess up the first test. It should not, as
// we created the directory for $HOME in the test setup.
@@ -1549,7 +1549,7 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEHomePicker) {
// Now create .kde4 and put a kioslaverc in the config directory.
// Note that its timestamp will be at least as new as the .kde one.
base::CreateDirectory(kde4_config_);
- file_util::WriteFile(kioslaverc4_, slaverc4.c_str(), slaverc4.length());
+ base::WriteFile(kioslaverc4_, slaverc4.c_str(), slaverc4.length());
CHECK(base::PathExists(kioslaverc4_));
{ SCOPED_TRACE("KDE4, .kde4 directory present, use it");
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc
index aa1f43b..0fe89ef 100644
--- a/net/spdy/spdy_network_transaction_unittest.cc
+++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -449,7 +449,7 @@ class SpdyNetworkTransactionTest
base::FilePath file_path;
CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path));
CHECK_EQ(static_cast<int>(kUploadDataSize),
- file_util::WriteFile(file_path, kUploadData, kUploadDataSize));
+ base::WriteFile(file_path, kUploadData, kUploadDataSize));
ScopedVector<UploadElementReader> element_readers;
element_readers.push_back(
@@ -476,7 +476,7 @@ class SpdyNetworkTransactionTest
base::FilePath file_path;
CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path));
CHECK_EQ(static_cast<int>(kUploadDataSize),
- file_util::WriteFile(file_path, kUploadData, kUploadDataSize));
+ base::WriteFile(file_path, kUploadData, kUploadDataSize));
CHECK(file_util::MakeFileUnreadable(file_path));
ScopedVector<UploadElementReader> element_readers;
@@ -505,7 +505,7 @@ class SpdyNetworkTransactionTest
base::FilePath file_path;
CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path));
CHECK_EQ(static_cast<int>(kUploadDataSize),
- file_util::WriteFile(file_path, kUploadData, kUploadDataSize));
+ base::WriteFile(file_path, kUploadData, kUploadDataSize));
ScopedVector<UploadElementReader> element_readers;
element_readers.push_back(
diff --git a/net/tools/crl_set_dump/crl_set_dump.cc b/net/tools/crl_set_dump/crl_set_dump.cc
index 6c3bb54..ce6f5e5 100644
--- a/net/tools/crl_set_dump/crl_set_dump.cc
+++ b/net/tools/crl_set_dump/crl_set_dump.cc
@@ -62,8 +62,7 @@ int main(int argc, char** argv) {
if (!output_filename.empty()) {
const std::string out = final_crl_set->Serialize();
- if (file_util::WriteFile(output_filename, out.data(),
- out.size()) == -1) {
+ if (base::WriteFile(output_filename, out.data(), out.size()) == -1) {
fprintf(stderr, "Failed to write resulting CRL set\n");
return 1;
}
diff --git a/net/tools/tld_cleanup/tld_cleanup_util.cc b/net/tools/tld_cleanup/tld_cleanup_util.cc
index 623403f..88b6245 100644
--- a/net/tools/tld_cleanup/tld_cleanup_util.cc
+++ b/net/tools/tld_cleanup/tld_cleanup_util.cc
@@ -61,7 +61,7 @@ bool WriteRules(const RuleMap& rules, const base::FilePath& outfile) {
data.append("%%\n");
- int written = file_util::WriteFile(outfile,
+ int written = base::WriteFile(outfile,
data.data(),
static_cast<int>(data.size()));
diff --git a/net/url_request/url_fetcher_impl_unittest.cc b/net/url_request/url_fetcher_impl_unittest.cc
index c96993f..39e2bb2 100644
--- a/net/url_request/url_fetcher_impl_unittest.cc
+++ b/net/url_request/url_fetcher_impl_unittest.cc
@@ -1433,7 +1433,7 @@ TEST_F(URLFetcherFileTest, OverwriteExistingFile) {
std::string data(10000, '?'); // Meant to be larger than simple.html.
file_path_ = temp_dir.path().AppendASCII(kFileToFetch);
ASSERT_EQ(static_cast<int>(data.size()),
- file_util::WriteFile(file_path_, data.data(), data.size()));
+ base::WriteFile(file_path_, data.data(), data.size()));
ASSERT_TRUE(base::PathExists(file_path_));
expected_file_ = test_server.GetDocumentRoot().AppendASCII(kFileToFetch);
ASSERT_FALSE(base::ContentsEqual(file_path_, expected_file_));
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index 63e7c75..452e7e0 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -738,7 +738,7 @@ TEST_F(URLRequestTest, FileTestFullSpecifiedRange) {
base::FilePath temp_path;
EXPECT_TRUE(base::CreateTemporaryFile(&temp_path));
GURL temp_url = FilePathToFileURL(temp_path);
- EXPECT_TRUE(file_util::WriteFile(temp_path, buffer.get(), buffer_size));
+ EXPECT_TRUE(base::WriteFile(temp_path, buffer.get(), buffer_size));
int64 file_size;
EXPECT_TRUE(base::GetFileSize(temp_path, &file_size));
@@ -782,7 +782,7 @@ TEST_F(URLRequestTest, FileTestHalfSpecifiedRange) {
base::FilePath temp_path;
EXPECT_TRUE(base::CreateTemporaryFile(&temp_path));
GURL temp_url = FilePathToFileURL(temp_path);
- EXPECT_TRUE(file_util::WriteFile(temp_path, buffer.get(), buffer_size));
+ EXPECT_TRUE(base::WriteFile(temp_path, buffer.get(), buffer_size));
int64 file_size;
EXPECT_TRUE(base::GetFileSize(temp_path, &file_size));
@@ -825,7 +825,7 @@ TEST_F(URLRequestTest, FileTestMultipleRanges) {
base::FilePath temp_path;
EXPECT_TRUE(base::CreateTemporaryFile(&temp_path));
GURL temp_url = FilePathToFileURL(temp_path);
- EXPECT_TRUE(file_util::WriteFile(temp_path, buffer.get(), buffer_size));
+ EXPECT_TRUE(base::WriteFile(temp_path, buffer.get(), buffer_size));
int64 file_size;
EXPECT_TRUE(base::GetFileSize(temp_path, &file_size));
@@ -853,7 +853,7 @@ TEST_F(URLRequestTest, AllowFileURLs) {
base::FilePath test_file;
ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir.path(), &test_file));
std::string test_data("monkey");
- file_util::WriteFile(test_file, test_data.data(), test_data.size());
+ base::WriteFile(test_file, test_data.data(), test_data.size());
GURL test_file_url = net::FilePathToFileURL(test_file);
{
diff --git a/printing/backend/cups_helper.cc b/printing/backend/cups_helper.cc
index 6a0e220..9215bb9 100644
--- a/printing/backend/cups_helper.cc
+++ b/printing/backend/cups_helper.cc
@@ -346,7 +346,7 @@ bool ParsePpdCapabilities(
return false;
int data_size = printer_capabilities.length();
- if (data_size != file_util::WriteFile(
+ if (data_size != base::WriteFile(
ppd_file_path,
printer_capabilities.data(),
data_size)) {
diff --git a/printing/image.cc b/printing/image.cc
index 1d65f28..bae89f8a 100644
--- a/printing/image.cc
+++ b/printing/image.cc
@@ -70,7 +70,7 @@ bool Image::SaveToPng(const base::FilePath& filepath) const {
&compressed);
DCHECK(success && compressed.size());
if (success) {
- int write_bytes = file_util::WriteFile(
+ int write_bytes = base::WriteFile(
filepath,
reinterpret_cast<char*>(&*compressed.begin()),
base::checked_cast<int>(compressed.size()));
diff --git a/printing/pdf_metafile_skia.cc b/printing/pdf_metafile_skia.cc
index a92bb86..4e6ceaa 100644
--- a/printing/pdf_metafile_skia.cc
+++ b/printing/pdf_metafile_skia.cc
@@ -128,9 +128,9 @@ bool PdfMetafileSkia::GetData(void* dst_buffer,
bool PdfMetafileSkia::SaveTo(const base::FilePath& file_path) const {
DCHECK_GT(data_->pdf_stream_.getOffset(), 0U);
SkAutoDataUnref data(data_->pdf_stream_.copyToData());
- if (file_util::WriteFile(file_path,
- reinterpret_cast<const char*>(data->data()),
- GetDataSize()) != static_cast<int>(GetDataSize())) {
+ if (base::WriteFile(file_path,
+ reinterpret_cast<const char*>(data->data()),
+ GetDataSize()) != static_cast<int>(GetDataSize())) {
DLOG(ERROR) << "Failed to save file " << file_path.value().c_str();
return false;
}
@@ -203,9 +203,9 @@ bool PdfMetafileSkia::SaveToFD(const base::FileDescriptor& fd) const {
bool result = true;
SkAutoDataUnref data(data_->pdf_stream_.copyToData());
- if (file_util::WriteFileDescriptor(fd.fd,
- reinterpret_cast<const char*>(data->data()),
- GetDataSize()) !=
+ if (base::WriteFileDescriptor(fd.fd,
+ reinterpret_cast<const char*>(data->data()),
+ GetDataSize()) !=
static_cast<int>(GetDataSize())) {
DLOG(ERROR) << "Failed to save file with fd " << fd.fd;
result = false;
diff --git a/remoting/host/config_file_watcher_unittest.cc b/remoting/host/config_file_watcher_unittest.cc
index 67b2e56..1a6217b 100644
--- a/remoting/host/config_file_watcher_unittest.cc
+++ b/remoting/host/config_file_watcher_unittest.cc
@@ -96,7 +96,7 @@ void ConfigFileWatcherTest::TearDown() {
// Verifies that the initial notification is delivered.
TEST_F(ConfigFileWatcherTest, Basic) {
std::string data("test");
- EXPECT_NE(file_util::WriteFile(config_file_, data.c_str(),
+ EXPECT_NE(base::WriteFile(config_file_, data.c_str(),
static_cast<int>(data.size())), -1);
EXPECT_CALL(delegate_, OnConfigUpdated(_))
@@ -125,7 +125,7 @@ TEST_F(ConfigFileWatcherTest, Update) {
// Modify the watched file.
std::string data("test");
- EXPECT_NE(file_util::WriteFile(config_file_, data.c_str(),
+ EXPECT_NE(base::WriteFile(config_file_, data.c_str(),
static_cast<int>(data.size())), -1);
run_loop_.Run();
diff --git a/remoting/host/json_host_config_unittest.cc b/remoting/host/json_host_config_unittest.cc
index 76f2912..a3fdf96 100644
--- a/remoting/host/json_host_config_unittest.cc
+++ b/remoting/host/json_host_config_unittest.cc
@@ -25,7 +25,7 @@ const char* kTestConfig =
class JsonHostConfigTest : public testing::Test {
protected:
static void WriteTestFile(const base::FilePath& filename) {
- file_util::WriteFile(filename, kTestConfig, std::strlen(kTestConfig));
+ base::WriteFile(filename, kTestConfig, std::strlen(kTestConfig));
}
// The temporary directory used to contain the test operations.
diff --git a/remoting/host/setup/daemon_controller_delegate_mac.mm b/remoting/host/setup/daemon_controller_delegate_mac.mm
index bb27e88..c2926b0 100644
--- a/remoting/host/setup/daemon_controller_delegate_mac.mm
+++ b/remoting/host/setup/daemon_controller_delegate_mac.mm
@@ -230,7 +230,7 @@ bool DaemonControllerDelegateMac::DoShowPreferencePane(
}
config_path = config_path.Append(kHostConfigFileName);
- int written = file_util::WriteFile(config_path, config_data.data(),
+ int written = base::WriteFile(config_path, config_data.data(),
config_data.size());
if (written != static_cast<int>(config_data.size())) {
LOG(ERROR) << "Failed to save configuration data to: "
diff --git a/skia/ext/image_operations_unittest.cc b/skia/ext/image_operations_unittest.cc
index c7069e2..da55e4f 100644
--- a/skia/ext/image_operations_unittest.cc
+++ b/skia/ext/image_operations_unittest.cc
@@ -204,7 +204,7 @@ void SaveBitmapToPNG(const SkBitmap& bmp, const char* path) {
const base::FilePath fpath(path);
const int num_written =
- file_util::WriteFile(fpath, reinterpret_cast<const char*>(&png[0]),
+ base::WriteFile(fpath, reinterpret_cast<const char*>(&png[0]),
png.size());
if (num_written != static_cast<int>(png.size())) {
FAIL() << "Failed to write dest \"" << path << '"';
diff --git a/third_party/zlib/google/zip_reader.cc b/third_party/zlib/google/zip_reader.cc
index 5bcc264..915dbbc 100644
--- a/third_party/zlib/google/zip_reader.cc
+++ b/third_party/zlib/google/zip_reader.cc
@@ -333,7 +333,7 @@ bool ZipReader::ExtractCurrentEntryToFd(const int fd) {
} else if (num_bytes_read > 0) {
// Some data is read. Write it to the output file descriptor.
if (num_bytes_read !=
- file_util::WriteFileDescriptor(fd, buf, num_bytes_read)) {
+ base::WriteFileDescriptor(fd, buf, num_bytes_read)) {
success = false;
break;
}
diff --git a/third_party/zlib/google/zip_unittest.cc b/third_party/zlib/google/zip_unittest.cc
index ea456f1..22e350f 100644
--- a/third_party/zlib/google/zip_unittest.cc
+++ b/third_party/zlib/google/zip_unittest.cc
@@ -139,7 +139,7 @@ class ZipTest : public PlatformTest {
now_parts.millisecond = 0;
base::Time now_time = base::Time::FromLocalExploded(now_parts);
- EXPECT_EQ(1, file_util::WriteFile(src_file, "1", 1));
+ EXPECT_EQ(1, base::WriteFile(src_file, "1", 1));
EXPECT_TRUE(base::TouchFile(src_file, base::Time::Now(), test_mtime));
EXPECT_TRUE(zip::Zip(src_dir, zip_file, true));
diff --git a/tools/gn/function_write_file.cc b/tools/gn/function_write_file.cc
index 9d606db..bfdc5a3e 100644
--- a/tools/gn/function_write_file.cc
+++ b/tools/gn/function_write_file.cc
@@ -77,7 +77,7 @@ Value RunWriteFile(Scope* scope,
return Value();
}
int int_size = static_cast<int>(contents_string.size());
- if (file_util::WriteFile(file_path, contents_string.c_str(), int_size)
+ if (base::WriteFile(file_path, contents_string.c_str(), int_size)
!= int_size) {
*err = Err(function->function(), "Unable to write file.",
"I was writing \"" + FilePathToUTF8(file_path) + "\".");
diff --git a/tools/gn/gyp_target_writer.cc b/tools/gn/gyp_target_writer.cc
index 1c1a6a5..0f362d4 100644
--- a/tools/gn/gyp_target_writer.cc
+++ b/tools/gn/gyp_target_writer.cc
@@ -102,7 +102,7 @@ void GypTargetWriter::WriteFile(const SourceFile& gyp_file,
file << " ],\n}\n";
std::string contents = file.str();
- file_util::WriteFile(gyp_file_path, contents.c_str(),
+ base::WriteFile(gyp_file_path, contents.c_str(),
static_cast<int>(contents.size()));
}
diff --git a/tools/gn/ninja_target_writer.cc b/tools/gn/ninja_target_writer.cc
index 4152336..adb1108 100644
--- a/tools/gn/ninja_target_writer.cc
+++ b/tools/gn/ninja_target_writer.cc
@@ -78,8 +78,8 @@ void NinjaTargetWriter::RunAndWriteFile(const Target* target,
}
std::string contents = file.str();
- file_util::WriteFile(ninja_file, contents.c_str(),
- static_cast<int>(contents.size()));
+ base::WriteFile(ninja_file, contents.c_str(),
+ static_cast<int>(contents.size()));
}
std::string NinjaTargetWriter::GetSourcesImplicitDeps() const {
diff --git a/tools/gn/trace.cc b/tools/gn/trace.cc
index 18082c4..26fb276 100644
--- a/tools/gn/trace.cc
+++ b/tools/gn/trace.cc
@@ -290,6 +290,6 @@ void SaveTraces(const base::FilePath& file_name) {
out << "]}";
std::string out_str = out.str();
- file_util::WriteFile(file_name, out_str.data(),
+ base::WriteFile(file_name, out_str.data(),
static_cast<int>(out_str.size()));
}
diff --git a/tools/imagediff/image_diff.cc b/tools/imagediff/image_diff.cc
index 47d86bb..c7fad6a 100644
--- a/tools/imagediff/image_diff.cc
+++ b/tools/imagediff/image_diff.cc
@@ -384,7 +384,7 @@ int DiffImages(const base::FilePath& file1, const base::FilePath& file2,
image_diff_png::EncodeRGBAPNG(
diff_image.data(), diff_image.w(), diff_image.h(),
diff_image.w() * 4, &png_encoding);
- if (file_util::WriteFile(out_file,
+ if (base::WriteFile(out_file,
reinterpret_cast<char*>(&png_encoding.front()),
base::checked_cast<int>(png_encoding.size())) < 0)
return kStatusError;
diff --git a/ui/base/l10n/l10n_util_unittest.cc b/ui/base/l10n/l10n_util_unittest.cc
index 3cf7025..2d33a0f 100644
--- a/ui/base/l10n/l10n_util_unittest.cc
+++ b/ui/base/l10n/l10n_util_unittest.cc
@@ -128,7 +128,7 @@ TEST_F(L10nUtilTest, GetAppLocale) {
for (size_t i = 0; i < arraysize(filenames); ++i) {
base::FilePath filename = new_locale_dir.AppendASCII(
filenames[i] + ".pak");
- file_util::WriteFile(filename, "", 0);
+ base::WriteFile(filename, "", 0);
}
// Keep a copy of ICU's default locale before we overwrite it.
diff --git a/ui/base/resource/data_pack_unittest.cc b/ui/base/resource/data_pack_unittest.cc
index e3cd2fb..1840d70 100644
--- a/ui/base/resource/data_pack_unittest.cc
+++ b/ui/base/resource/data_pack_unittest.cc
@@ -28,7 +28,7 @@ TEST(DataPackTest, LoadFromPath) {
base::FilePath data_path = dir.path().Append(FILE_PATH_LITERAL("sample.pak"));
// Dump contents into the pak file.
- ASSERT_EQ(file_util::WriteFile(data_path, kSamplePakContents, kSamplePakSize),
+ ASSERT_EQ(base::WriteFile(data_path, kSamplePakContents, kSamplePakSize),
static_cast<int>(kSamplePakSize));
// Load the file through the data pack API.
@@ -60,7 +60,7 @@ TEST(DataPackTest, LoadFromFile) {
base::FilePath data_path = dir.path().Append(FILE_PATH_LITERAL("sample.pak"));
// Dump contents into the pak file.
- ASSERT_EQ(file_util::WriteFile(data_path, kSamplePakContents, kSamplePakSize),
+ ASSERT_EQ(base::WriteFile(data_path, kSamplePakContents, kSamplePakSize),
static_cast<int>(kSamplePakSize));
base::File file(data_path, base::File::FLAG_OPEN | base::File::FLAG_READ);
diff --git a/ui/base/resource/resource_bundle_unittest.cc b/ui/base/resource/resource_bundle_unittest.cc
index cfd4a44..5133607 100644
--- a/ui/base/resource/resource_bundle_unittest.cc
+++ b/ui/base/resource/resource_bundle_unittest.cc
@@ -359,7 +359,7 @@ class ResourceBundleImageTest : public ResourceBundleTest {
// Write an empty data pak for locale data.
const base::FilePath& locale_path = dir_path().Append(
FILE_PATH_LITERAL("locale.pak"));
- EXPECT_EQ(file_util::WriteFile(locale_path, kEmptyPakContents,
+ EXPECT_EQ(base::WriteFile(locale_path, kEmptyPakContents,
kEmptyPakSize),
static_cast<int>(kEmptyPakSize));
@@ -386,7 +386,7 @@ TEST_F(ResourceBundleImageTest, LoadDataResourceBytes) {
base::FilePath data_path = dir_path().Append(FILE_PATH_LITERAL("sample.pak"));
// Dump contents into the pak files.
- ASSERT_EQ(file_util::WriteFile(data_path, kEmptyPakContents,
+ ASSERT_EQ(base::WriteFile(data_path, kEmptyPakContents,
kEmptyPakSize), static_cast<int>(kEmptyPakSize));
// Create a resource bundle from the file.
@@ -411,9 +411,9 @@ TEST_F(ResourceBundleImageTest, GetRawDataResource) {
dir_path().Append(FILE_PATH_LITERAL("sample_2x.pak"));
// Dump contents into the pak files.
- ASSERT_EQ(file_util::WriteFile(data_path, kSamplePakContents,
+ ASSERT_EQ(base::WriteFile(data_path, kSamplePakContents,
kSamplePakSize), static_cast<int>(kSamplePakSize));
- ASSERT_EQ(file_util::WriteFile(data_2x_path, kSamplePakContents2x,
+ ASSERT_EQ(base::WriteFile(data_2x_path, kSamplePakContents2x,
kSamplePakSize2x), static_cast<int>(kSamplePakSize2x));
// Load the regular and 2x pak files.
diff --git a/ui/gfx/ozone/impl/file_surface_factory.cc b/ui/gfx/ozone/impl/file_surface_factory.cc
index 1f440db..5d3d554 100644
--- a/ui/gfx/ozone/impl/file_surface_factory.cc
+++ b/ui/gfx/ozone/impl/file_surface_factory.cc
@@ -20,9 +20,9 @@ void WriteDataToFile(const base::FilePath& location,
const SkBitmap& bitmap) {
std::vector<unsigned char> png_data;
gfx::PNGCodec::FastEncodeBGRASkBitmap(bitmap, true, &png_data);
- file_util::WriteFile(location,
- (char*)vector_as_array(&png_data),
- png_data.size());
+ base::WriteFile(location,
+ static_cast<const char*>(vector_as_array(&png_data)),
+ png_data.size());
}
}
diff --git a/webkit/browser/appcache/appcache_database_unittest.cc b/webkit/browser/appcache/appcache_database_unittest.cc
index 641ab06..c432066 100644
--- a/webkit/browser/appcache/appcache_database_unittest.cc
+++ b/webkit/browser/appcache/appcache_database_unittest.cc
@@ -57,7 +57,7 @@ TEST(AppCacheDatabaseTest, ReCreate) {
const base::FilePath kNestedDir = temp_dir.path().AppendASCII("nested");
const base::FilePath kOtherFile = kNestedDir.AppendASCII("other_file");
EXPECT_TRUE(base::CreateDirectory(kNestedDir));
- EXPECT_EQ(3, file_util::WriteFile(kOtherFile, "foo", 3));
+ EXPECT_EQ(3, base::WriteFile(kOtherFile, "foo", 3));
AppCacheDatabase db(kDbFile);
EXPECT_FALSE(db.LazyOpen(false));
@@ -90,7 +90,7 @@ TEST(AppCacheDatabaseTest, QuickIntegrityCheck) {
const base::FilePath kDbFile = mock_dir.AppendASCII("appcache.db");
const base::FilePath kOtherFile = mock_dir.AppendASCII("other_file");
- EXPECT_EQ(3, file_util::WriteFile(kOtherFile, "foo", 3));
+ EXPECT_EQ(3, base::WriteFile(kOtherFile, "foo", 3));
// First create a valid db file.
AppCacheDatabase db(kDbFile);
@@ -150,7 +150,7 @@ TEST(AppCacheDatabaseTest, ExperimentalFlags) {
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
const base::FilePath kDbFile = temp_dir.path().AppendASCII("appcache.db");
const base::FilePath kOtherFile = temp_dir.path().AppendASCII("other_file");
- EXPECT_EQ(3, file_util::WriteFile(kOtherFile, "foo", 3));
+ EXPECT_EQ(3, base::WriteFile(kOtherFile, "foo", 3));
EXPECT_TRUE(base::PathExists(kOtherFile));
AppCacheDatabase db(kDbFile);
diff --git a/webkit/browser/appcache/appcache_storage_impl_unittest.cc b/webkit/browser/appcache/appcache_storage_impl_unittest.cc
index e894004..7eba545 100644
--- a/webkit/browser/appcache/appcache_storage_impl_unittest.cc
+++ b/webkit/browser/appcache/appcache_storage_impl_unittest.cc
@@ -1658,7 +1658,7 @@ class AppCacheStorageImplTest : public testing::Test {
ASSERT_TRUE(base::CreateDirectory(disk_cache_directory));
base::FilePath index_file = disk_cache_directory.AppendASCII("index");
EXPECT_EQ(static_cast<int>(kCorruptData.length()),
- file_util::WriteFile(
+ base::WriteFile(
index_file, kCorruptData.data(), kCorruptData.length()));
}
diff --git a/webkit/browser/blob/local_file_stream_reader_unittest.cc b/webkit/browser/blob/local_file_stream_reader_unittest.cc
index 43001ef..1e46476 100644
--- a/webkit/browser/blob/local_file_stream_reader_unittest.cc
+++ b/webkit/browser/blob/local_file_stream_reader_unittest.cc
@@ -66,7 +66,7 @@ class LocalFileStreamReaderTest : public testing::Test {
ASSERT_TRUE(file_thread_.Start());
ASSERT_TRUE(dir_.CreateUniqueTempDir());
- file_util::WriteFile(test_path(), kTestData, kTestDataSize);
+ base::WriteFile(test_path(), kTestData, kTestDataSize);
base::File::Info info;
ASSERT_TRUE(base::GetFileInfo(test_path(), &info));
test_file_modification_time_ = info.last_modified;
diff --git a/webkit/browser/database/database_tracker_unittest.cc b/webkit/browser/database/database_tracker_unittest.cc
index 6422ac1..2e8b121 100644
--- a/webkit/browser/database/database_tracker_unittest.cc
+++ b/webkit/browser/database/database_tracker_unittest.cc
@@ -229,11 +229,11 @@ class DatabaseTracker_TestHelper_Test {
EXPECT_TRUE(base::CreateDirectory(
tracker->DatabaseDirectory().Append(base::FilePath::FromUTF16Unsafe(
tracker->GetOriginDirectory(kOrigin2)))));
- EXPECT_EQ(1, file_util::WriteFile(
+ EXPECT_EQ(1, base::WriteFile(
tracker->GetFullDBFilePath(kOrigin1, kDB1), "a", 1));
- EXPECT_EQ(2, file_util::WriteFile(
+ EXPECT_EQ(2, base::WriteFile(
tracker->GetFullDBFilePath(kOrigin2, kDB2), "aa", 2));
- EXPECT_EQ(3, file_util::WriteFile(
+ EXPECT_EQ(3, base::WriteFile(
tracker->GetFullDBFilePath(kOrigin2, kDB3), "aaa", 3));
tracker->DatabaseModified(kOrigin1, kDB1);
tracker->DatabaseModified(kOrigin2, kDB2);
@@ -261,7 +261,7 @@ class DatabaseTracker_TestHelper_Test {
EXPECT_TRUE(base::CreateDirectory(
tracker->DatabaseDirectory().Append(base::FilePath::FromUTF16Unsafe(
tracker->GetOriginDirectory(kOrigin1)))));
- EXPECT_EQ(1, file_util::WriteFile(
+ EXPECT_EQ(1, base::WriteFile(
tracker->GetFullDBFilePath(kOrigin1, kDB1), "a", 1));
tracker->DatabaseModified(kOrigin1, kDB1);
@@ -357,11 +357,11 @@ class DatabaseTracker_TestHelper_Test {
EXPECT_TRUE(base::CreateDirectory(
tracker->DatabaseDirectory().Append(base::FilePath::FromUTF16Unsafe(
tracker->GetOriginDirectory(kOrigin2)))));
- EXPECT_EQ(1, file_util::WriteFile(
+ EXPECT_EQ(1, base::WriteFile(
tracker->GetFullDBFilePath(kOrigin1, kDB1), "a", 1));
- EXPECT_EQ(2, file_util::WriteFile(
+ EXPECT_EQ(2, base::WriteFile(
tracker->GetFullDBFilePath(kOrigin2, kDB2), "aa", 2));
- EXPECT_EQ(4, file_util::WriteFile(
+ EXPECT_EQ(4, base::WriteFile(
tracker->GetFullDBFilePath(kOrigin1, kDB3), "aaaa", 4));
tracker->DatabaseModified(kOrigin1, kDB1);
CheckNotificationReceived(&observer1, kOrigin1, kDB1, 1);
diff --git a/webkit/browser/fileapi/local_file_stream_writer_unittest.cc b/webkit/browser/fileapi/local_file_stream_writer_unittest.cc
index 96bccf6..53c559a 100644
--- a/webkit/browser/fileapi/local_file_stream_writer_unittest.cc
+++ b/webkit/browser/fileapi/local_file_stream_writer_unittest.cc
@@ -70,7 +70,7 @@ class LocalFileStreamWriterTest : public testing::Test {
base::FilePath CreateFileWithContent(const std::string& name,
const std::string& data) {
base::FilePath path = Path(name);
- file_util::WriteFile(path, data.c_str(), data.size());
+ base::WriteFile(path, data.c_str(), data.size());
return path;
}
diff --git a/webkit/browser/fileapi/sandbox_prioritized_origin_database_unittest.cc b/webkit/browser/fileapi/sandbox_prioritized_origin_database_unittest.cc
index 3a290cf..c93b839 100644
--- a/webkit/browser/fileapi/sandbox_prioritized_origin_database_unittest.cc
+++ b/webkit/browser/fileapi/sandbox_prioritized_origin_database_unittest.cc
@@ -123,8 +123,7 @@ TEST(SandboxPrioritizedOriginDatabaseTest, LostPrimaryOriginFileTest) {
EXPECT_TRUE(database.GetPathForOrigin(kOrigin1, &path));
// Corrupt the primary origin file.
- file_util::WriteFile(
- database.primary_origin_file(), kData.data(), kData.size());
+ base::WriteFile(database.primary_origin_file(), kData.data(), kData.size());
// Reset the database.
database.DropDatabase();
@@ -164,15 +163,15 @@ TEST(SandboxPrioritizedOriginDatabaseTest, MigrationTest) {
old_dir_db_path1 = dir.path().Append(path1);
ASSERT_TRUE(base::CreateDirectory(old_dir_db_path1));
EXPECT_EQ(static_cast<int>(kFakeDirectoryData1.size()),
- file_util::WriteFile(old_dir_db_path1.AppendASCII("dummy"),
- kFakeDirectoryData1.data(),
- kFakeDirectoryData1.size()));
+ base::WriteFile(old_dir_db_path1.AppendASCII("dummy"),
+ kFakeDirectoryData1.data(),
+ kFakeDirectoryData1.size()));
old_dir_db_path2 = dir.path().Append(path2);
ASSERT_TRUE(base::CreateDirectory(old_dir_db_path2));
EXPECT_EQ(static_cast<int>(kFakeDirectoryData2.size()),
- file_util::WriteFile(old_dir_db_path2.AppendASCII("dummy"),
- kFakeDirectoryData2.data(),
- kFakeDirectoryData2.size()));
+ base::WriteFile(old_dir_db_path2.AppendASCII("dummy"),
+ kFakeDirectoryData2.data(),
+ kFakeDirectoryData2.size()));
}
// Re-open the directory using sandboxPrioritizedOriginDatabase.