OLD | NEW |
---|---|
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
wtc
2009/10/02 23:59:32
I thought we should change
2006-2008
to
2006-2
| |
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 2738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2750 std::replace(temp.begin(), temp.end(), '\n', '\0'); | 2750 std::replace(temp.begin(), temp.end(), '\n', '\0'); |
2751 scoped_refptr<HttpResponseHeaders> response = new HttpResponseHeaders(temp); | 2751 scoped_refptr<HttpResponseHeaders> response = new HttpResponseHeaders(temp); |
2752 request.extra_headers = "Foo: 1\nbar: 23"; | 2752 request.extra_headers = "Foo: 1\nbar: 23"; |
2753 EXPECT_TRUE(trans->response_.vary_data.Init(request, *response)); | 2753 EXPECT_TRUE(trans->response_.vary_data.Init(request, *response)); |
2754 } | 2754 } |
2755 | 2755 |
2756 // Cause the above state to be reset. | 2756 // Cause the above state to be reset. |
2757 trans->ResetStateForRestart(); | 2757 trans->ResetStateForRestart(); |
2758 | 2758 |
2759 // Verify that the state that needed to be reset, has been reset. | 2759 // Verify that the state that needed to be reset, has been reset. |
2760 EXPECT_EQ(NULL, trans->header_buf_->headers()); | 2760 EXPECT_TRUE(trans->header_buf_->headers() == NULL); |
2761 EXPECT_EQ(0, trans->header_buf_capacity_); | 2761 EXPECT_EQ(0, trans->header_buf_capacity_); |
2762 EXPECT_EQ(0, trans->header_buf_len_); | 2762 EXPECT_EQ(0, trans->header_buf_len_); |
2763 EXPECT_EQ(-1, trans->header_buf_body_offset_); | 2763 EXPECT_EQ(-1, trans->header_buf_body_offset_); |
2764 EXPECT_EQ(-1, trans->header_buf_http_offset_); | 2764 EXPECT_EQ(-1, trans->header_buf_http_offset_); |
2765 EXPECT_EQ(-1, trans->response_body_length_); | 2765 EXPECT_EQ(-1, trans->response_body_length_); |
2766 EXPECT_EQ(0, trans->response_body_read_); | 2766 EXPECT_EQ(0, trans->response_body_read_); |
2767 EXPECT_EQ(NULL, trans->read_buf_.get()); | 2767 EXPECT_TRUE(trans->read_buf_.get() == NULL); |
2768 EXPECT_EQ(0, trans->read_buf_len_); | 2768 EXPECT_EQ(0, trans->read_buf_len_); |
2769 EXPECT_EQ("", trans->request_headers_->headers_); | 2769 EXPECT_EQ("", trans->request_headers_->headers_); |
2770 EXPECT_EQ(0U, trans->request_headers_bytes_sent_); | 2770 EXPECT_EQ(0U, trans->request_headers_bytes_sent_); |
2771 EXPECT_EQ(NULL, trans->response_.auth_challenge.get()); | 2771 EXPECT_TRUE(trans->response_.auth_challenge.get() == NULL); |
2772 EXPECT_EQ(NULL, trans->response_.headers.get()); | 2772 EXPECT_TRUE(trans->response_.headers.get() == NULL); |
2773 EXPECT_EQ(false, trans->response_.was_cached); | 2773 EXPECT_EQ(false, trans->response_.was_cached); |
2774 EXPECT_EQ(0, trans->response_.ssl_info.cert_status); | 2774 EXPECT_EQ(0, trans->response_.ssl_info.cert_status); |
2775 EXPECT_FALSE(trans->response_.vary_data.is_valid()); | 2775 EXPECT_FALSE(trans->response_.vary_data.is_valid()); |
2776 } | 2776 } |
2777 | 2777 |
2778 // Test HTTPS connections to a site with a bad certificate | 2778 // Test HTTPS connections to a site with a bad certificate |
2779 TEST_F(HttpNetworkTransactionTest, HTTPSBadCertificate) { | 2779 TEST_F(HttpNetworkTransactionTest, HTTPSBadCertificate) { |
2780 SessionDependencies session_deps; | 2780 SessionDependencies session_deps; |
2781 scoped_ptr<HttpTransaction> trans( | 2781 scoped_ptr<HttpTransaction> trans( |
2782 new HttpNetworkTransaction( | 2782 new HttpNetworkTransaction( |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3670 rv = trans->Start(&request, &callback, NULL); | 3670 rv = trans->Start(&request, &callback, NULL); |
3671 ASSERT_EQ(ERR_IO_PENDING, rv); | 3671 ASSERT_EQ(ERR_IO_PENDING, rv); |
3672 rv = callback.WaitForResult(); | 3672 rv = callback.WaitForResult(); |
3673 | 3673 |
3674 // If we bypassed the cache, we would have gotten a failure while resolving | 3674 // If we bypassed the cache, we would have gotten a failure while resolving |
3675 // "www.google.com". | 3675 // "www.google.com". |
3676 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, rv); | 3676 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, rv); |
3677 } | 3677 } |
3678 | 3678 |
3679 } // namespace net | 3679 } // namespace net |
OLD | NEW |