Replace base::StringPiece in //storage with std::string_view
Bug: 691162 Change-Id: Iaa3e711b503d2b3845302da8dbf556d509c73858 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5033963 Reviewed-by: Ayu Ishii <ayui@chromium.org> Commit-Queue: Hyowon Kim <hyowon@igalia.com> Cr-Commit-Position: refs/heads/main@{#1225854}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
a5b601d050
commit
dd731283e6
storage
@ -3,7 +3,6 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "storage/browser/database/database_util.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "storage/common/database/database_identifier.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
@ -26,8 +26,8 @@ namespace storage {
|
||||
// TouchFile to manipulate files for their particular implementation.
|
||||
class FileStreamReaderTest : public testing::Test {
|
||||
public:
|
||||
static constexpr base::StringPiece kTestFileName = "test.dat";
|
||||
static constexpr base::StringPiece kTestData = "0123456789";
|
||||
static constexpr std::string_view kTestFileName = "test.dat";
|
||||
static constexpr std::string_view kTestData = "0123456789";
|
||||
|
||||
virtual std::unique_ptr<FileStreamReader> CreateFileReader(
|
||||
const std::string& file_name,
|
||||
|
@ -27,7 +27,7 @@ namespace storage {
|
||||
// GetFileContent to manipulate files for their particular implementation.
|
||||
class FileStreamWriterTest : public testing::Test {
|
||||
public:
|
||||
static constexpr base::StringPiece kTestFileName = "file_a";
|
||||
static constexpr std::string_view kTestFileName = "file_a";
|
||||
|
||||
virtual bool CreateFileWithContent(const std::string& name,
|
||||
const std::string& data) = 0;
|
||||
|
@ -817,7 +817,7 @@ TEST_F(FileSystemOperationImplTest, TestCopySuccessSamePath) {
|
||||
TEST_F(FileSystemOperationImplTest, TestCopyInForeignFileSuccess) {
|
||||
base::FilePath src_local_disk_file_path;
|
||||
base::CreateTemporaryFile(&src_local_disk_file_path);
|
||||
constexpr base::StringPiece test_data = "foo";
|
||||
constexpr std::string_view test_data = "foo";
|
||||
constexpr int data_size = test_data.size();
|
||||
base::WriteFile(src_local_disk_file_path, test_data);
|
||||
|
||||
@ -847,7 +847,7 @@ TEST_F(FileSystemOperationImplTest, TestCopyInForeignFileSuccess) {
|
||||
TEST_F(FileSystemOperationImplTest, TestCopyInForeignFileFailureByQuota) {
|
||||
base::FilePath src_local_disk_file_path;
|
||||
base::CreateTemporaryFile(&src_local_disk_file_path);
|
||||
constexpr base::StringPiece test_data = "foo";
|
||||
constexpr std::string_view test_data = "foo";
|
||||
base::WriteFile(src_local_disk_file_path, test_data);
|
||||
|
||||
FileSystemURL dest_dir(CreateDirectory("dest"));
|
||||
@ -1074,7 +1074,7 @@ TEST_F(FileSystemOperationImplTest, TestTruncate) {
|
||||
FileSystemURL file(CreateFile("file"));
|
||||
base::FilePath platform_path = PlatformPath("file");
|
||||
|
||||
constexpr base::StringPiece test_data = "test data";
|
||||
constexpr std::string_view test_data = "test data";
|
||||
constexpr int data_size = test_data.size();
|
||||
EXPECT_TRUE(base::WriteFile(platform_path, test_data));
|
||||
|
||||
|
@ -95,7 +95,7 @@ class LocalFileStreamReaderTest : public FileStreamReaderTest {
|
||||
size_t buf_size,
|
||||
base::Time* modification_time) override {
|
||||
base::FilePath path = test_dir().AppendASCII(file_name);
|
||||
base::WriteFile(path, base::StringPiece(buf, buf_size));
|
||||
base::WriteFile(path, std::string_view(buf, buf_size));
|
||||
|
||||
base::File::Info file_info;
|
||||
ASSERT_TRUE(base::GetFileInfo(path, &file_info));
|
||||
|
@ -234,8 +234,9 @@ base::File::Error AsyncFileTestHelper::CreateFileWithData(
|
||||
if (!dir.CreateUniqueTempDir())
|
||||
return base::File::FILE_ERROR_FAILED;
|
||||
base::FilePath local_path = dir.GetPath().AppendASCII("tmp");
|
||||
if (!base::WriteFile(local_path, base::StringPiece(buf, buf_size)))
|
||||
if (!base::WriteFile(local_path, std::string_view(buf, buf_size))) {
|
||||
return base::File::FILE_ERROR_FAILED;
|
||||
}
|
||||
base::File::Error result = base::File::FILE_ERROR_FAILED;
|
||||
base::RunLoop run_loop;
|
||||
context->operation_runner()->CopyInForeignFile(
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <string>
|
||||
|
||||
#include "base/component_export.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "url/gurl.h"
|
||||
#include "url/origin.h"
|
||||
|
||||
|
Reference in New Issue
Block a user