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

Side by Side Diff: net/http/http_network_transaction_unittest.cc

Issue 5034001: Remove static "set_fixed_cnonce" in favor of NonceGenerator objects.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« net/http/http_auth_handler_digest.h ('K') | « net/http/http_auth_handler_digest_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698