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

Side by Side Diff: net/spdy/spdy_log_util_unittest.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 unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_log_util.cc ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "net/spdy/spdy_log_util.h" 5 #include "net/spdy/spdy_log_util.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 TEST(SpdyLogUtilTest, ElideGoAwayDebugDataForNetLog) { 12 TEST(SpdyLogUtilTest, ElideGoAwayDebugDataForNetLog) {
13 // Only elide for appropriate log level. 13 // Only elide for appropriate log level.
14 EXPECT_EQ( 14 EXPECT_EQ(
15 "[6 bytes were stripped]", 15 "[6 bytes were stripped]",
16 ElideGoAwayDebugDataForNetLog(NetLogCaptureMode::Default(), "foobar")); 16 ElideGoAwayDebugDataForNetLog(NetLogCaptureMode::Default(), "foobar"));
17 EXPECT_EQ("foobar", 17 EXPECT_EQ("foobar",
18 ElideGoAwayDebugDataForNetLog( 18 ElideGoAwayDebugDataForNetLog(
19 NetLogCaptureMode::IncludeCookiesAndCredentials(), "foobar")); 19 NetLogCaptureMode::IncludeCookiesAndCredentials(), "foobar"));
20 } 20 }
21 21
22 TEST(SpdyLogUtilTest, ElideSpdyHeaderBlockForNetLog) { 22 TEST(SpdyLogUtilTest, ElideSpdyHeaderBlockForNetLog) {
23 SpdyHeaderBlock headers; 23 SpdyHeaderBlock headers;
24 headers["foo"] = "bar"; 24 headers["foo"] = "bar";
25 headers["cookie"] = "name=value"; 25 headers["cookie"] = "name=value";
26 26
27 std::unique_ptr<base::ListValue> list = 27 std::unique_ptr<base::ListValue> list =
28 ElideSpdyHeaderBlockForNetLog(headers, NetLogCaptureMode::Default()); 28 ElideSpdyHeaderBlockForNetLog(headers, NetLogCaptureMode::Default());
29 EXPECT_EQ(2u, list->GetSize()); 29 EXPECT_EQ(2u, list->GetSize());
30 std::string field; 30 SpdyString field;
31 EXPECT_TRUE(list->GetString(0, &field)); 31 EXPECT_TRUE(list->GetString(0, &field));
32 EXPECT_EQ("foo: bar", field); 32 EXPECT_EQ("foo: bar", field);
33 EXPECT_TRUE(list->GetString(1, &field)); 33 EXPECT_TRUE(list->GetString(1, &field));
34 EXPECT_EQ("cookie: [10 bytes were stripped]", field); 34 EXPECT_EQ("cookie: [10 bytes were stripped]", field);
35 35
36 list = ElideSpdyHeaderBlockForNetLog( 36 list = ElideSpdyHeaderBlockForNetLog(
37 headers, NetLogCaptureMode::IncludeCookiesAndCredentials()); 37 headers, NetLogCaptureMode::IncludeCookiesAndCredentials());
38 EXPECT_EQ(2u, list->GetSize()); 38 EXPECT_EQ(2u, list->GetSize());
39 EXPECT_TRUE(list->GetString(0, &field)); 39 EXPECT_TRUE(list->GetString(0, &field));
40 EXPECT_EQ("foo: bar", field); 40 EXPECT_EQ("foo: bar", field);
41 EXPECT_TRUE(list->GetString(1, &field)); 41 EXPECT_TRUE(list->GetString(1, &field));
42 EXPECT_EQ("cookie: name=value", field); 42 EXPECT_EQ("cookie: name=value", field);
43 } 43 }
44 44
45 } // namespace net 45 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_log_util.cc ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698