diff options
Diffstat (limited to 'chrome/browser/extensions')
15 files changed, 32 insertions, 33 deletions
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; |