OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shlobj.h> | 9 #include <shlobj.h> |
10 #endif | 10 #endif |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 // -1 means unknown. 0 means no encryption. | 141 // -1 means unknown. 0 means no encryption. |
142 EXPECT_GT(ssl_info.security_bits, 0); | 142 EXPECT_GT(ssl_info.security_bits, 0); |
143 | 143 |
144 // The cipher suite TLS_NULL_WITH_NULL_NULL (0) must not be negotiated. | 144 // The cipher suite TLS_NULL_WITH_NULL_NULL (0) must not be negotiated. |
145 int cipher_suite = SSLConnectionStatusToCipherSuite( | 145 int cipher_suite = SSLConnectionStatusToCipherSuite( |
146 ssl_info.connection_status); | 146 ssl_info.connection_status); |
147 EXPECT_NE(0, cipher_suite); | 147 EXPECT_NE(0, cipher_suite); |
148 } | 148 } |
149 | 149 |
150 bool FingerprintsEqual(const HashValueVector& a, const HashValueVector& b) { | 150 bool FingerprintsEqual(const FingerprintVector& a, const FingerprintVector& b) { |
151 size_t size = a.size(); | 151 size_t size = a.size(); |
152 | 152 |
153 if (size != b.size()) | 153 if (size != b.size()) |
154 return false; | 154 return false; |
155 | 155 |
156 for (size_t i = 0; i < size; ++i) { | 156 for (size_t i = 0; i < size; ++i) { |
157 if (!a[i].Equals(b[i])) | 157 if (!a[i].Equals(b[i])) |
158 return false; | 158 return false; |
159 } | 159 } |
160 | 160 |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 ASSERT_EQ(1, d->response_started_count()) << "request failed: " << | 543 ASSERT_EQ(1, d->response_started_count()) << "request failed: " << |
544 (int) r->status().status() << ", os error: " << r->status().error(); | 544 (int) r->status().status() << ", os error: " << r->status().error(); |
545 | 545 |
546 EXPECT_FALSE(d->received_data_before_response()); | 546 EXPECT_FALSE(d->received_data_before_response()); |
547 | 547 |
548 ASSERT_EQ(strlen(expected_data), static_cast<size_t>(d->bytes_received())); | 548 ASSERT_EQ(strlen(expected_data), static_cast<size_t>(d->bytes_received())); |
549 EXPECT_EQ(0, memcmp(d->data_received().c_str(), expected_data, | 549 EXPECT_EQ(0, memcmp(d->data_received().c_str(), expected_data, |
550 strlen(expected_data))); | 550 strlen(expected_data))); |
551 } | 551 } |
552 | 552 |
553 bool DoManyCookiesRequest(int num_cookies) { | 553 bool DoManyCookiesRequest(int num_cookies){ |
554 TestDelegate d; | 554 TestDelegate d; |
555 URLRequest r(test_server_.GetURL("set-many-cookies?" + | 555 URLRequest r(test_server_.GetURL("set-many-cookies?" + |
556 base::IntToString(num_cookies)), | 556 base::IntToString(num_cookies)), |
557 &d, | 557 &d, |
558 &default_context_); | 558 &default_context_); |
559 | 559 |
560 r.Start(); | 560 r.Start(); |
561 EXPECT_TRUE(r.is_pending()); | 561 EXPECT_TRUE(r.is_pending()); |
562 | 562 |
563 MessageLoop::current()->Run(); | 563 MessageLoop::current()->Run(); |
564 | 564 |
565 bool is_success = r.status().is_success(); | 565 bool is_success = r.status().is_success(); |
566 | 566 |
567 if (!is_success) { | 567 if (!is_success){ |
568 // Requests handled by ChromeFrame send a less precise error message, | 568 // Requests handled by ChromeFrame send a less precise error message, |
569 // ERR_CONNECTION_ABORTED. | 569 // ERR_CONNECTION_ABORTED. |
570 EXPECT_TRUE(r.status().error() == ERR_RESPONSE_HEADERS_TOO_BIG || | 570 EXPECT_TRUE(r.status().error() == ERR_RESPONSE_HEADERS_TOO_BIG || |
571 r.status().error() == ERR_CONNECTION_ABORTED); | 571 r.status().error() == ERR_CONNECTION_ABORTED); |
572 // The test server appears to be unable to handle subsequent requests | 572 // The test server appears to be unable to handle subsequent requests |
573 // after this error is triggered. Force it to restart. | 573 // after this error is triggered. Force it to restart. |
574 EXPECT_TRUE(test_server_.Stop()); | 574 EXPECT_TRUE(test_server_.Stop()); |
575 EXPECT_TRUE(test_server_.Start()); | 575 EXPECT_TRUE(test_server_.Start()); |
576 } | 576 } |
577 | 577 |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 protected: | 1466 protected: |
1467 virtual ~TestSSLConfigService() {} | 1467 virtual ~TestSSLConfigService() {} |
1468 | 1468 |
1469 private: | 1469 private: |
1470 const bool ev_enabled_; | 1470 const bool ev_enabled_; |
1471 const bool online_rev_checking_; | 1471 const bool online_rev_checking_; |
1472 }; | 1472 }; |
1473 | 1473 |
1474 // This the fingerprint of the "Testing CA" certificate used by the testserver. | 1474 // This the fingerprint of the "Testing CA" certificate used by the testserver. |
1475 // See net/data/ssl/certificates/ocsp-test-root.pem. | 1475 // See net/data/ssl/certificates/ocsp-test-root.pem. |
1476 static const SHA1HashValue kOCSPTestCertFingerprint = | 1476 static const SHA1Fingerprint kOCSPTestCertFingerprint = |
1477 { { 0xf1, 0xad, 0xf6, 0xce, 0x42, 0xac, 0xe7, 0xb4, 0xf4, 0x24, | 1477 { { 0xf1, 0xad, 0xf6, 0xce, 0x42, 0xac, 0xe7, 0xb4, 0xf4, 0x24, |
1478 0xdb, 0x1a, 0xf7, 0xa0, 0x9f, 0x09, 0xa1, 0xea, 0xf1, 0x5c } }; | 1478 0xdb, 0x1a, 0xf7, 0xa0, 0x9f, 0x09, 0xa1, 0xea, 0xf1, 0x5c } }; |
1479 | 1479 |
1480 // This is the policy OID contained in the certificates that testserver | 1480 // This is the policy OID contained in the certificates that testserver |
1481 // generates. | 1481 // generates. |
1482 static const char kOCSPTestCertPolicy[] = "1.3.6.1.4.1.11129.2.4.1"; | 1482 static const char kOCSPTestCertPolicy[] = "1.3.6.1.4.1.11129.2.4.1"; |
1483 | 1483 |
1484 class HTTPSOCSPTest : public HTTPSRequestTest { | 1484 class HTTPSOCSPTest : public HTTPSRequestTest { |
1485 public: | 1485 public: |
1486 HTTPSOCSPTest() | 1486 HTTPSOCSPTest() |
(...skipping 3145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4632 req.SetExtraRequestHeaders(headers); | 4632 req.SetExtraRequestHeaders(headers); |
4633 req.Start(); | 4633 req.Start(); |
4634 MessageLoop::current()->Run(); | 4634 MessageLoop::current()->Run(); |
4635 // If the net tests are being run with ChromeFrame then we need to allow for | 4635 // If the net tests are being run with ChromeFrame then we need to allow for |
4636 // the 'chromeframe' suffix which is added to the user agent before the | 4636 // the 'chromeframe' suffix which is added to the user agent before the |
4637 // closing parentheses. | 4637 // closing parentheses. |
4638 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); | 4638 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); |
4639 } | 4639 } |
4640 | 4640 |
4641 } // namespace net | 4641 } // namespace net |
OLD | NEW |