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 "chrome/browser/safe_browsing/certificate_reporting_service_test_utils.
h" | 5 #include "chrome/browser/safe_browsing/certificate_reporting_service_test_utils.
h" |
6 | 6 |
7 #include "base/threading/thread_task_runner_handle.h" | 7 #include "base/threading/thread_task_runner_handle.h" |
8 #include "components/certificate_reporting/encrypted_cert_logger.pb.h" | 8 #include "components/certificate_reporting/encrypted_cert_logger.pb.h" |
9 #include "components/certificate_reporting/error_report.h" | 9 #include "components/certificate_reporting/error_report.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 interceptor()->request_destroyed_observer()->delayed_reports().empty()); | 436 interceptor()->request_destroyed_observer()->delayed_reports().empty()); |
437 | 437 |
438 if (service->GetReporterForTesting()) { | 438 if (service->GetReporterForTesting()) { |
439 // Reporter can be null if reporting is disabled. | 439 // Reporter can be null if reporting is disabled. |
440 EXPECT_EQ( | 440 EXPECT_EQ( |
441 0u, | 441 0u, |
442 service->GetReporterForTesting()->inflight_report_count_for_testing()); | 442 service->GetReporterForTesting()->inflight_report_count_for_testing()); |
443 } | 443 } |
444 } | 444 } |
445 | 445 |
446 EventHistogramTester::EventHistogramTester() {} | |
447 | |
448 EventHistogramTester::~EventHistogramTester() { | |
449 if (submitted_) { | |
450 histogram_tester_.ExpectBucketCount( | |
451 CertificateReportingService::kReportEventHistogram, | |
452 CertificateReportingService::REPORT_SUBMITTED, submitted_); | |
453 } | |
454 if (failed_) { | |
455 histogram_tester_.ExpectBucketCount( | |
456 CertificateReportingService::kReportEventHistogram, | |
457 CertificateReportingService::REPORT_FAILED, failed_); | |
458 } | |
459 if (successful_) { | |
460 histogram_tester_.ExpectBucketCount( | |
461 CertificateReportingService::kReportEventHistogram, | |
462 CertificateReportingService::REPORT_SUCCESSFUL, successful_); | |
463 } | |
464 if (dropped_) { | |
465 histogram_tester_.ExpectBucketCount( | |
466 CertificateReportingService::kReportEventHistogram, | |
467 CertificateReportingService::REPORT_DROPPED_OR_IGNORED, dropped_); | |
468 } | |
469 histogram_tester_.ExpectTotalCount( | |
470 CertificateReportingService::kReportEventHistogram, | |
471 submitted_ + failed_ + successful_ + dropped_); | |
472 } | |
473 | |
474 void EventHistogramTester::SetExpectedValues(int submitted, | |
475 int failed, | |
476 int successful, | |
477 int dropped) { | |
478 submitted_ = submitted; | |
479 failed_ = failed; | |
480 successful_ = successful; | |
481 dropped_ = dropped; | |
482 } | |
483 | |
484 } // namespace certificate_reporting_test_utils | 446 } // namespace certificate_reporting_test_utils |
OLD | NEW |