OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/run_loop.h" | |
6 #include "base/test/test_ui_thread_android.h" | |
7 #include "net/android/http_auth_negotiate_android.h" | |
8 #include "net/base/net_errors.h" | |
9 #include "net/http/http_auth_challenge_tokenizer.h" | |
10 #include "testing/gtest/include/gtest/gtest.h" | |
11 | |
12 namespace net { | |
13 namespace android { | |
14 | |
15 namespace { | |
16 | |
17 void DummyCallback(base::Closure closure, int /*result*/) { | |
18 closure.Run(); | |
19 } | |
20 | |
21 } // namespace | |
22 | |
23 TEST(AndroidAuthNegotiateTest, GenerateAuthToken) { | |
24 HttpAuthNegotiateAndroid auth("org.chromium.test.DummySpnegoAuthenticator"); | |
25 EXPECT_TRUE(auth.Init()); | |
26 | |
27 base::StartTestUiThreadLooper(); | |
28 | |
29 std::string auth_token; | |
Ryan Sleevi
2015/06/16 01:07:46
API DANGER: This sort of highlights the danger in
aberent
2015/06/19 15:06:24
I agree that the std::string* parameter is horribl
| |
30 | |
31 base::RunLoop run_loop; | |
32 EXPECT_EQ(ERR_IO_PENDING, | |
33 auth.GenerateAuthToken( | |
34 nullptr, "Dummy", &auth_token, | |
35 base::Bind(&DummyCallback, run_loop.QuitClosure()))); | |
36 | |
37 run_loop.Run(); | |
38 | |
39 EXPECT_EQ("Negotiate DummyToken", auth_token); | |
Ryan Sleevi
2015/06/16 01:07:46
It'd be much better to use a net::TestCompletionCa
aberent
2015/06/19 15:06:24
Done.
| |
40 } | |
41 | |
42 } // namespace android | |
43 } // namespace net | |
OLD | NEW |