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

Unified Diff: webrtc/base/filerotatingstream_unittest.cc

Issue 2894583002: Delete Filesystem::IterateDirectory and Filesystem::OpenFile. (Closed)
Patch Set: Check stream.Open return value. Created 3 years, 7 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
« no previous file with comments | « no previous file | webrtc/base/fileutils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/filerotatingstream_unittest.cc
diff --git a/webrtc/base/filerotatingstream_unittest.cc b/webrtc/base/filerotatingstream_unittest.cc
index 7acb174bb35a95775e87b6c06e666bc6db6f45ad..9ce00dad57834677812ed77c1d5243488a2b00f1 100644
--- a/webrtc/base/filerotatingstream_unittest.cc
+++ b/webrtc/base/filerotatingstream_unittest.cc
@@ -96,16 +96,13 @@ class MAYBE_FileRotatingStreamTest : public ::testing::Test {
const size_t expected_length,
const std::string& file_path) {
std::unique_ptr<uint8_t[]> buffer(new uint8_t[expected_length]);
- std::unique_ptr<FileStream> stream(Filesystem::OpenFile(file_path, "r"));
- EXPECT_TRUE(stream);
- if (!stream) {
- return;
- }
+ FileStream stream;
+ ASSERT_TRUE(stream.Open(file_path, "r", nullptr));
EXPECT_EQ(rtc::SR_SUCCESS,
- stream->ReadAll(buffer.get(), expected_length, nullptr, nullptr));
+ stream.ReadAll(buffer.get(), expected_length, nullptr, nullptr));
EXPECT_EQ(0, memcmp(expected_contents, buffer.get(), expected_length));
size_t file_size = 0;
- EXPECT_TRUE(stream->GetSize(&file_size));
+ EXPECT_TRUE(stream.GetSize(&file_size));
EXPECT_EQ(file_size, expected_length);
}
@@ -136,9 +133,10 @@ TEST_F(MAYBE_FileRotatingStreamTest, EmptyWrite) {
WriteAndFlush("a", 0);
std::string logfile_path = stream_->GetFilePath(0);
- std::unique_ptr<FileStream> stream(Filesystem::OpenFile(logfile_path, "r"));
+ FileStream stream;
+ ASSERT_TRUE(stream.Open(logfile_path, "r", nullptr));
size_t file_size = 0;
- EXPECT_TRUE(stream->GetSize(&file_size));
+ EXPECT_TRUE(stream.GetSize(&file_size));
EXPECT_EQ(0u, file_size);
}
« no previous file with comments | « no previous file | webrtc/base/fileutils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698