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

Unified Diff: content/browser/webui/i18n_source_stream_unittest.cc

Issue 2601313002: [MD settings] stream i18n replacement without large accumulation buffer (Closed)
Patch Set: nits Created 3 years, 12 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 | « content/browser/webui/i18n_source_stream.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/webui/i18n_source_stream_unittest.cc
diff --git a/content/browser/webui/i18n_source_stream_unittest.cc b/content/browser/webui/i18n_source_stream_unittest.cc
index 76ebf694ddace05c6c1be40942e429b9f8bca551..d031240be17df763e6c65925d9577d78e7a8e58f 100644
--- a/content/browser/webui/i18n_source_stream_unittest.cc
+++ b/content/browser/webui/i18n_source_stream_unittest.cc
@@ -178,19 +178,18 @@ TEST_P(I18nSourceStreamTest, NoTranslations) {
const char kText[] = "This text has no i18n replacements.";
size_t kTextLength = strlen(kText);
source()->AddReadResult(kText, kTextLength, net::OK, GetParam().mode);
- source()->AddReadResult(kText + kTextLength, 0, net::OK, GetParam().mode);
+ source()->AddReadResult(nullptr, 0, net::OK, GetParam().mode);
std::string actual_output;
int rv = ReadStream(&actual_output);
EXPECT_EQ(static_cast<int>(kTextLength), rv);
- EXPECT_EQ(std::string(kText, kTextLength), actual_output);
+ EXPECT_EQ(kText, actual_output);
EXPECT_EQ("i18n", stream()->Description());
}
TEST_P(I18nSourceStreamTest, I18nOneRead) {
Init();
source()->AddReadResult(source_data(), kSourceSize, net::OK, GetParam().mode);
- source()->AddReadResult(source_data() + kSourceSize, 0, net::OK,
- GetParam().mode);
+ source()->AddReadResult(nullptr, 0, net::OK, GetParam().mode);
std::string actual_output;
int rv = ReadStream(&actual_output);
EXPECT_EQ(static_cast<int>(kResultSize), rv);
@@ -209,8 +208,7 @@ TEST_P(I18nSourceStreamTest, I18nInMultipleReads) {
}
source()->AddReadResult(source_data() + written, kSourceSize - written,
net::OK, GetParam().mode);
- source()->AddReadResult(source_data() + kSourceSize, 0, net::OK,
- GetParam().mode);
+ source()->AddReadResult(nullptr, 0, net::OK, GetParam().mode);
std::string actual_output;
int rv = ReadStream(&actual_output);
EXPECT_EQ(static_cast<int>(kResultSize), rv);
@@ -218,4 +216,17 @@ TEST_P(I18nSourceStreamTest, I18nInMultipleReads) {
EXPECT_EQ("i18n", stream()->Description());
}
+TEST_P(I18nSourceStreamTest, I18nTagAtEndOfLine) {
+ Init();
+ const char kSourceData[] = "test with tag at end of line $";
+ const size_t source_size = strlen(kSourceData);
+ source()->AddReadResult(kSourceData, source_size, net::OK, GetParam().mode);
+ source()->AddReadResult(nullptr, 0, net::OK, GetParam().mode);
+ std::string actual_output;
+ int rv = ReadStream(&actual_output);
+ EXPECT_EQ(static_cast<int>(source_size), rv);
+ EXPECT_EQ(kSourceData, actual_output);
+ EXPECT_EQ("i18n", stream()->Description());
+}
+
} // namespace content
« no previous file with comments | « content/browser/webui/i18n_source_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698