Commit 1a4bf160 authored by Istiaque Ahmed's avatar Istiaque Ahmed Committed by Commit Bot

Extensions: Fix/add base::WriteFile assertions in two test files.

Bug: None
Change-Id: I89c72bc8905a6a7dd8e339ba328e92e67f949b3e
Reviewed-on: https://chromium-review.googlesource.com/894504Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Istiaque Ahmed <lazyboy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533327}
parent e8967cdb
...@@ -181,7 +181,9 @@ TEST_F(ContentVerifyJobUnittest, DeletedAndMissingFiles) { ...@@ -181,7 +181,9 @@ TEST_F(ContentVerifyJobUnittest, DeletedAndMissingFiles) {
base::FilePath full_path = base::FilePath full_path =
unzipped_path.Append(base::FilePath(unexpected_resource_path)); unzipped_path.Append(base::FilePath(unexpected_resource_path));
base::WriteFile(full_path, "42", sizeof("42")); const std::string kContent("42");
EXPECT_EQ(static_cast<int>(kContent.size()),
base::WriteFile(full_path, kContent.data(), kContent.size()));
std::string contents; std::string contents;
base::ReadFileToString(full_path, &contents); base::ReadFileToString(full_path, &contents);
......
...@@ -31,12 +31,14 @@ class JsonFileSanitizerTest : public testing::Test { ...@@ -31,12 +31,14 @@ class JsonFileSanitizerTest : public testing::Test {
void CreateValidJsonFile(const base::FilePath& path) { void CreateValidJsonFile(const base::FilePath& path) {
std::string kJson = "{\"hello\":\"bonjour\"}"; std::string kJson = "{\"hello\":\"bonjour\"}";
ASSERT_TRUE(base::WriteFile(path, kJson.data(), kJson.size())); ASSERT_EQ(static_cast<int>(kJson.size()),
base::WriteFile(path, kJson.data(), kJson.size()));
} }
void CreateInvalidJsonFile(const base::FilePath& path) { void CreateInvalidJsonFile(const base::FilePath& path) {
std::string kJson = "sjkdsk;'<?js"; std::string kJson = "sjkdsk;'<?js";
ASSERT_TRUE(base::WriteFile(path, kJson.data(), kJson.size())); ASSERT_EQ(static_cast<int>(kJson.size()),
base::WriteFile(path, kJson.data(), kJson.size()));
} }
const base::FilePath& GetJsonFilePath() const { return temp_dir_.GetPath(); } const base::FilePath& GetJsonFilePath() const { return temp_dir_.GetPath(); }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment