diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-06 20:42:30 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-06 20:42:30 +0000 |
commit | e5c2a22eb106e0fef92bbf80ac8bf2429980cc4e (patch) | |
tree | 480bf91e3cf64d69f837a2f22f8fc868bf17dfdc /chrome/browser/chromeos | |
parent | 06b1d42b0ceadd4a70b7462c5c7e6adeb5a18ca4 (diff) | |
download | chromium_src-e5c2a22eb106e0fef92bbf80ac8bf2429980cc4e.zip chromium_src-e5c2a22eb106e0fef92bbf80ac8bf2429980cc4e.tar.gz chromium_src-e5c2a22eb106e0fef92bbf80ac8bf2429980cc4e.tar.bz2 |
Move WriteFile and WriteFileDescriptor from file_util to base namespace.
R=viettrungluu@chromium.org
TBR=viettrungluu
Review URL: https://codereview.chromium.org/184563006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255418 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
27 files changed, 49 insertions, 55 deletions
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_)); |