| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 int rv_create = factory->CreateAuthHandlerFromString( | 56 int rv_create = factory->CreateAuthHandlerFromString( |
| 57 challenge, target, url_origin.GetOrigin(), BoundNetLog(), &handler); | 57 challenge, target, url_origin.GetOrigin(), BoundNetLog(), &handler); |
| 58 if (rv_create != OK || handler.get() == NULL) { | 58 if (rv_create != OK || handler.get() == NULL) { |
| 59 ADD_FAILURE() << "Unable to create auth handler."; | 59 ADD_FAILURE() << "Unable to create auth handler."; |
| 60 return false; | 60 return false; |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Create a token in response to the challenge. | 63 // Create a token in response to the challenge. |
| 64 // NOTE: HttpAuthHandlerDigest's implementation of GenerateAuthToken always | 64 // NOTE: HttpAuthHandlerDigest's implementation of GenerateAuthToken always |
| 65 // completes synchronously. That's why this test can get away with a | 65 // completes synchronously. That's why this test can get away with a |
| 66 // TestOldCompletionCallback without an IO thread. | 66 // TestCompletionCallback without an IO thread. |
| 67 TestOldCompletionCallback callback; | 67 TestCompletionCallback callback; |
| 68 scoped_ptr<HttpRequestInfo> request(new HttpRequestInfo()); | 68 scoped_ptr<HttpRequestInfo> request(new HttpRequestInfo()); |
| 69 request->url = GURL(request_url); | 69 request->url = GURL(request_url); |
| 70 AuthCredentials credentials(ASCIIToUTF16("foo"), ASCIIToUTF16("bar")); | 70 AuthCredentials credentials(ASCIIToUTF16("foo"), ASCIIToUTF16("bar")); |
| 71 int rv_generate = handler->GenerateAuthToken( | 71 int rv_generate = handler->GenerateAuthToken( |
| 72 &credentials, request.get(), &callback, token); | 72 &credentials, request.get(), callback.callback(), token); |
| 73 if (rv_generate != OK) { | 73 if (rv_generate != OK) { |
| 74 ADD_FAILURE() << "Problems generating auth token"; | 74 ADD_FAILURE() << "Problems generating auth token"; |
| 75 return false; | 75 return false; |
| 76 } | 76 } |
| 77 | 77 |
| 78 return true; | 78 return true; |
| 79 } | 79 } |
| 80 | 80 |
| 81 } // namespace | 81 } // namespace |
| 82 | 82 |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 EXPECT_EQ("Digest username=\"foo\", realm=\"Oblivion\", " | 659 EXPECT_EQ("Digest username=\"foo\", realm=\"Oblivion\", " |
| 660 "nonce=\"nonce-value\", uri=\"/path/to/resource\", " | 660 "nonce=\"nonce-value\", uri=\"/path/to/resource\", " |
| 661 "response=\"5b1459beda5cee30d6ff9e970a69c0ea\", " | 661 "response=\"5b1459beda5cee30d6ff9e970a69c0ea\", " |
| 662 "opaque=\"opaque text\", " | 662 "opaque=\"opaque text\", " |
| 663 "qop=auth, nc=00000001, cnonce=\"client_nonce\"", | 663 "qop=auth, nc=00000001, cnonce=\"client_nonce\"", |
| 664 auth_token); | 664 auth_token); |
| 665 } | 665 } |
| 666 | 666 |
| 667 | 667 |
| 668 } // namespace net | 668 } // namespace net |
| OLD | NEW |