diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-26 22:47:11 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-26 22:47:11 +0000 |
commit | d100e44f64d4abb2cc244cb61bb736c602146767 (patch) | |
tree | bfdd81d5424b2335e8543044dd726b0d30666663 /net/http/mock_gssapi_library_posix.h | |
parent | 5d8054efc1e1f26ea806e46869df5e0a84e41a4c (diff) | |
download | chromium_src-d100e44f64d4abb2cc244cb61bb736c602146767.zip chromium_src-d100e44f64d4abb2cc244cb61bb736c602146767.tar.gz chromium_src-d100e44f64d4abb2cc244cb61bb736c602146767.tar.bz2 |
More net/ method ordering.
BUG=68682
TEST=compiles
Review URL: http://codereview.chromium.org/6339012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72710 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/mock_gssapi_library_posix.h')
-rw-r--r-- | net/http/mock_gssapi_library_posix.h | 103 |
1 files changed, 51 insertions, 52 deletions
diff --git a/net/http/mock_gssapi_library_posix.h b/net/http/mock_gssapi_library_posix.h index 15e14f2..f0652d3 100644 --- a/net/http/mock_gssapi_library_posix.h +++ b/net/http/mock_gssapi_library_posix.h @@ -45,10 +45,61 @@ class GssContextMockImpl { // the system GSSAPI library calls. class MockGSSAPILibrary : public GSSAPILibrary { public: + // Unit tests need access to this. "Friend"ing didn't help. + struct SecurityContextQuery { + std::string expected_package; + OM_uint32 response_code; + OM_uint32 minor_response_code; + test::GssContextMockImpl context_info; + gss_buffer_desc expected_input_token; + gss_buffer_desc output_token; + }; MockGSSAPILibrary(); virtual ~MockGSSAPILibrary(); + // Establishes an expectation for a |init_sec_context()| call. + // + // Each expectation established by |ExpectSecurityContext()| must be + // matched by a call to |init_sec_context()| during the lifetime of + // the MockGSSAPILibrary. The |expected_package| argument must equal the + // value associated with the |target_name| argument to |init_sec_context()| + // for there to be a match. The expectations also establish an explicit + // ordering. + // + // For example, this sequence will be successful. + // MockGSSAPILibrary lib; + // lib.ExpectSecurityContext("NTLM", ...) + // lib.ExpectSecurityContext("Negotiate", ...) + // lib.init_sec_context("NTLM", ...) + // lib.init_sec_context("Negotiate", ...) + // + // This sequence will fail since the queries do not occur in the order + // established by the expectations. + // MockGSSAPILibrary lib; + // lib.ExpectSecurityContext("NTLM", ...) + // lib.ExpectSecurityContext("Negotiate", ...) + // lib.init_sec_context("Negotiate", ...) + // lib.init_sec_context("NTLM", ...) + // + // This sequence will fail because there were not enough queries. + // MockGSSAPILibrary lib; + // lib.ExpectSecurityContext("NTLM", ...) + // lib.ExpectSecurityContext("Negotiate", ...) + // lib.init_sec_context("NTLM", ...) + // + // |response_code| is used as the return value for |init_sec_context()|. + // If |response_code| is GSS_S_COMPLETE, + // + // |context_info| is the expected value of the |**context_handle| in after + // |init_sec_context()| returns. + void ExpectSecurityContext(const std::string& expected_package, + OM_uint32 response_code, + OM_uint32 minor_response_code, + const test::GssContextMockImpl& context_info, + const gss_buffer_desc& expected_input_token, + const gss_buffer_desc& output_token); + // GSSAPILibrary methods: // Initializes the library, including any necessary dynamic libraries. @@ -116,58 +167,6 @@ class MockGSSAPILibrary : public GSSAPILibrary { int* locally_initiated, int* open); - // Establishes an expectation for a |init_sec_context()| call. - // - // Each expectation established by |ExpectSecurityContext()| must be - // matched by a call to |init_sec_context()| during the lifetime of - // the MockGSSAPILibrary. The |expected_package| argument must equal the - // value associated with the |target_name| argument to |init_sec_context()| - // for there to be a match. The expectations also establish an explicit - // ordering. - // - // For example, this sequence will be successful. - // MockGSSAPILibrary lib; - // lib.ExpectSecurityContext("NTLM", ...) - // lib.ExpectSecurityContext("Negotiate", ...) - // lib.init_sec_context("NTLM", ...) - // lib.init_sec_context("Negotiate", ...) - // - // This sequence will fail since the queries do not occur in the order - // established by the expectations. - // MockGSSAPILibrary lib; - // lib.ExpectSecurityContext("NTLM", ...) - // lib.ExpectSecurityContext("Negotiate", ...) - // lib.init_sec_context("Negotiate", ...) - // lib.init_sec_context("NTLM", ...) - // - // This sequence will fail because there were not enough queries. - // MockGSSAPILibrary lib; - // lib.ExpectSecurityContext("NTLM", ...) - // lib.ExpectSecurityContext("Negotiate", ...) - // lib.init_sec_context("NTLM", ...) - // - // |response_code| is used as the return value for |init_sec_context()|. - // If |response_code| is GSS_S_COMPLETE, - // - // |context_info| is the expected value of the |**context_handle| in after - // |init_sec_context()| returns. - void ExpectSecurityContext(const std::string& expected_package, - OM_uint32 response_code, - OM_uint32 minor_response_code, - const test::GssContextMockImpl& context_info, - const gss_buffer_desc& expected_input_token, - const gss_buffer_desc& output_token); - - // Unit tests need access to this. "Friend"ing didn't help. - struct SecurityContextQuery { - std::string expected_package; - OM_uint32 response_code; - OM_uint32 minor_response_code; - test::GssContextMockImpl context_info; - gss_buffer_desc expected_input_token; - gss_buffer_desc output_token; - }; - private: FRIEND_TEST_ALL_PREFIXES(HttpAuthGSSAPIPOSIXTest, GSSAPICycle); |