1a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
2a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// found in the LICENSE file.
4a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
5a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "net/http/http_auth_challenge_tokenizer.h"
6a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "testing/gtest/include/gtest/gtest.h"
7a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace net {
9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
10a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST(HttpAuthChallengeTokenizerTest, Basic) {
11a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  std::string challenge_str = "Basic realm=\"foobar\"";
12a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpAuthChallengeTokenizer challenge(challenge_str.begin(),
13a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                       challenge_str.end());
14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpUtil::NameValuePairsIterator parameters = challenge.param_pairs();
15a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("Basic"), challenge.scheme());
18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.GetNext());
19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
20a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("realm"), parameters.name());
21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("foobar"), parameters.value());
22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_FALSE(parameters.GetNext());
23a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
24a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
25a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use a name=value property with no quote marks.
26a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST(HttpAuthChallengeTokenizerTest, NoQuotes) {
27a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  std::string challenge_str = "Basic realm=foobar@baz.com";
28a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpAuthChallengeTokenizer challenge(challenge_str.begin(),
29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                       challenge_str.end());
30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpUtil::NameValuePairsIterator parameters = challenge.param_pairs();
31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("Basic"), challenge.scheme());
34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.GetNext());
35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("realm"), parameters.name());
37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("foobar@baz.com"), parameters.value());
38a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_FALSE(parameters.GetNext());
39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
40a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
41a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use a name=value property with mismatching quote marks.
42a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST(HttpAuthChallengeTokenizerTest, MismatchedQuotes) {
43a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  std::string challenge_str = "Basic realm=\"foobar@baz.com";
44a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpAuthChallengeTokenizer challenge(challenge_str.begin(),
45a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                       challenge_str.end());
46a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpUtil::NameValuePairsIterator parameters = challenge.param_pairs();
47a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
48a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
49a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("Basic"), challenge.scheme());
50a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.GetNext());
51a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
52a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("realm"), parameters.name());
53a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("foobar@baz.com"), parameters.value());
54a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_FALSE(parameters.GetNext());
55a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
56a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
57a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use a name= property without a value and with mismatching quote marks.
58a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST(HttpAuthChallengeTokenizerTest, MismatchedQuotesNoValue) {
59a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  std::string challenge_str = "Basic realm=\"";
60a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpAuthChallengeTokenizer challenge(challenge_str.begin(),
61a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                       challenge_str.end());
62a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpUtil::NameValuePairsIterator parameters = challenge.param_pairs();
63a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
64a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
65a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("Basic"), challenge.scheme());
66a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.GetNext());
67a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
68a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("realm"), parameters.name());
69a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string(), parameters.value());
70a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_FALSE(parameters.GetNext());
71a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
72a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
73a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use a name=value property with mismatching quote marks and spaces in the
74a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// value.
75a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST(HttpAuthChallengeTokenizerTest, MismatchedQuotesSpaces) {
76a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  std::string challenge_str = "Basic realm=\"foo bar";
77a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpAuthChallengeTokenizer challenge(challenge_str.begin(),
78a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                       challenge_str.end());
79a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpUtil::NameValuePairsIterator parameters = challenge.param_pairs();
80a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
81a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
82a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("Basic"), challenge.scheme());
83a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.GetNext());
84a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
85a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("realm"), parameters.name());
86a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("foo bar"), parameters.value());
87a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_FALSE(parameters.GetNext());
88a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
89a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
90a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use multiple name=value properties with mismatching quote marks in the last
91a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// value.
92a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST(HttpAuthChallengeTokenizerTest, MismatchedQuotesMultiple) {
93a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  std::string challenge_str = "Digest qop=auth-int, algorithm=md5, realm=\"foo";
94a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpAuthChallengeTokenizer challenge(challenge_str.begin(),
95a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                       challenge_str.end());
96a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpUtil::NameValuePairsIterator parameters = challenge.param_pairs();
97a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
98a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
99a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("Digest"), challenge.scheme());
100a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.GetNext());
101a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
102a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("qop"), parameters.name());
103a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("auth-int"), parameters.value());
104a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.GetNext());
105a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
106a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("algorithm"), parameters.name());
107a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("md5"), parameters.value());
108a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.GetNext());
109a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
110a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("realm"), parameters.name());
111a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("foo"), parameters.value());
112a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_FALSE(parameters.GetNext());
113a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
114a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
115a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use a name= property which has no value.
116a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST(HttpAuthChallengeTokenizerTest, NoValue) {
117a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  std::string challenge_str = "Digest qop=";
118a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpAuthChallengeTokenizer challenge(
119a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      challenge_str.begin(), challenge_str.end());
120a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpUtil::NameValuePairsIterator parameters = challenge.param_pairs();
121a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
122a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
123a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("Digest"), challenge.scheme());
124a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_FALSE(parameters.GetNext());
125a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_FALSE(parameters.valid());
126a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
127a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
128a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Specify multiple properties, comma separated.
129a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST(HttpAuthChallengeTokenizerTest, Multiple) {
130a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  std::string challenge_str =
131a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      "Digest algorithm=md5, realm=\"Oblivion\", qop=auth-int";
132a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpAuthChallengeTokenizer challenge(challenge_str.begin(),
133a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                       challenge_str.end());
134a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpUtil::NameValuePairsIterator parameters = challenge.param_pairs();
135a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
136a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
137a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("Digest"), challenge.scheme());
138a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.GetNext());
139a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
140a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("algorithm"), parameters.name());
141a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("md5"), parameters.value());
142a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.GetNext());
143a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
144a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("realm"), parameters.name());
145a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("Oblivion"), parameters.value());
146a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.GetNext());
147a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
148a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("qop"), parameters.name());
149a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("auth-int"), parameters.value());
150a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_FALSE(parameters.GetNext());
151a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
152a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
153a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
154a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use a challenge which has no property.
155a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST(HttpAuthChallengeTokenizerTest, NoProperty) {
156a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  std::string challenge_str = "NTLM";
157a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpAuthChallengeTokenizer challenge(
158a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      challenge_str.begin(), challenge_str.end());
159a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpUtil::NameValuePairsIterator parameters = challenge.param_pairs();
160a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
161a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_TRUE(parameters.valid());
162a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("NTLM"), challenge.scheme());
163a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_FALSE(parameters.GetNext());
164a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
165a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
166a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use a challenge with Base64 encoded token.
167a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)TEST(HttpAuthChallengeTokenizerTest, Base64) {
168a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  std::string challenge_str = "NTLM  SGVsbG8sIFdvcmxkCg===";
169a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  HttpAuthChallengeTokenizer challenge(challenge_str.begin(),
170a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                       challenge_str.end());
171a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
172a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("NTLM"), challenge.scheme());
173a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Notice the two equal statements below due to padding removal.
174a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  EXPECT_EQ(std::string("SGVsbG8sIFdvcmxkCg=="), challenge.base64_param());
175a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
176a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
177a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}  // namespace net
178