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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 10827104: Revert 149261 - Support SHA-256 in public key pins for HTTPS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months 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 | Annotate | Revision Log
OLDNEW
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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 // -1 means unknown. 0 means no encryption. 140 // -1 means unknown. 0 means no encryption.
141 EXPECT_GT(ssl_info.security_bits, 0); 141 EXPECT_GT(ssl_info.security_bits, 0);
142 142
143 // The cipher suite TLS_NULL_WITH_NULL_NULL (0) must not be negotiated. 143 // The cipher suite TLS_NULL_WITH_NULL_NULL (0) must not be negotiated.
144 int cipher_suite = SSLConnectionStatusToCipherSuite( 144 int cipher_suite = SSLConnectionStatusToCipherSuite(
145 ssl_info.connection_status); 145 ssl_info.connection_status);
146 EXPECT_NE(0, cipher_suite); 146 EXPECT_NE(0, cipher_suite);
147 } 147 }
148 148
149 bool FingerprintsEqual(const HashValueVector& a, const HashValueVector& b) { 149 bool FingerprintsEqual(const FingerprintVector& a, const FingerprintVector& b) {
150 size_t size = a.size(); 150 size_t size = a.size();
151 151
152 if (size != b.size()) 152 if (size != b.size())
153 return false; 153 return false;
154 154
155 for (size_t i = 0; i < size; ++i) { 155 for (size_t i = 0; i < size; ++i) {
156 if (!a[i].Equals(b[i])) 156 if (!a[i].Equals(b[i]))
157 return false; 157 return false;
158 } 158 }
159 159
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 ASSERT_EQ(1, d->response_started_count()) << "request failed: " << 542 ASSERT_EQ(1, d->response_started_count()) << "request failed: " <<
543 (int) r->status().status() << ", os error: " << r->status().error(); 543 (int) r->status().status() << ", os error: " << r->status().error();
544 544
545 EXPECT_FALSE(d->received_data_before_response()); 545 EXPECT_FALSE(d->received_data_before_response());
546 546
547 ASSERT_EQ(strlen(expected_data), static_cast<size_t>(d->bytes_received())); 547 ASSERT_EQ(strlen(expected_data), static_cast<size_t>(d->bytes_received()));
548 EXPECT_EQ(0, memcmp(d->data_received().c_str(), expected_data, 548 EXPECT_EQ(0, memcmp(d->data_received().c_str(), expected_data,
549 strlen(expected_data))); 549 strlen(expected_data)));
550 } 550 }
551 551
552 bool DoManyCookiesRequest(int num_cookies) { 552 bool DoManyCookiesRequest(int num_cookies){
553 TestDelegate d; 553 TestDelegate d;
554 URLRequest r(test_server_.GetURL("set-many-cookies?" + 554 URLRequest r(test_server_.GetURL("set-many-cookies?" +
555 base::IntToString(num_cookies)), 555 base::IntToString(num_cookies)),
556 &d, 556 &d,
557 &default_context_); 557 &default_context_);
558 558
559 r.Start(); 559 r.Start();
560 EXPECT_TRUE(r.is_pending()); 560 EXPECT_TRUE(r.is_pending());
561 561
562 MessageLoop::current()->Run(); 562 MessageLoop::current()->Run();
563 563
564 bool is_success = r.status().is_success(); 564 bool is_success = r.status().is_success();
565 565
566 if (!is_success) { 566 if (!is_success){
567 // Requests handled by ChromeFrame send a less precise error message, 567 // Requests handled by ChromeFrame send a less precise error message,
568 // ERR_CONNECTION_ABORTED. 568 // ERR_CONNECTION_ABORTED.
569 EXPECT_TRUE(r.status().error() == ERR_RESPONSE_HEADERS_TOO_BIG || 569 EXPECT_TRUE(r.status().error() == ERR_RESPONSE_HEADERS_TOO_BIG ||
570 r.status().error() == ERR_CONNECTION_ABORTED); 570 r.status().error() == ERR_CONNECTION_ABORTED);
571 // The test server appears to be unable to handle subsequent requests 571 // The test server appears to be unable to handle subsequent requests
572 // after this error is triggered. Force it to restart. 572 // after this error is triggered. Force it to restart.
573 EXPECT_TRUE(test_server_.Stop()); 573 EXPECT_TRUE(test_server_.Stop());
574 EXPECT_TRUE(test_server_.Start()); 574 EXPECT_TRUE(test_server_.Start());
575 } 575 }
576 576
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 protected: 1465 protected:
1466 virtual ~TestSSLConfigService() {} 1466 virtual ~TestSSLConfigService() {}
1467 1467
1468 private: 1468 private:
1469 const bool ev_enabled_; 1469 const bool ev_enabled_;
1470 const bool online_rev_checking_; 1470 const bool online_rev_checking_;
1471 }; 1471 };
1472 1472
1473 // This the fingerprint of the "Testing CA" certificate used by the testserver. 1473 // This the fingerprint of the "Testing CA" certificate used by the testserver.
1474 // See net/data/ssl/certificates/ocsp-test-root.pem. 1474 // See net/data/ssl/certificates/ocsp-test-root.pem.
1475 static const SHA1HashValue kOCSPTestCertFingerprint = 1475 static const SHA1Fingerprint kOCSPTestCertFingerprint =
1476 { { 0xf1, 0xad, 0xf6, 0xce, 0x42, 0xac, 0xe7, 0xb4, 0xf4, 0x24, 1476 { { 0xf1, 0xad, 0xf6, 0xce, 0x42, 0xac, 0xe7, 0xb4, 0xf4, 0x24,
1477 0xdb, 0x1a, 0xf7, 0xa0, 0x9f, 0x09, 0xa1, 0xea, 0xf1, 0x5c } }; 1477 0xdb, 0x1a, 0xf7, 0xa0, 0x9f, 0x09, 0xa1, 0xea, 0xf1, 0x5c } };
1478 1478
1479 // This is the policy OID contained in the certificates that testserver 1479 // This is the policy OID contained in the certificates that testserver
1480 // generates. 1480 // generates.
1481 static const char kOCSPTestCertPolicy[] = "1.3.6.1.4.1.11129.2.4.1"; 1481 static const char kOCSPTestCertPolicy[] = "1.3.6.1.4.1.11129.2.4.1";
1482 1482
1483 class HTTPSOCSPTest : public HTTPSRequestTest { 1483 class HTTPSOCSPTest : public HTTPSRequestTest {
1484 public: 1484 public:
1485 HTTPSOCSPTest() 1485 HTTPSOCSPTest()
(...skipping 3113 matching lines...) Expand 10 before | Expand all | Expand 10 after
4599 req.SetExtraRequestHeaders(headers); 4599 req.SetExtraRequestHeaders(headers);
4600 req.Start(); 4600 req.Start();
4601 MessageLoop::current()->Run(); 4601 MessageLoop::current()->Run();
4602 // If the net tests are being run with ChromeFrame then we need to allow for 4602 // If the net tests are being run with ChromeFrame then we need to allow for
4603 // the 'chromeframe' suffix which is added to the user agent before the 4603 // the 'chromeframe' suffix which is added to the user agent before the
4604 // closing parentheses. 4604 // closing parentheses.
4605 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); 4605 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true));
4606 } 4606 }
4607 4607
4608 } // namespace net 4608 } // namespace net
OLDNEW
« net/socket/ssl_client_socket_nss.cc ('K') | « net/socket/ssl_client_socket_nss.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698