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 4070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4081 EXPECT_FALSE(response == NULL); | 4081 EXPECT_FALSE(response == NULL); |
4082 EXPECT_TRUE(response->auth_challenge.get() == NULL); | 4082 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
4083 EXPECT_EQ(100, response->headers->GetContentLength()); | 4083 EXPECT_EQ(100, response->headers->GetContentLength()); |
4084 } | 4084 } |
4085 } | 4085 } |
4086 | 4086 |
4087 // Tests that nonce count increments when multiple auth attempts | 4087 // Tests that nonce count increments when multiple auth attempts |
4088 // are started with the same nonce. | 4088 // are started with the same nonce. |
4089 TEST_F(HttpNetworkTransactionTest, DigestPreAuthNonceCount) { | 4089 TEST_F(HttpNetworkTransactionTest, DigestPreAuthNonceCount) { |
4090 SessionDependencies session_deps; | 4090 SessionDependencies session_deps; |
| 4091 HttpAuthHandlerDigest::Factory* digest_factory = |
| 4092 new HttpAuthHandlerDigest::Factory(); |
| 4093 HttpAuthHandlerDigest::FixedNonceGenerator* nonce_generator = |
| 4094 new HttpAuthHandlerDigest::FixedNonceGenerator("0123456789abcdef"); |
| 4095 digest_factory->set_nonce_generator(nonce_generator); |
| 4096 session_deps.http_auth_handler_factory.reset(digest_factory); |
4091 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); | 4097 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); |
4092 HttpAuthHandlerDigest::SetFixedCnonce(true); | |
4093 | 4098 |
4094 // Transaction 1: authenticate (foo, bar) on MyRealm1 | 4099 // Transaction 1: authenticate (foo, bar) on MyRealm1 |
4095 { | 4100 { |
4096 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); | 4101 scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); |
4097 | 4102 |
4098 HttpRequestInfo request; | 4103 HttpRequestInfo request; |
4099 request.method = "GET"; | 4104 request.method = "GET"; |
4100 request.url = GURL("http://www.google.com/x/y/z"); | 4105 request.url = GURL("http://www.google.com/x/y/z"); |
4101 request.load_flags = 0; | 4106 request.load_flags = 0; |
4102 | 4107 |
(...skipping 3836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7939 rv = callback.WaitForResult(); | 7944 rv = callback.WaitForResult(); |
7940 ASSERT_EQ(OK, rv); | 7945 ASSERT_EQ(OK, rv); |
7941 | 7946 |
7942 std::string contents; | 7947 std::string contents; |
7943 rv = ReadTransaction(trans.get(), &contents); | 7948 rv = ReadTransaction(trans.get(), &contents); |
7944 EXPECT_EQ(net::OK, rv); | 7949 EXPECT_EQ(net::OK, rv); |
7945 EXPECT_EQ("hello world", contents); | 7950 EXPECT_EQ("hello world", contents); |
7946 } | 7951 } |
7947 | 7952 |
7948 } // namespace net | 7953 } // namespace net |
OLD | NEW |