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

Side by Side Diff: components/certificate_transparency/single_tree_tracker_unittest.cc

Issue 2668803004: Certificate Transparency: Discard entries pending auditing on network change (Closed)
Patch Set: Merging with master Created 3 years, 10 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
« no previous file with comments | « components/certificate_transparency/single_tree_tracker.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/certificate_transparency/single_tree_tracker.h" 5 #include "components/certificate_transparency/single_tree_tracker.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 // Exactly one value should be logged, indicating the SCT can be checked for 713 // Exactly one value should be logged, indicating the SCT can be checked for
714 // inclusion, as |tree_tracker_| did have a valid STH when it was notified 714 // inclusion, as |tree_tracker_| did have a valid STH when it was notified
715 // of a new SCT. 715 // of a new SCT.
716 histograms.ExpectTotalCount(kCanCheckForInclusionHistogramName, 1); 716 histograms.ExpectTotalCount(kCanCheckForInclusionHistogramName, 1);
717 histograms.ExpectBucketCount(kCanCheckForInclusionHistogramName, 2, 1); 717 histograms.ExpectBucketCount(kCanCheckForInclusionHistogramName, 2, 1);
718 // Failure due to DNS configuration should be logged in the result histogram. 718 // Failure due to DNS configuration should be logged in the result histogram.
719 histograms.ExpectTotalCount(kInclusionCheckResultHistogramName, 1); 719 histograms.ExpectTotalCount(kInclusionCheckResultHistogramName, 1);
720 histograms.ExpectBucketCount(kInclusionCheckResultHistogramName, 3, 1); 720 histograms.ExpectBucketCount(kInclusionCheckResultHistogramName, 3, 1);
721 } 721 }
722 722
723 // Test that entries are no longer pending after a network state
724 // change.
725 TEST_F(SingleTreeTrackerTest, DiscardsPendingEntriesAfterNetworkChange) {
726 CreateTreeTrackerWithDefaultDnsExpectation();
727
728 base::HistogramTester histograms;
729 tree_tracker_->OnSCTVerified(chain_.get(), cert_sct_.get());
730
731 EXPECT_EQ(
732 SingleTreeTracker::SCT_PENDING_NEWER_STH,
733 tree_tracker_->GetLogEntryInclusionStatus(chain_.get(), cert_sct_.get()));
734
735 net_change_notifier_->NotifyObserversOfNetworkChangeForTests(
736 net::NetworkChangeNotifier::CONNECTION_UNKNOWN);
737 base::RunLoop().RunUntilIdle();
738
739 EXPECT_EQ(
740 SingleTreeTracker::SCT_NOT_OBSERVED,
741 tree_tracker_->GetLogEntryInclusionStatus(chain_.get(), cert_sct_.get()));
742 }
743
723 } // namespace certificate_transparency 744 } // namespace certificate_transparency
OLDNEW
« no previous file with comments | « components/certificate_transparency/single_tree_tracker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698