Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Unified Diff: components/filesystem/directory_impl_unittest.cc

Issue 2607063002: Remove mojo::Array. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/filesystem/directory_impl_unittest.cc
diff --git a/components/filesystem/directory_impl_unittest.cc b/components/filesystem/directory_impl_unittest.cc
index 771749704782693554407a40b3417d8f1ae6a204..38410a2f7658de94bb85aa85bca19df8199147b2 100644
--- a/components/filesystem/directory_impl_unittest.cc
+++ b/components/filesystem/directory_impl_unittest.cc
@@ -10,13 +10,14 @@
#include "base/macros.h"
#include "components/filesystem/files_test_base.h"
-#include "mojo/common/common_type_converters.h"
namespace filesystem {
namespace {
using DirectoryImplTest = FilesTestBase;
+constexpr char kData[] = "one two three";
+
TEST_F(DirectoryImplTest, Read) {
mojom::DirectoryPtr directory;
GetTemporaryRoot(&directory);
@@ -169,10 +170,9 @@ TEST_F(DirectoryImplTest, Clone) {
// deleted since it has clones.
}
- std::string data("one two three");
+ std::vector<uint8_t> data(kData, kData + strlen(kData));
{
- bool handled =
- clone_one->WriteFile("data", mojo::Array<uint8_t>::From(data), &error);
+ bool handled = clone_one->WriteFile("data", data, &error);
ASSERT_TRUE(handled);
EXPECT_EQ(mojom::FileError::OK, error);
}
@@ -183,8 +183,7 @@ TEST_F(DirectoryImplTest, Clone) {
ASSERT_TRUE(handled);
EXPECT_EQ(mojom::FileError::OK, error);
- EXPECT_EQ(data,
- mojo::Array<uint8_t>(std::move(file_contents)).To<std::string>());
+ EXPECT_EQ(data, file_contents);
}
}
@@ -193,10 +192,9 @@ TEST_F(DirectoryImplTest, WriteFileReadFile) {
GetTemporaryRoot(&directory);
mojom::FileError error;
- std::string data("one two three");
+ std::vector<uint8_t> data(kData, kData + strlen(kData));
{
- bool handled =
- directory->WriteFile("data", mojo::Array<uint8_t>::From(data), &error);
+ bool handled = directory->WriteFile("data", data, &error);
ASSERT_TRUE(handled);
EXPECT_EQ(mojom::FileError::OK, error);
}
@@ -207,8 +205,7 @@ TEST_F(DirectoryImplTest, WriteFileReadFile) {
ASSERT_TRUE(handled);
EXPECT_EQ(mojom::FileError::OK, error);
- EXPECT_EQ(data,
- mojo::Array<uint8_t>(std::move(file_contents)).To<std::string>());
+ EXPECT_EQ(data, file_contents);
}
}
@@ -268,9 +265,8 @@ TEST_F(DirectoryImplTest, CantWriteFileOnADirectory) {
}
{
- std::string data("one two three");
- bool handled = directory->WriteFile(
- "my_dir", mojo::Array<uint8_t>::From(data), &error);
+ std::vector<uint8_t> data(kData, kData + strlen(kData));
+ bool handled = directory->WriteFile("my_dir", data, &error);
ASSERT_TRUE(handled);
EXPECT_EQ(mojom::FileError::NOT_A_FILE, error);
}

Powered by Google App Engine
This is Rietveld 408576698