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

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

Issue 10826257: Implement SHA-256 fingerprint support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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
« no previous file with comments | « net/socket/ssl_client_socket_nss.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 FingerprintVector& a, const FingerprintVector& b) { 150 bool FingerprintsEqual(const HashValueVector& a, const HashValueVector& 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 ASSERT_EQ(1, d->response_started_count()) << "request failed: " << 546 ASSERT_EQ(1, d->response_started_count()) << "request failed: " <<
547 (int) r->status().status() << ", os error: " << r->status().error(); 547 (int) r->status().status() << ", os error: " << r->status().error();
548 548
549 EXPECT_FALSE(d->received_data_before_response()); 549 EXPECT_FALSE(d->received_data_before_response());
550 550
551 ASSERT_EQ(strlen(expected_data), static_cast<size_t>(d->bytes_received())); 551 ASSERT_EQ(strlen(expected_data), static_cast<size_t>(d->bytes_received()));
552 EXPECT_EQ(0, memcmp(d->data_received().c_str(), expected_data, 552 EXPECT_EQ(0, memcmp(d->data_received().c_str(), expected_data,
553 strlen(expected_data))); 553 strlen(expected_data)));
554 } 554 }
555 555
556 bool DoManyCookiesRequest(int num_cookies){ 556 bool DoManyCookiesRequest(int num_cookies) {
557 TestDelegate d; 557 TestDelegate d;
558 URLRequest r(test_server_.GetURL("set-many-cookies?" + 558 URLRequest r(test_server_.GetURL("set-many-cookies?" +
559 base::IntToString(num_cookies)), 559 base::IntToString(num_cookies)),
560 &d, 560 &d,
561 &default_context_); 561 &default_context_);
562 562
563 r.Start(); 563 r.Start();
564 EXPECT_TRUE(r.is_pending()); 564 EXPECT_TRUE(r.is_pending());
565 565
566 MessageLoop::current()->Run(); 566 MessageLoop::current()->Run();
567 567
568 bool is_success = r.status().is_success(); 568 bool is_success = r.status().is_success();
569 569
570 if (!is_success){ 570 if (!is_success) {
571 // Requests handled by ChromeFrame send a less precise error message, 571 // Requests handled by ChromeFrame send a less precise error message,
572 // ERR_CONNECTION_ABORTED. 572 // ERR_CONNECTION_ABORTED.
573 EXPECT_TRUE(r.status().error() == ERR_RESPONSE_HEADERS_TOO_BIG || 573 EXPECT_TRUE(r.status().error() == ERR_RESPONSE_HEADERS_TOO_BIG ||
574 r.status().error() == ERR_CONNECTION_ABORTED); 574 r.status().error() == ERR_CONNECTION_ABORTED);
575 // The test server appears to be unable to handle subsequent requests 575 // The test server appears to be unable to handle subsequent requests
576 // after this error is triggered. Force it to restart. 576 // after this error is triggered. Force it to restart.
577 EXPECT_TRUE(test_server_.Stop()); 577 EXPECT_TRUE(test_server_.Stop());
578 EXPECT_TRUE(test_server_.Start()); 578 EXPECT_TRUE(test_server_.Start());
579 } 579 }
580 580
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 protected: 1471 protected:
1472 virtual ~TestSSLConfigService() {} 1472 virtual ~TestSSLConfigService() {}
1473 1473
1474 private: 1474 private:
1475 const bool ev_enabled_; 1475 const bool ev_enabled_;
1476 const bool online_rev_checking_; 1476 const bool online_rev_checking_;
1477 }; 1477 };
1478 1478
1479 // This the fingerprint of the "Testing CA" certificate used by the testserver. 1479 // This the fingerprint of the "Testing CA" certificate used by the testserver.
1480 // See net/data/ssl/certificates/ocsp-test-root.pem. 1480 // See net/data/ssl/certificates/ocsp-test-root.pem.
1481 static const SHA1Fingerprint kOCSPTestCertFingerprint = 1481 static const SHA1HashValue kOCSPTestCertFingerprint =
1482 { { 0xf1, 0xad, 0xf6, 0xce, 0x42, 0xac, 0xe7, 0xb4, 0xf4, 0x24, 1482 { { 0xf1, 0xad, 0xf6, 0xce, 0x42, 0xac, 0xe7, 0xb4, 0xf4, 0x24,
1483 0xdb, 0x1a, 0xf7, 0xa0, 0x9f, 0x09, 0xa1, 0xea, 0xf1, 0x5c } }; 1483 0xdb, 0x1a, 0xf7, 0xa0, 0x9f, 0x09, 0xa1, 0xea, 0xf1, 0x5c } };
1484 1484
1485 // This is the policy OID contained in the certificates that testserver 1485 // This is the policy OID contained in the certificates that testserver
1486 // generates. 1486 // generates.
1487 static const char kOCSPTestCertPolicy[] = "1.3.6.1.4.1.11129.2.4.1"; 1487 static const char kOCSPTestCertPolicy[] = "1.3.6.1.4.1.11129.2.4.1";
1488 1488
1489 class HTTPSOCSPTest : public HTTPSRequestTest { 1489 class HTTPSOCSPTest : public HTTPSRequestTest {
1490 public: 1490 public:
1491 HTTPSOCSPTest() 1491 HTTPSOCSPTest()
(...skipping 3189 matching lines...) Expand 10 before | Expand all | Expand 10 after
4681 req.SetExtraRequestHeaders(headers); 4681 req.SetExtraRequestHeaders(headers);
4682 req.Start(); 4682 req.Start();
4683 MessageLoop::current()->Run(); 4683 MessageLoop::current()->Run();
4684 // If the net tests are being run with ChromeFrame then we need to allow for 4684 // If the net tests are being run with ChromeFrame then we need to allow for
4685 // the 'chromeframe' suffix which is added to the user agent before the 4685 // the 'chromeframe' suffix which is added to the user agent before the
4686 // closing parentheses. 4686 // closing parentheses.
4687 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); 4687 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true));
4688 } 4688 }
4689 4689
4690 } // namespace net 4690 } // namespace net
OLDNEW
« no previous file with comments | « 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