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

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

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 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
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_extension_parser.h" 5 #include "net/websockets/websocket_extension_parser.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "net/websockets/websocket_extension.h" 9 #include "net/websockets/websocket_extension.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 expected.Add(WebSocketExtension::Parameter("bar", "baz")); 58 expected.Add(WebSocketExtension::Parameter("bar", "baz"));
59 expected.Add(WebSocketExtension::Parameter("hoge", "fuga")); 59 expected.Add(WebSocketExtension::Parameter("hoge", "fuga"));
60 60
61 parser.Parse("foo ; bar= baz;\t \thoge\t\t=fuga"); 61 parser.Parse("foo ; bar= baz;\t \thoge\t\t=fuga");
62 62
63 ASSERT_FALSE(parser.has_error()); 63 ASSERT_FALSE(parser.has_error());
64 EXPECT_TRUE(expected.Equals(parser.extension())); 64 EXPECT_TRUE(expected.Equals(parser.extension()));
65 } 65 }
66 66
67 TEST(WebSocketExtensionParserTest, InvalidPatterns) { 67 TEST(WebSocketExtensionParserTest, InvalidPatterns) {
68 const char* patterns[] = { 68 const char* const patterns[] = {
69 "fo\ao", // control in extension name 69 "fo\ao", // control in extension name
70 "fo\x01o", // control in extension name 70 "fo\x01o", // control in extension name
71 "fo<o", // separator in extension name 71 "fo<o", // separator in extension name
72 "foo/", // separator in extension name 72 "foo/", // separator in extension name
73 ";bar", // empty extension name 73 ";bar", // empty extension name
74 "foo bar", // missing ';' 74 "foo bar", // missing ';'
75 "foo;", // extension parameter without name and value 75 "foo;", // extension parameter without name and value
76 "foo; b\ar", // control in parameter name 76 "foo; b\ar", // control in parameter name
77 "foo; b\x7fr", // control in parameter name 77 "foo; b\x7fr", // control in parameter name
78 "foo; b[r", // separator in parameter name 78 "foo; b[r", // separator in parameter name
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 parser.Parse("foo; bar = \"ba\\z\" "); 114 parser.Parse("foo; bar = \"ba\\z\" ");
115 115
116 ASSERT_FALSE(parser.has_error()); 116 ASSERT_FALSE(parser.has_error());
117 EXPECT_TRUE(expected.Equals(parser.extension())); 117 EXPECT_TRUE(expected.Equals(parser.extension()));
118 } 118 }
119 119
120 } // namespace 120 } // namespace
121 121
122 } // namespace net 122 } // namespace net
OLDNEW
« no previous file with comments | « net/websockets/websocket_end_to_end_test.cc ('k') | net/websockets/websocket_handshake_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698