OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <math.h> // ceil | 5 #include <math.h> // ceil |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "net/base/completion_callback.h" | 8 #include "net/base/completion_callback.h" |
9 #include "net/base/mock_host_resolver.h" | 9 #include "net/base/mock_host_resolver.h" |
10 #include "net/base/ssl_config_service_defaults.h" | 10 #include "net/base/ssl_config_service_defaults.h" |
11 #include "net/base/ssl_info.h" | 11 #include "net/base/ssl_info.h" |
(...skipping 2620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2632 std::replace(temp.begin(), temp.end(), '\n', '\0'); | 2632 std::replace(temp.begin(), temp.end(), '\n', '\0'); |
2633 scoped_refptr<HttpResponseHeaders> response = new HttpResponseHeaders(temp); | 2633 scoped_refptr<HttpResponseHeaders> response = new HttpResponseHeaders(temp); |
2634 request.extra_headers = "Foo: 1\nbar: 23"; | 2634 request.extra_headers = "Foo: 1\nbar: 23"; |
2635 EXPECT_TRUE(trans->response_.vary_data.Init(request, *response)); | 2635 EXPECT_TRUE(trans->response_.vary_data.Init(request, *response)); |
2636 } | 2636 } |
2637 | 2637 |
2638 // Cause the above state to be reset. | 2638 // Cause the above state to be reset. |
2639 trans->ResetStateForRestart(); | 2639 trans->ResetStateForRestart(); |
2640 | 2640 |
2641 // Verify that the state that needed to be reset, has been reset. | 2641 // Verify that the state that needed to be reset, has been reset. |
2642 EXPECT_TRUE(NULL == trans->header_buf_->headers()); | 2642 EXPECT_EQ(NULL, trans->header_buf_->headers()); |
2643 EXPECT_EQ(0, trans->header_buf_capacity_); | 2643 EXPECT_EQ(0, trans->header_buf_capacity_); |
2644 EXPECT_EQ(0, trans->header_buf_len_); | 2644 EXPECT_EQ(0, trans->header_buf_len_); |
2645 EXPECT_EQ(-1, trans->header_buf_body_offset_); | 2645 EXPECT_EQ(-1, trans->header_buf_body_offset_); |
2646 EXPECT_EQ(-1, trans->header_buf_http_offset_); | 2646 EXPECT_EQ(-1, trans->header_buf_http_offset_); |
2647 EXPECT_EQ(-1, trans->response_body_length_); | 2647 EXPECT_EQ(-1, trans->response_body_length_); |
2648 EXPECT_EQ(0, trans->response_body_read_); | 2648 EXPECT_EQ(0, trans->response_body_read_); |
2649 EXPECT_TRUE(NULL == trans->read_buf_.get()); | 2649 EXPECT_EQ(NULL, trans->read_buf_.get()); |
2650 EXPECT_EQ(0, trans->read_buf_len_); | 2650 EXPECT_EQ(0, trans->read_buf_len_); |
2651 EXPECT_EQ("", trans->request_headers_->headers_); | 2651 EXPECT_EQ("", trans->request_headers_->headers_); |
2652 EXPECT_EQ(0U, trans->request_headers_bytes_sent_); | 2652 EXPECT_EQ(0U, trans->request_headers_bytes_sent_); |
2653 EXPECT_TRUE(NULL == trans->response_.auth_challenge.get()); | 2653 EXPECT_EQ(NULL, trans->response_.auth_challenge.get()); |
2654 EXPECT_TRUE(NULL == trans->response_.headers.get()); | 2654 EXPECT_EQ(NULL, trans->response_.headers.get()); |
2655 EXPECT_EQ(false, trans->response_.was_cached); | 2655 EXPECT_EQ(false, trans->response_.was_cached); |
2656 EXPECT_EQ(0, trans->response_.ssl_info.cert_status); | 2656 EXPECT_EQ(0, trans->response_.ssl_info.cert_status); |
2657 EXPECT_FALSE(trans->response_.vary_data.is_valid()); | 2657 EXPECT_FALSE(trans->response_.vary_data.is_valid()); |
2658 } | 2658 } |
2659 | 2659 |
2660 // Test HTTPS connections to a site with a bad certificate | 2660 // Test HTTPS connections to a site with a bad certificate |
2661 TEST_F(HttpNetworkTransactionTest, HTTPSBadCertificate) { | 2661 TEST_F(HttpNetworkTransactionTest, HTTPSBadCertificate) { |
2662 SessionDependencies session_deps; | 2662 SessionDependencies session_deps; |
2663 scoped_ptr<HttpTransaction> trans( | 2663 scoped_ptr<HttpTransaction> trans( |
2664 new HttpNetworkTransaction( | 2664 new HttpNetworkTransaction( |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3617 // Extract the unescaped identity. | 3617 // Extract the unescaped identity. |
3618 std::wstring username, password; | 3618 std::wstring username, password; |
3619 HttpNetworkTransaction::GetIdentifyFromUrl(url, &username, &password); | 3619 HttpNetworkTransaction::GetIdentifyFromUrl(url, &username, &password); |
3620 | 3620 |
3621 // Verify that it was decoded as UTF8. | 3621 // Verify that it was decoded as UTF8. |
3622 EXPECT_EQ(L"foo", username); | 3622 EXPECT_EQ(L"foo", username); |
3623 EXPECT_EQ(L"\x4f60\x597d", password); | 3623 EXPECT_EQ(L"\x4f60\x597d", password); |
3624 } | 3624 } |
3625 | 3625 |
3626 } // namespace net | 3626 } // namespace net |
OLD | NEW |