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

Side by Side Diff: net/http/transport_security_state_unittest.cc

Issue 2906483003: Experiment with a compact mode for simple preloaded entries. (Closed)
Patch Set: Initialize all struct members. Created 3 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
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 "net/http/transport_security_state.h" 5 #include "net/http/transport_security_state.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 2420 matching lines...) Expand 10 before | Expand all | Expand 10 after
2431 EXPECT_EQ(1U, pkp_state.spki_hashes.size()); 2431 EXPECT_EQ(1U, pkp_state.spki_hashes.size());
2432 EXPECT_EQ(pkp_state.spki_hashes[0], GetSampleSPKIHash(0x2)); 2432 EXPECT_EQ(pkp_state.spki_hashes[0], GetSampleSPKIHash(0x2));
2433 EXPECT_EQ(1U, pkp_state.bad_spki_hashes.size()); 2433 EXPECT_EQ(1U, pkp_state.bad_spki_hashes.size());
2434 EXPECT_EQ(pkp_state.bad_spki_hashes[0], GetSampleSPKIHash(0x1)); 2434 EXPECT_EQ(pkp_state.bad_spki_hashes[0], GetSampleSPKIHash(0x1));
2435 EXPECT_TRUE(GetExpectCTState(&state, "mix.badssl.com", &ct_state)); 2435 EXPECT_TRUE(GetExpectCTState(&state, "mix.badssl.com", &ct_state));
2436 EXPECT_EQ(GURL("https://report.example.com/ct-upload"), ct_state.report_uri); 2436 EXPECT_EQ(GURL("https://report.example.com/ct-upload"), ct_state.report_uri);
2437 EXPECT_TRUE(GetExpectStapleState(&state, "mix.badssl.com", &staple_state)); 2437 EXPECT_TRUE(GetExpectStapleState(&state, "mix.badssl.com", &staple_state));
2438 EXPECT_TRUE(staple_state.include_subdomains); 2438 EXPECT_TRUE(staple_state.include_subdomains);
2439 EXPECT_EQ(GURL("https://report.badssl.com/staple-upload"), 2439 EXPECT_EQ(GURL("https://report.badssl.com/staple-upload"),
2440 staple_state.report_uri); 2440 staple_state.report_uri);
2441
2442 sts_state = TransportSecurityState::STSState();
2443 pkp_state = TransportSecurityState::PKPState();
2444 ct_state = TransportSecurityState::ExpectCTState();
2445 staple_state = TransportSecurityState::ExpectStapleState();
2446
2447 // This should be a simple entry in the context of
2448 // TrieWriter::IsSimpleEntry().
2449 EXPECT_TRUE(GetStaticDomainState(&state, "simple-entry.example.com",
2450 &sts_state, &pkp_state));
2451 EXPECT_TRUE(sts_state.include_subdomains);
2452 EXPECT_EQ(TransportSecurityState::STSState::MODE_FORCE_HTTPS,
2453 sts_state.upgrade_mode);
2454 EXPECT_FALSE(pkp_state.include_subdomains);
2455 EXPECT_FALSE(GetExpectCTState(&state, "simple-entry.example.com", &ct_state));
2456 EXPECT_FALSE(
2457 GetExpectStapleState(&state, "simple-entry.example.com", &staple_state));
2441 } 2458 }
2442 2459
2443 static const struct ExpectStapleErrorResponseData { 2460 static const struct ExpectStapleErrorResponseData {
2444 OCSPVerifyResult::ResponseStatus response_status; 2461 OCSPVerifyResult::ResponseStatus response_status;
2445 std::string response_status_string; 2462 std::string response_status_string;
2446 } kExpectStapleReportData[] = { 2463 } kExpectStapleReportData[] = {
2447 {OCSPVerifyResult::MISSING, "MISSING"}, 2464 {OCSPVerifyResult::MISSING, "MISSING"},
2448 {OCSPVerifyResult::ERROR_RESPONSE, "ERROR_RESPONSE"}, 2465 {OCSPVerifyResult::ERROR_RESPONSE, "ERROR_RESPONSE"},
2449 {OCSPVerifyResult::BAD_PRODUCED_AT, "BAD_PRODUCED_AT"}, 2466 {OCSPVerifyResult::BAD_PRODUCED_AT, "BAD_PRODUCED_AT"},
2450 {OCSPVerifyResult::NO_MATCHING_RESPONSE, "NO_MATCHING_RESPONSE"}, 2467 {OCSPVerifyResult::NO_MATCHING_RESPONSE, "NO_MATCHING_RESPONSE"},
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
3372 EXPECT_EQ(expiry, reporter.expiration()); 3389 EXPECT_EQ(expiry, reporter.expiration());
3373 EXPECT_EQ(cert1.get(), reporter.validated_certificate_chain()); 3390 EXPECT_EQ(cert1.get(), reporter.validated_certificate_chain());
3374 EXPECT_EQ(cert2.get(), reporter.served_certificate_chain()); 3391 EXPECT_EQ(cert2.get(), reporter.served_certificate_chain());
3375 EXPECT_EQ(sct_list.size(), reporter.signed_certificate_timestamps().size()); 3392 EXPECT_EQ(sct_list.size(), reporter.signed_certificate_timestamps().size());
3376 EXPECT_EQ(sct_list[0].status, 3393 EXPECT_EQ(sct_list[0].status,
3377 reporter.signed_certificate_timestamps()[0].status); 3394 reporter.signed_certificate_timestamps()[0].status);
3378 EXPECT_EQ(sct_list[0].sct, reporter.signed_certificate_timestamps()[0].sct); 3395 EXPECT_EQ(sct_list[0].sct, reporter.signed_certificate_timestamps()[0].sct);
3379 } 3396 }
3380 3397
3381 } // namespace net 3398 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698