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 "net/http/mock_gssapi_library_posix.h" | 5 #include "net/http/mock_gssapi_library_posix.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "net/third_party/gssapi/gssapi.h" | 10 #include "net/third_party/gssapi/gssapi.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 locally_initiated = other.locally_initiated; | 187 locally_initiated = other.locally_initiated; |
188 open = other.open; | 188 open = other.open; |
189 } | 189 } |
190 | 190 |
191 MockGSSAPILibrary::MockGSSAPILibrary() { | 191 MockGSSAPILibrary::MockGSSAPILibrary() { |
192 } | 192 } |
193 | 193 |
194 MockGSSAPILibrary::~MockGSSAPILibrary() { | 194 MockGSSAPILibrary::~MockGSSAPILibrary() { |
195 } | 195 } |
196 | 196 |
| 197 void MockGSSAPILibrary::ExpectSecurityContext( |
| 198 const std::string& expected_package, |
| 199 OM_uint32 response_code, |
| 200 OM_uint32 minor_response_code, |
| 201 const GssContextMockImpl& context_info, |
| 202 const gss_buffer_desc& expected_input_token, |
| 203 const gss_buffer_desc& output_token) { |
| 204 SecurityContextQuery security_query; |
| 205 security_query.expected_package = expected_package; |
| 206 security_query.response_code = response_code; |
| 207 security_query.minor_response_code = minor_response_code; |
| 208 security_query.context_info.Assign(context_info); |
| 209 security_query.expected_input_token = expected_input_token; |
| 210 security_query.output_token = output_token; |
| 211 expected_security_queries_.push_back(security_query); |
| 212 } |
| 213 |
197 bool MockGSSAPILibrary::Init() { | 214 bool MockGSSAPILibrary::Init() { |
198 return true; | 215 return true; |
199 } | 216 } |
200 | 217 |
201 // These methods match the ones in the GSSAPI library. | 218 // These methods match the ones in the GSSAPI library. |
202 OM_uint32 MockGSSAPILibrary::import_name( | 219 OM_uint32 MockGSSAPILibrary::import_name( |
203 OM_uint32* minor_status, | 220 OM_uint32* minor_status, |
204 const gss_buffer_t input_name_buffer, | 221 const gss_buffer_t input_name_buffer, |
205 const gss_OID input_name_type, | 222 const gss_OID input_name_type, |
206 gss_name_t* output_name) { | 223 gss_name_t* output_name) { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 CopyOid(*mech_type, &context.mech_type); | 427 CopyOid(*mech_type, &context.mech_type); |
411 if (ctx_flags) | 428 if (ctx_flags) |
412 *ctx_flags = context.ctx_flags; | 429 *ctx_flags = context.ctx_flags; |
413 if (locally_initiated) | 430 if (locally_initiated) |
414 *locally_initiated = context.locally_initiated; | 431 *locally_initiated = context.locally_initiated; |
415 if (open) | 432 if (open) |
416 *open = context.open; | 433 *open = context.open; |
417 return GSS_S_COMPLETE; | 434 return GSS_S_COMPLETE; |
418 } | 435 } |
419 | 436 |
420 void MockGSSAPILibrary::ExpectSecurityContext( | |
421 const std::string& expected_package, | |
422 OM_uint32 response_code, | |
423 OM_uint32 minor_response_code, | |
424 const GssContextMockImpl& context_info, | |
425 const gss_buffer_desc& expected_input_token, | |
426 const gss_buffer_desc& output_token) { | |
427 SecurityContextQuery security_query; | |
428 security_query.expected_package = expected_package; | |
429 security_query.response_code = response_code; | |
430 security_query.minor_response_code = minor_response_code; | |
431 security_query.context_info.Assign(context_info); | |
432 security_query.expected_input_token = expected_input_token; | |
433 security_query.output_token = output_token; | |
434 expected_security_queries_.push_back(security_query); | |
435 } | |
436 | |
437 } // namespace test | 437 } // namespace test |
438 | 438 |
439 } // namespace net | 439 } // namespace net |
440 | 440 |
OLD | NEW |