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

Unified Diff: net/spdy/hpack/hpack_round_trip_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/hpack/hpack_output_stream_test.cc ('k') | net/spdy/http2_frame_decoder_adapter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/hpack/hpack_round_trip_test.cc
diff --git a/net/spdy/hpack/hpack_round_trip_test.cc b/net/spdy/hpack/hpack_round_trip_test.cc
index b932cffa99bd3229803f5b7c024e60b42d0cac87..e8756dbf6b7a564498fabaf82c2e017dec78f1d2 100644
--- a/net/spdy/hpack/hpack_round_trip_test.cc
+++ b/net/spdy/hpack/hpack_round_trip_test.cc
@@ -4,21 +4,19 @@
#include <cmath>
#include <ctime>
-#include <string>
#include <vector>
#include "base/rand_util.h"
#include "net/spdy/hpack/hpack_constants.h"
#include "net/spdy/hpack/hpack_decoder.h"
#include "net/spdy/hpack/hpack_encoder.h"
+#include "net/spdy/platform/api/spdy_string.h"
#include "net/spdy/spdy_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
namespace test {
-using std::string;
-
namespace {
// Supports testing with the input split at every byte boundary.
@@ -35,7 +33,7 @@ class HpackRoundTripTest : public ::testing::TestWithParam<InputSizeParam> {
}
bool RoundTrip(const SpdyHeaderBlock& header_set) {
- string encoded;
+ SpdyString encoded;
encoder_.EncodeHeaderSet(header_set, &encoded);
bool success = true;
@@ -110,7 +108,7 @@ TEST_P(HpackRoundTripTest, ResponseFixtures) {
headers["set-cookie"] =
"foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;"
" max-age=3600; version=1";
- headers["multivalue"] = string("foo\0bar", 7);
+ headers["multivalue"] = SpdyString("foo\0bar", 7);
EXPECT_TRUE(RoundTrip(headers));
}
}
@@ -143,7 +141,7 @@ TEST_P(HpackRoundTripTest, RequestFixtures) {
headers[":scheme"] = "https";
headers["custom-key"] = "custom-value";
headers["cookie"] = "baz=bing; fizzle=fazzle; garbage";
- headers["multivalue"] = string("foo\0bar", 7);
+ headers["multivalue"] = SpdyString("foo\0bar", 7);
EXPECT_TRUE(RoundTrip(headers));
}
}
@@ -152,7 +150,7 @@ TEST_P(HpackRoundTripTest, RandomizedExamples) {
// Grow vectors of names & values, which are seeded with fixtures and then
// expanded with dynamically generated data. Samples are taken using the
// exponential distribution.
- std::vector<string> pseudo_header_names, random_header_names;
+ std::vector<SpdyString> pseudo_header_names, random_header_names;
pseudo_header_names.push_back(":authority");
pseudo_header_names.push_back(":path");
pseudo_header_names.push_back(":status");
@@ -160,7 +158,7 @@ TEST_P(HpackRoundTripTest, RandomizedExamples) {
// TODO(jgraettinger): Enable "cookie" as a name fixture. Crumbs may be
// reconstructed in any order, which breaks the simple validation used here.
- std::vector<string> values;
+ std::vector<SpdyString> values;
values.push_back("/");
values.push_back("/index.html");
values.push_back("200");
@@ -183,7 +181,7 @@ TEST_P(HpackRoundTripTest, RandomizedExamples) {
std::min(header_count, 1 + SampleExponential(7, 50));
EXPECT_LE(pseudo_header_count, header_count);
for (size_t j = 0; j != header_count; ++j) {
- string name, value;
+ SpdyString name, value;
// Pseudo headers must be added before regular headers.
if (j < pseudo_header_count) {
// Choose one of the defined pseudo headers at random.
@@ -207,7 +205,7 @@ TEST_P(HpackRoundTripTest, RandomizedExamples) {
// Randomly reuse an existing value, or generate a new one.
size_t value_index = SampleExponential(20, 200);
if (value_index >= values.size()) {
- string newvalue =
+ SpdyString newvalue =
base::RandBytesAsString(1 + SampleExponential(15, 75));
// Currently order is not preserved in the encoder. In particular,
// when a value is decomposed at \0 delimiters, its parts might get
« no previous file with comments | « net/spdy/hpack/hpack_output_stream_test.cc ('k') | net/spdy/http2_frame_decoder_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698