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

Unified Diff: chrome/browser/chromeos/system_logs/single_log_source_unittest.cc

Issue 2930383002: SingleLogSource reads whole lines whenever possible (Closed)
Patch Set: Created 3 years, 6 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 | « chrome/browser/chromeos/system_logs/single_log_source.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/system_logs/single_log_source_unittest.cc
diff --git a/chrome/browser/chromeos/system_logs/single_log_source_unittest.cc b/chrome/browser/chromeos/system_logs/single_log_source_unittest.cc
index 918efee7b42d686f1f8f7202c0e1f2a4ae4eb41a..ac313002e87aa09f89ffd54803d6ebd2af0d9842 100644
--- a/chrome/browser/chromeos/system_logs/single_log_source_unittest.cc
+++ b/chrome/browser/chromeos/system_logs/single_log_source_unittest.cc
@@ -63,7 +63,8 @@ class SingleLogSourceTest : public ::testing::Test {
bool WriteFile(const base::FilePath& relative_path,
const std::string& input) {
return base::WriteFile(log_dir_.GetPath().Append(relative_path),
- input.data(), input.size());
+ input.data(),
+ input.size()) == static_cast<int>(input.size());
}
bool AppendToFile(const base::FilePath& relative_path,
const std::string& input) {
@@ -237,20 +238,19 @@ TEST_F(SingleLogSourceTest, IncompleteLines) {
// All the previously written text should be read this time.
EXPECT_EQ("0123456789abcdefghijk\n", latest_response());
- // Partial whole-line reads are not supported. The last byte of the read must
- // be a new line.
+ // Check ability to read whole lines while leaving the remainder for later.
EXPECT_TRUE(AppendToFile(base::FilePath("messages"), "Hello world\n"));
EXPECT_TRUE(AppendToFile(base::FilePath("messages"), "Goodbye world"));
FetchFromSource();
EXPECT_EQ(4, num_callback_calls());
- EXPECT_EQ("", latest_response());
+ EXPECT_EQ("Hello world\n", latest_response());
EXPECT_TRUE(AppendToFile(base::FilePath("messages"), "\n"));
FetchFromSource();
EXPECT_EQ(5, num_callback_calls());
- EXPECT_EQ("Hello world\nGoodbye world\n", latest_response());
+ EXPECT_EQ("Goodbye world\n", latest_response());
}
TEST_F(SingleLogSourceTest, Anonymize) {
« no previous file with comments | « chrome/browser/chromeos/system_logs/single_log_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698