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

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

Issue 7649006: more changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix another typo Created 9 years, 4 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
« no previous file with comments | « net/websockets/websocket_net_log_params.cc ('k') | webkit/plugins/npapi/plugin_group.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/memory/ref_counted.h" 9 #include "base/memory/ref_counted.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 ListValue* list = new ListValue(); 15 ListValue* list = new ListValue();
16 list->Append(new StringValue("GET /demo HTTP/1.1")); 16 list->Append(base::StringValue::New("GET /demo HTTP/1.1"));
17 list->Append(new StringValue("Host: example.com")); 17 list->Append(base::StringValue::New("Host: example.com"));
18 list->Append(new StringValue("Connection: Upgrade")); 18 list->Append(base::StringValue::New("Connection: Upgrade"));
19 list->Append(new StringValue("Sec-WebSocket-Key2: 12998 5 Y3 1 .P00")); 19 list->Append(
20 list->Append(new StringValue("Sec-WebSocket-Protocol: sample")); 20 base::StringValue::New("Sec-WebSocket-Key2: 12998 5 Y3 1 .P00"));
21 list->Append(new StringValue("Upgrade: WebSocket")); 21 list->Append(base::StringValue::New("Sec-WebSocket-Protocol: sample"));
22 list->Append(new StringValue("Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5")); 22 list->Append(base::StringValue::New("Upgrade: WebSocket"));
23 list->Append(new StringValue("Origin: http://example.com")); 23 list->Append(
24 list->Append(new StringValue("")); 24 base::StringValue::New("Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5"));
25 list->Append(new StringValue("\\x00\\x01\\x0a\\x0d\\xff\\xfe\\x0d\\x0a")); 25 list->Append(base::StringValue::New("Origin: http://example.com"));
26 list->Append(base::StringValue::New(""));
27 list->Append(
28 base::StringValue::New("\\x00\\x01\\x0a\\x0d\\xff\\xfe\\x0d\\x0a"));
26 29
27 DictionaryValue expected; 30 DictionaryValue expected;
28 expected.Set("headers", list); 31 expected.Set("headers", list);
29 32
30 const std::string key("\x00\x01\x0a\x0d\xff\xfe\x0d\x0a", 8); 33 const std::string key("\x00\x01\x0a\x0d\xff\xfe\x0d\x0a", 8);
31 const std::string testInput = 34 const std::string testInput =
32 "GET /demo HTTP/1.1\r\n" 35 "GET /demo HTTP/1.1\r\n"
33 "Host: example.com\r\n" 36 "Host: example.com\r\n"
34 "Connection: Upgrade\r\n" 37 "Connection: Upgrade\r\n"
35 "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n" 38 "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n"
36 "Sec-WebSocket-Protocol: sample\r\n" 39 "Sec-WebSocket-Protocol: sample\r\n"
37 "Upgrade: WebSocket\r\n" 40 "Upgrade: WebSocket\r\n"
38 "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n" 41 "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n"
39 "Origin: http://example.com\r\n" 42 "Origin: http://example.com\r\n"
40 "\r\n" + 43 "\r\n" +
41 key; 44 key;
42 45
43 scoped_refptr<net::NetLogWebSocketHandshakeParameter> parameter( 46 scoped_refptr<net::NetLogWebSocketHandshakeParameter> parameter(
44 new net::NetLogWebSocketHandshakeParameter(testInput)); 47 new net::NetLogWebSocketHandshakeParameter(testInput));
45 scoped_ptr<Value> actual(parameter->ToValue()); 48 scoped_ptr<Value> actual(parameter->ToValue());
46 49
47 EXPECT_TRUE(expected.Equals(actual.get())); 50 EXPECT_TRUE(expected.Equals(actual.get()));
48 } 51 }
OLDNEW
« no previous file with comments | « net/websockets/websocket_net_log_params.cc ('k') | webkit/plugins/npapi/plugin_group.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698