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

Unified Diff: net/http/mock_gssapi_library_posix.h

Issue 6339012: More net/ method ordering. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More done while waiting for previous patch to clear Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_request_headers.cc ('k') | net/http/mock_gssapi_library_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/mock_gssapi_library_posix.h
diff --git a/net/http/mock_gssapi_library_posix.h b/net/http/mock_gssapi_library_posix.h
index 15e14f2deec5ace8a92fd0cd83dddc48c3aaa42e..f0652d36652f8458733d6e11050e173f0972e88d 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);
« no previous file with comments | « net/http/http_request_headers.cc ('k') | net/http/mock_gssapi_library_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698