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

Side by Side Diff: net/android/http_auth_negotiate_android_unittest.cc

Issue 1408433006: Support tls-server-end-point channel bindings for HTTP authentication. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Narrower dependencies, update comments, address review comments. Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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/run_loop.h" 5 #include "base/run_loop.h"
6 #include "net/android/dummy_spnego_authenticator.h" 6 #include "net/android/dummy_spnego_authenticator.h"
7 #include "net/android/http_auth_negotiate_android.h" 7 #include "net/android/http_auth_negotiate_android.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "net/base/test_completion_callback.h" 9 #include "net/base/test_completion_callback.h"
10 #include "net/http/http_auth_challenge_tokenizer.h" 10 #include "net/http/http_auth_challenge_tokenizer.h"
(...skipping 13 matching lines...) Expand all
24 authenticator.ExpectSecurityContext("Negotiate", GSS_S_COMPLETE, 0, 24 authenticator.ExpectSecurityContext("Negotiate", GSS_S_COMPLETE, 0,
25 mockContext, "", "DummyToken"); 25 mockContext, "", "DummyToken");
26 26
27 MockAllowHttpAuthPreferences prefs; 27 MockAllowHttpAuthPreferences prefs;
28 prefs.set_auth_android_negotiate_account_type( 28 prefs.set_auth_android_negotiate_account_type(
29 "org.chromium.test.DummySpnegoAuthenticator"); 29 "org.chromium.test.DummySpnegoAuthenticator");
30 HttpAuthNegotiateAndroid auth(&prefs); 30 HttpAuthNegotiateAndroid auth(&prefs);
31 EXPECT_TRUE(auth.Init()); 31 EXPECT_TRUE(auth.Init());
32 32
33 TestCompletionCallback callback; 33 TestCompletionCallback callback;
34 EXPECT_EQ(OK, callback.GetResult(auth.GenerateAuthToken( 34 EXPECT_EQ(OK, callback.GetResult(
35 nullptr, "Dummy", &auth_token, callback.callback()))); 35 auth.GenerateAuthToken(nullptr, "Dummy", std::string(),
36 &auth_token, callback.callback())));
36 37
37 EXPECT_EQ("Negotiate DummyToken", auth_token); 38 EXPECT_EQ("Negotiate DummyToken", auth_token);
38 39
39 DummySpnegoAuthenticator::RemoveTestAccounts(); 40 DummySpnegoAuthenticator::RemoveTestAccounts();
40 } 41 }
41 42
42 TEST(HttpAuthNegotiateAndroidTest, ParseChallenge_FirstRound) { 43 TEST(HttpAuthNegotiateAndroidTest, ParseChallenge_FirstRound) {
43 // The first round should just consist of an unadorned "Negotiate" header. 44 // The first round should just consist of an unadorned "Negotiate" header.
44 MockAllowHttpAuthPreferences prefs; 45 MockAllowHttpAuthPreferences prefs;
45 prefs.set_auth_android_negotiate_account_type( 46 prefs.set_auth_android_negotiate_account_type(
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 102
102 std::string second_challenge_text = "Negotiate"; 103 std::string second_challenge_text = "Negotiate";
103 HttpAuthChallengeTokenizer second_challenge(second_challenge_text.begin(), 104 HttpAuthChallengeTokenizer second_challenge(second_challenge_text.begin(),
104 second_challenge_text.end()); 105 second_challenge_text.end());
105 EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_REJECT, 106 EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_REJECT,
106 auth.ParseChallenge(&second_challenge)); 107 auth.ParseChallenge(&second_challenge));
107 } 108 }
108 109
109 } // namespace android 110 } // namespace android
110 } // namespace net 111 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698