OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/scoped_ptr.h" | 5 #include "base/scoped_ptr.h" |
6 #include "net/base/net_errors.h" | 6 #include "net/base/net_errors.h" |
7 #include "net/http/http_auth_handler.h" | 7 #include "net/http/http_auth_handler.h" |
8 #include "net/http/http_auth_handler_factory.h" | 8 #include "net/http/http_auth_handler_factory.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 server_origin, | 139 server_origin, |
140 &handler); | 140 &handler); |
141 EXPECT_EQ(OK, rv); | 141 EXPECT_EQ(OK, rv); |
142 ASSERT_FALSE(handler.get() == NULL); | 142 ASSERT_FALSE(handler.get() == NULL); |
143 EXPECT_STREQ("ntlm", handler->scheme().c_str()); | 143 EXPECT_STREQ("ntlm", handler->scheme().c_str()); |
144 EXPECT_STREQ("", handler->realm().c_str()); | 144 EXPECT_STREQ("", handler->realm().c_str()); |
145 EXPECT_EQ(HttpAuth::AUTH_SERVER, handler->target()); | 145 EXPECT_EQ(HttpAuth::AUTH_SERVER, handler->target()); |
146 EXPECT_TRUE(handler->encrypts_identity()); | 146 EXPECT_TRUE(handler->encrypts_identity()); |
147 EXPECT_TRUE(handler->is_connection_based()); | 147 EXPECT_TRUE(handler->is_connection_based()); |
148 } | 148 } |
149 #if defined(OS_WIN) | |
150 { | 149 { |
151 scoped_refptr<HttpAuthHandler> handler; | 150 scoped_refptr<HttpAuthHandler> handler; |
152 int rv = http_auth_handler_factory->CreateAuthHandlerFromString( | 151 int rv = http_auth_handler_factory->CreateAuthHandlerFromString( |
153 "Negotiate", | 152 "Negotiate", |
154 HttpAuth::AUTH_SERVER, | 153 HttpAuth::AUTH_SERVER, |
155 server_origin, | 154 server_origin, |
156 &handler); | 155 &handler); |
157 EXPECT_EQ(OK, rv); | 156 EXPECT_EQ(OK, rv); |
158 EXPECT_FALSE(handler.get() == NULL); | 157 EXPECT_FALSE(handler.get() == NULL); |
159 EXPECT_STREQ("negotiate", handler->scheme().c_str()); | 158 EXPECT_STREQ("negotiate", handler->scheme().c_str()); |
160 EXPECT_STREQ("", handler->realm().c_str()); | 159 EXPECT_STREQ("", handler->realm().c_str()); |
161 EXPECT_EQ(HttpAuth::AUTH_SERVER, handler->target()); | 160 EXPECT_EQ(HttpAuth::AUTH_SERVER, handler->target()); |
162 EXPECT_TRUE(handler->encrypts_identity()); | 161 EXPECT_TRUE(handler->encrypts_identity()); |
163 EXPECT_TRUE(handler->is_connection_based()); | 162 EXPECT_TRUE(handler->is_connection_based()); |
164 } | 163 } |
165 #else // !defined(OS_WIN) | |
166 { | |
167 scoped_refptr<HttpAuthHandler> handler; | |
168 int rv = http_auth_handler_factory->CreateAuthHandlerFromString( | |
169 "Negotiate", | |
170 HttpAuth::AUTH_SERVER, | |
171 server_origin, | |
172 &handler); | |
173 EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, rv); | |
174 EXPECT_TRUE(handler.get() == NULL); | |
175 } | |
176 #endif // !defined(OS_WIN) | |
177 } | 164 } |
178 | 165 |
179 } // namespace net | 166 } // namespace net |
OLD | NEW |