| 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 "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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |