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

Side by Side Diff: net/websockets/websocket_net_log_params_test.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/websockets/websocket_net_log_params.h" 5 #include "net/websockets/websocket_net_log_params.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 TEST(NetLogWebSocketHandshakeParameterTest, ToValue) { 14 TEST(NetLogWebSocketHandshakeParameterTest, ToValue) {
15 base::ListValue* list = new base::ListValue(); 15 base::ListValue* list = new base::ListValue();
16 list->Append(new base::StringValue("GET /demo HTTP/1.1")); 16 list->Append(new base::StringValue("GET /demo HTTP/1.1"));
17 list->Append(new base::StringValue("Host: example.com")); 17 list->Append(new base::StringValue("Host: example.com"));
18 list->Append(new base::StringValue("Connection: Upgrade")); 18 list->Append(new base::StringValue("Connection: Upgrade"));
19 list->Append(new base::StringValue("Sec-WebSocket-Key2: 12998 5 Y3 1 .P00")); 19 list->Append(new base::StringValue("Sec-WebSocket-Key2: 12998 5 Y3 1 .P00"));
20 list->Append(new base::StringValue("Sec-WebSocket-Protocol: sample")); 20 list->Append(new base::StringValue("Sec-WebSocket-Protocol: sample"));
21 list->Append(new base::StringValue("Upgrade: WebSocket")); 21 list->Append(new base::StringValue("Upgrade: WebSocket"));
22 list->Append(new base::StringValue( 22 list->Append(
23 "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5")); 23 new base::StringValue("Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5"));
24 list->Append(new base::StringValue("Origin: http://example.com")); 24 list->Append(new base::StringValue("Origin: http://example.com"));
25 list->Append(new base::StringValue(std::string())); 25 list->Append(new base::StringValue(std::string()));
26 list->Append(new base::StringValue( 26 list->Append(
27 "\\x00\\x01\\x0a\\x0d\\xff\\xfe\\x0d\\x0a")); 27 new base::StringValue("\\x00\\x01\\x0a\\x0d\\xff\\xfe\\x0d\\x0a"));
28 28
29 base::DictionaryValue expected; 29 base::DictionaryValue expected;
30 expected.Set("headers", list); 30 expected.Set("headers", list);
31 31
32 const std::string key("\x00\x01\x0a\x0d\xff\xfe\x0d\x0a", 8); 32 const std::string key("\x00\x01\x0a\x0d\xff\xfe\x0d\x0a", 8);
33 const std::string testInput = 33 const std::string testInput =
34 "GET /demo HTTP/1.1\r\n" 34 "GET /demo HTTP/1.1\r\n"
35 "Host: example.com\r\n" 35 "Host: example.com\r\n"
36 "Connection: Upgrade\r\n" 36 "Connection: Upgrade\r\n"
37 "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n" 37 "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n"
38 "Sec-WebSocket-Protocol: sample\r\n" 38 "Sec-WebSocket-Protocol: sample\r\n"
39 "Upgrade: WebSocket\r\n" 39 "Upgrade: WebSocket\r\n"
40 "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n" 40 "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n"
41 "Origin: http://example.com\r\n" 41 "Origin: http://example.com\r\n"
42 "\r\n" + 42 "\r\n" +
43 key; 43 key;
44 44
45 scoped_ptr<base::Value> actual( 45 scoped_ptr<base::Value> actual(
46 net::NetLogWebSocketHandshakeCallback(&testInput, 46 net::NetLogWebSocketHandshakeCallback(&testInput, net::NetLog::LOG_ALL));
47 net::NetLog::LOG_ALL));
48 47
49 EXPECT_TRUE(expected.Equals(actual.get())); 48 EXPECT_TRUE(expected.Equals(actual.get()));
50 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698