OLD | NEW |
---|---|
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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
651 // Exactly one value should be logged, indicating the SCT can be checked for | 651 // Exactly one value should be logged, indicating the SCT can be checked for |
652 // inclusion, as |tree_tracker_| did have a valid STH when it was notified | 652 // inclusion, as |tree_tracker_| did have a valid STH when it was notified |
653 // of a new SCT. | 653 // of a new SCT. |
654 histograms.ExpectTotalCount(kCanCheckForInclusionHistogramName, 1); | 654 histograms.ExpectTotalCount(kCanCheckForInclusionHistogramName, 1); |
655 histograms.ExpectBucketCount(kCanCheckForInclusionHistogramName, 2, 1); | 655 histograms.ExpectBucketCount(kCanCheckForInclusionHistogramName, 2, 1); |
656 // Failure due to DNS configuration should be logged in the result histogram. | 656 // Failure due to DNS configuration should be logged in the result histogram. |
657 histograms.ExpectTotalCount(kInclusionCheckResultHistogramName, 1); | 657 histograms.ExpectTotalCount(kInclusionCheckResultHistogramName, 1); |
658 histograms.ExpectBucketCount(kInclusionCheckResultHistogramName, 3, 1); | 658 histograms.ExpectBucketCount(kInclusionCheckResultHistogramName, 3, 1); |
659 } | 659 } |
660 | 660 |
661 // Test that entries are no longer pending after a network state | |
662 // change. | |
663 TEST_F(SingleTreeTrackerTest, DiscardsPendingEntriesAfterNetworkChange) { | |
664 CreateTreeTrackerWithDefaultDnsExpectation(); | |
665 | |
666 base::HistogramTester histograms; | |
667 tree_tracker_->OnSCTVerified(chain_.get(), cert_sct_.get()); | |
668 | |
669 EXPECT_EQ( | |
670 SingleTreeTracker::SCT_PENDING_NEWER_STH, | |
671 tree_tracker_->GetLogEntryInclusionStatus(chain_.get(), cert_sct_.get())); | |
672 | |
673 tree_tracker_->OnNetworkChanged( | |
674 net::NetworkChangeNotifier::CONNECTION_UNKNOWN); | |
Ryan Sleevi
2017/02/01 22:26:58
Why are you pumping this method directly, rather t
Eran Messeri
2017/02/02 14:54:40
Done.
| |
675 | |
676 EXPECT_EQ( | |
677 SingleTreeTracker::SCT_NOT_OBSERVED, | |
678 tree_tracker_->GetLogEntryInclusionStatus(chain_.get(), cert_sct_.get())); | |
679 } | |
680 | |
661 } // namespace certificate_transparency | 681 } // namespace certificate_transparency |
OLD | NEW |