Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "content/browser/webui/i18n_source_stream.h" | 7 #include "content/browser/webui/i18n_source_stream.h" |
| 8 #include "net/base/io_buffer.h" | 8 #include "net/base/io_buffer.h" |
| 9 #include "net/base/test_completion_callback.h" | 9 #include "net/base/test_completion_callback.h" |
| 10 #include "net/filter/mock_source_stream.h" | 10 #include "net/filter/mock_source_stream.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 net::OK, GetParam().mode); | 211 net::OK, GetParam().mode); |
| 212 source()->AddReadResult(source_data() + kSourceSize, 0, net::OK, | 212 source()->AddReadResult(source_data() + kSourceSize, 0, net::OK, |
| 213 GetParam().mode); | 213 GetParam().mode); |
| 214 std::string actual_output; | 214 std::string actual_output; |
| 215 int rv = ReadStream(&actual_output); | 215 int rv = ReadStream(&actual_output); |
| 216 EXPECT_EQ(static_cast<int>(kResultSize), rv); | 216 EXPECT_EQ(static_cast<int>(kResultSize), rv); |
| 217 EXPECT_EQ(std::string(result_data(), kResultSize), actual_output); | 217 EXPECT_EQ(std::string(result_data(), kResultSize), actual_output); |
| 218 EXPECT_EQ("i18n", stream()->Description()); | 218 EXPECT_EQ("i18n", stream()->Description()); |
| 219 } | 219 } |
| 220 | 220 |
| 221 TEST_P(I18nSourceStreamTest, I18nTagAtEndOfLine) { | |
| 222 Init(); | |
| 223 const char source_data[] = "test with tag at end of line $"; | |
|
mmenke
2017/01/03 20:47:32
nit: kSourceData
dschuyler
2017/01/03 21:51:40
Done.
| |
| 224 const size_t source_size = strlen(source_data); | |
| 225 source()->AddReadResult(source_data, source_size, net::OK, GetParam().mode); | |
| 226 source()->AddReadResult(source_data + source_size, 0, net::OK, | |
|
mmenke
2017/01/03 20:47:32
Know it's what the other tests do, but the first a
dschuyler
2017/01/03 21:51:40
Done.
| |
| 227 GetParam().mode); | |
| 228 std::string actual_output; | |
| 229 int rv = ReadStream(&actual_output); | |
| 230 EXPECT_EQ(static_cast<int>(source_size), rv); | |
| 231 EXPECT_EQ(std::string(source_data, source_size), actual_output); | |
|
mmenke
2017/01/03 20:47:32
std::string(source_data, source_size) -> source_da
dschuyler
2017/01/03 21:51:40
Done.
| |
| 232 EXPECT_EQ("i18n", stream()->Description()); | |
| 233 } | |
| 234 | |
| 221 } // namespace content | 235 } // namespace content |
| OLD | NEW |