OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "net/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 3832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3843 EXPECT_FALSE(response == NULL); | 3843 EXPECT_FALSE(response == NULL); |
3844 EXPECT_TRUE(response->auth_challenge.get() == NULL); | 3844 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
3845 EXPECT_EQ(100, response->headers->GetContentLength()); | 3845 EXPECT_EQ(100, response->headers->GetContentLength()); |
3846 } | 3846 } |
3847 } | 3847 } |
3848 | 3848 |
3849 // Tests that nonce count increments when multiple auth attempts | 3849 // Tests that nonce count increments when multiple auth attempts |
3850 // are started with the same nonce. | 3850 // are started with the same nonce. |
3851 TEST_F(HttpNetworkTransactionTest, DigestPreAuthNonceCount) { | 3851 TEST_F(HttpNetworkTransactionTest, DigestPreAuthNonceCount) { |
3852 SessionDependencies session_deps; | 3852 SessionDependencies session_deps; |
| 3853 HttpAuthHandlerDigest::Factory* digest_factory = |
| 3854 new HttpAuthHandlerDigest::Factory(); |
| 3855 HttpAuthHandlerDigest::FixedNonceGenerator* nonce_generator = |
| 3856 new HttpAuthHandlerDigest::FixedNonceGenerator("0123456789abcdef"); |
| 3857 digest_factory->set_nonce_generator(nonce_generator); |
| 3858 session_deps.http_auth_handler_factory.reset(digest_factory); |
3853 scoped_refptr<HttpNetworkSession> session = CreateSession(&session_deps); | 3859 scoped_refptr<HttpNetworkSession> session = CreateSession(&session_deps); |
3854 HttpAuthHandlerDigest::SetFixedCnonce(true); | |
3855 | 3860 |
3856 // Transaction 1: authenticate (foo, bar) on MyRealm1 | 3861 // Transaction 1: authenticate (foo, bar) on MyRealm1 |
3857 { | 3862 { |
3858 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 3863 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
3859 | 3864 |
3860 HttpRequestInfo request; | 3865 HttpRequestInfo request; |
3861 request.method = "GET"; | 3866 request.method = "GET"; |
3862 request.url = GURL("http://www.google.com/x/y/z"); | 3867 request.url = GURL("http://www.google.com/x/y/z"); |
3863 request.load_flags = 0; | 3868 request.load_flags = 0; |
3864 | 3869 |
(...skipping 3744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7609 request.motivation = HttpRequestInfo::PRECONNECT_MOTIVATED; | 7614 request.motivation = HttpRequestInfo::PRECONNECT_MOTIVATED; |
7610 | 7615 |
7611 scoped_ptr<HttpNetworkTransaction> trans(new HttpNetworkTransaction(session)); | 7616 scoped_ptr<HttpNetworkTransaction> trans(new HttpNetworkTransaction(session)); |
7612 | 7617 |
7613 int rv = trans->Start(&request, &callback, BoundNetLog()); | 7618 int rv = trans->Start(&request, &callback, BoundNetLog()); |
7614 EXPECT_EQ(ERR_IO_PENDING, rv); | 7619 EXPECT_EQ(ERR_IO_PENDING, rv); |
7615 EXPECT_EQ(OK, callback.WaitForResult()); | 7620 EXPECT_EQ(OK, callback.WaitForResult()); |
7616 } | 7621 } |
7617 | 7622 |
7618 } // namespace net | 7623 } // namespace net |
OLD | NEW |