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

Side by Side Diff: net/spdy/spdy_network_transaction_unittest.cc

Issue 8340026: Use AuthCredentials throughout the network stack instead of username/password. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix comments Created 9 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
OLDNEW
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 "net/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "net/base/auth.h" 10 #include "net/base/auth.h"
(...skipping 4917 matching lines...) Expand 10 before | Expand all | Expand 10 after
4928 ASSERT_TRUE(response_start->headers != NULL); 4928 ASSERT_TRUE(response_start->headers != NULL);
4929 EXPECT_EQ(401, response_start->headers->response_code()); 4929 EXPECT_EQ(401, response_start->headers->response_code());
4930 EXPECT_TRUE(response_start->was_fetched_via_spdy); 4930 EXPECT_TRUE(response_start->was_fetched_via_spdy);
4931 AuthChallengeInfo* auth_challenge = response_start->auth_challenge.get(); 4931 AuthChallengeInfo* auth_challenge = response_start->auth_challenge.get();
4932 ASSERT_TRUE(auth_challenge != NULL); 4932 ASSERT_TRUE(auth_challenge != NULL);
4933 EXPECT_FALSE(auth_challenge->is_proxy); 4933 EXPECT_FALSE(auth_challenge->is_proxy);
4934 EXPECT_EQ("basic", auth_challenge->scheme); 4934 EXPECT_EQ("basic", auth_challenge->scheme);
4935 EXPECT_EQ("MyRealm", auth_challenge->realm); 4935 EXPECT_EQ("MyRealm", auth_challenge->realm);
4936 4936
4937 // Restart with a username/password. 4937 // Restart with a username/password.
4938 const string16 kFoo(ASCIIToUTF16("foo")); 4938 AuthCredentials credentials(ASCIIToUTF16("foo"), ASCIIToUTF16("bar"));
4939 const string16 kBar(ASCIIToUTF16("bar"));
4940 TestOldCompletionCallback callback_restart; 4939 TestOldCompletionCallback callback_restart;
4941 const int rv_restart = trans->RestartWithAuth(kFoo, kBar, &callback_restart); 4940 const int rv_restart = trans->RestartWithAuth(credentials, &callback_restart);
4942 EXPECT_EQ(ERR_IO_PENDING, rv_restart); 4941 EXPECT_EQ(ERR_IO_PENDING, rv_restart);
4943 const int rv_restart_complete = callback_restart.WaitForResult(); 4942 const int rv_restart_complete = callback_restart.WaitForResult();
4944 EXPECT_EQ(OK, rv_restart_complete); 4943 EXPECT_EQ(OK, rv_restart_complete);
4945 // TODO(cbentzel): This is actually the same response object as before, but 4944 // TODO(cbentzel): This is actually the same response object as before, but
4946 // data has changed. 4945 // data has changed.
4947 const HttpResponseInfo* const response_restart = trans->GetResponseInfo(); 4946 const HttpResponseInfo* const response_restart = trans->GetResponseInfo();
4948 ASSERT_TRUE(response_restart != NULL); 4947 ASSERT_TRUE(response_restart != NULL);
4949 ASSERT_TRUE(response_restart->headers != NULL); 4948 ASSERT_TRUE(response_restart->headers != NULL);
4950 EXPECT_EQ(200, response_restart->headers->response_code()); 4949 EXPECT_EQ(200, response_restart->headers->response_code());
4951 EXPECT_TRUE(response_restart->auth_challenge.get() == NULL); 4950 EXPECT_TRUE(response_restart->auth_challenge.get() == NULL);
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
5656 << " Write index: " 5655 << " Write index: "
5657 << data->write_index(); 5656 << data->write_index();
5658 5657
5659 // Verify the SYN_REPLY. 5658 // Verify the SYN_REPLY.
5660 HttpResponseInfo response = *trans->GetResponseInfo(); 5659 HttpResponseInfo response = *trans->GetResponseInfo();
5661 EXPECT_TRUE(response.headers != NULL); 5660 EXPECT_TRUE(response.headers != NULL);
5662 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); 5661 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine());
5663 } 5662 }
5664 5663
5665 } // namespace net 5664 } // namespace net
OLDNEW
« no previous file with comments | « net/socket_stream/socket_stream_unittest.cc ('k') | net/spdy/spdy_proxy_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698