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

Unified Diff: net/spdy/spdy_alt_svc_wire_format_test.cc

Issue 2801603003: Add SpdyString alias for std::string in net/spdy. (Closed)
Patch Set: Created 3 years, 8 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 | « net/spdy/spdy_alt_svc_wire_format.cc ('k') | net/spdy/spdy_buffer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_alt_svc_wire_format_test.cc
diff --git a/net/spdy/spdy_alt_svc_wire_format_test.cc b/net/spdy/spdy_alt_svc_wire_format_test.cc
index 0d5679e5594564f48093734cfb8f1f12f492defa..1650c3509875c0e742e76fa0ee4bce6aaf3a4146 100644
--- a/net/spdy/spdy_alt_svc_wire_format_test.cc
+++ b/net/spdy/spdy_alt_svc_wire_format_test.cc
@@ -23,12 +23,12 @@ class SpdyAltSvcWireFormatPeer {
}
static bool PercentDecode(SpdyStringPiece::const_iterator c,
SpdyStringPiece::const_iterator end,
- std::string* output) {
+ SpdyString* output) {
return SpdyAltSvcWireFormat::PercentDecode(c, end, output);
}
static bool ParseAltAuthority(SpdyStringPiece::const_iterator c,
SpdyStringPiece::const_iterator end,
- std::string* host,
+ SpdyString* host,
uint16_t* port) {
return SpdyAltSvcWireFormat::ParseAltAuthority(c, end, host, port);
}
@@ -52,7 +52,7 @@ namespace {
// random case, and corresponding AlternativeService entries.
void FuzzHeaderFieldValue(
int i,
- std::string* header_field_value,
+ SpdyString* header_field_value,
SpdyAltSvcWireFormat::AlternativeService* expected_altsvc) {
if (!header_field_value->empty()) {
header_field_value->push_back(',');
@@ -109,7 +109,7 @@ void FuzzHeaderFieldValue(
// canonical form, that is, what SerializeHeaderFieldValue() should output.
void FuzzAlternativeService(int i,
SpdyAltSvcWireFormat::AlternativeService* altsvc,
- std::string* expected_header_field_value) {
+ SpdyString* expected_header_field_value) {
if (!expected_header_field_value->empty()) {
expected_header_field_value->push_back(',');
}
@@ -162,7 +162,7 @@ TEST(SpdyAltSvcWireFormatTest, ParseHeaderFieldValueClear) {
// separator, etc. Single alternative service at a time.
TEST(SpdyAltSvcWireFormatTest, ParseHeaderFieldValue) {
for (int i = 0; i < 1 << 11; ++i) {
- std::string header_field_value;
+ SpdyString header_field_value;
SpdyAltSvcWireFormat::AlternativeService expected_altsvc;
FuzzHeaderFieldValue(i, &header_field_value, &expected_altsvc);
SpdyAltSvcWireFormat::AlternativeServiceVector altsvc_vector;
@@ -176,7 +176,7 @@ TEST(SpdyAltSvcWireFormatTest, ParseHeaderFieldValue) {
EXPECT_EQ(expected_altsvc.version, altsvc_vector[0].version);
// Roundtrip test starting with |altsvc_vector|.
- std::string reserialized_header_field_value =
+ SpdyString reserialized_header_field_value =
SpdyAltSvcWireFormat::SerializeHeaderFieldValue(altsvc_vector);
SpdyAltSvcWireFormat::AlternativeServiceVector roundtrip_altsvc_vector;
ASSERT_TRUE(SpdyAltSvcWireFormat::ParseHeaderFieldValue(
@@ -196,7 +196,7 @@ TEST(SpdyAltSvcWireFormatTest, ParseHeaderFieldValue) {
// separator, etc. Possibly multiple alternative service at a time.
TEST(SpdyAltSvcWireFormatTest, ParseHeaderFieldValueMultiple) {
for (int i = 0; i < 1 << 11;) {
- std::string header_field_value;
+ SpdyString header_field_value;
SpdyAltSvcWireFormat::AlternativeServiceVector expected_altsvc_vector;
// This will generate almost two hundred header field values with two,
// three, four, five, six, and seven alternative services each, and
@@ -221,7 +221,7 @@ TEST(SpdyAltSvcWireFormatTest, ParseHeaderFieldValueMultiple) {
}
// Roundtrip test starting with |altsvc_vector|.
- std::string reserialized_header_field_value =
+ SpdyString reserialized_header_field_value =
SpdyAltSvcWireFormat::SerializeHeaderFieldValue(altsvc_vector);
SpdyAltSvcWireFormat::AlternativeServiceVector roundtrip_altsvc_vector;
ASSERT_TRUE(SpdyAltSvcWireFormat::ParseHeaderFieldValue(
@@ -255,7 +255,7 @@ TEST(SpdyAltSvcWireFormatTest, SerializeEmptyHeaderFieldValue) {
TEST(SpdyAltSvcWireFormatTest, RoundTrip) {
for (int i = 0; i < 1 << 3; ++i) {
SpdyAltSvcWireFormat::AlternativeService altsvc;
- std::string expected_header_field_value;
+ SpdyString expected_header_field_value;
FuzzAlternativeService(i, &altsvc, &expected_header_field_value);
// Test ParseHeaderFieldValue().
@@ -283,7 +283,7 @@ TEST(SpdyAltSvcWireFormatTest, RoundTrip) {
// parameter. Multiple alternative services at a time.
TEST(SpdyAltSvcWireFormatTest, RoundTripMultiple) {
SpdyAltSvcWireFormat::AlternativeServiceVector altsvc_vector;
- std::string expected_header_field_value;
+ SpdyString expected_header_field_value;
for (int i = 0; i < 1 << 3; ++i) {
SpdyAltSvcWireFormat::AlternativeService altsvc;
FuzzAlternativeService(i, &altsvc, &expected_header_field_value);
@@ -355,7 +355,7 @@ TEST(SpdyAltSvcWireFormatTest, ParseTruncatedHeaderFieldValue) {
SpdyAltSvcWireFormat::AlternativeServiceVector altsvc_vector;
const char* field_value_array[] = {"a=\":137\"", "a=\"foo:137\"",
"a%25=\"foo\\\"bar\\\\baz:137\""};
- for (const std::string& field_value : field_value_array) {
+ for (const SpdyString& field_value : field_value_array) {
for (size_t len = 1; len < field_value.size(); ++len) {
EXPECT_FALSE(SpdyAltSvcWireFormat::ParseHeaderFieldValue(
field_value.substr(0, len), &altsvc_vector))
@@ -383,7 +383,7 @@ TEST(SpdyAltSvcWireFormatTest, SkipWhiteSpace) {
// Test PercentDecode() on valid input.
TEST(SpdyAltSvcWireFormatTest, PercentDecodeValid) {
SpdyStringPiece input("");
- std::string output;
+ SpdyString output;
ASSERT_TRUE(test::SpdyAltSvcWireFormatPeer::PercentDecode(
input.begin(), input.end(), &output));
EXPECT_EQ("", output);
@@ -406,7 +406,7 @@ TEST(SpdyAltSvcWireFormatTest, PercentDecodeInvalid) {
const char* invalid_input_array[] = {"a%", "a%x", "a%b", "%J22", "%9z"};
for (const char* invalid_input : invalid_input_array) {
SpdyStringPiece input(invalid_input);
- std::string output;
+ SpdyString output;
EXPECT_FALSE(test::SpdyAltSvcWireFormatPeer::PercentDecode(
input.begin(), input.end(), &output))
<< input;
@@ -416,7 +416,7 @@ TEST(SpdyAltSvcWireFormatTest, PercentDecodeInvalid) {
// Test ParseAltAuthority() on valid input.
TEST(SpdyAltSvcWireFormatTest, ParseAltAuthorityValid) {
SpdyStringPiece input(":42");
- std::string host;
+ SpdyString host;
uint16_t port;
ASSERT_TRUE(test::SpdyAltSvcWireFormatPeer::ParseAltAuthority(
input.begin(), input.end(), &host, &port));
@@ -457,7 +457,7 @@ TEST(SpdyAltSvcWireFormatTest, ParseAltAuthorityInvalid) {
"2003:8:0:16::509d:9615]:443"};
for (const char* invalid_input : invalid_input_array) {
SpdyStringPiece input(invalid_input);
- std::string host;
+ SpdyString host;
uint16_t port;
EXPECT_FALSE(test::SpdyAltSvcWireFormatPeer::ParseAltAuthority(
input.begin(), input.end(), &host, &port))
« no previous file with comments | « net/spdy/spdy_alt_svc_wire_format.cc ('k') | net/spdy/spdy_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698