Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/DefaultFileSystem.cpp

Issue 29481704: Noissue - Use buffer for FileSystem IO (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Nit addressed Created July 7, 2017, 12:50 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/BaseJsTest.h ('k') | test/FileSystemJsObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/DefaultFileSystem.cpp
===================================================================
--- a/test/DefaultFileSystem.cpp
+++ b/test/DefaultFileSystem.cpp
@@ -21,30 +21,28 @@
namespace
{
const std::string testPath = "libadblockplus-t\xc3\xa4st-file";
void WriteString(AdblockPlus::FileSystem& fileSystem,
const std::string& content)
{
- std::stringstream input;
- input << content;
- fileSystem.Write(testPath, input);
+ AdblockPlus::FileSystem::IOBuffer buffer(content.cbegin(), content.cend());
+ fileSystem.Write(testPath, buffer);
}
}
TEST(DefaultFileSystemTest, WriteReadRemove)
{
AdblockPlus::DefaultFileSystem fileSystem;
WriteString(fileSystem, "foo");
- std::stringstream output;
- output << fileSystem.Read(testPath)->rdbuf();
+ auto output = fileSystem.Read(testPath);
fileSystem.Remove(testPath);
- ASSERT_EQ("foo", output.str());
+ ASSERT_EQ("foo", std::string(output.cbegin(), output.cend()));
}
TEST(DefaultFileSystemTest, StatWorkingDirectory)
{
AdblockPlus::DefaultFileSystem fileSystem;
const AdblockPlus::FileSystem::StatResult result = fileSystem.Stat(".");
ASSERT_TRUE(result.exists);
ASSERT_TRUE(result.isDirectory);
« no previous file with comments | « test/BaseJsTest.h ('k') | test/FileSystemJsObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld