| 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.h" | 5 #include "chrome/browser/safe_browsing/certificate_reporting_service.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/test/histogram_tester.h" | 10 #include "base/test/histogram_tester.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 test_helper()->SetUpInterceptor(); | 81 test_helper()->SetUpInterceptor(); |
| 82 | 82 |
| 83 CertificateReportingServiceFactory::GetInstance() | 83 CertificateReportingServiceFactory::GetInstance() |
| 84 ->SetReportEncryptionParamsForTesting( | 84 ->SetReportEncryptionParamsForTesting( |
| 85 test_helper()->server_public_key(), | 85 test_helper()->server_public_key(), |
| 86 test_helper()->server_public_key_version()); | 86 test_helper()->server_public_key_version()); |
| 87 CertificateReportingServiceFactory::GetInstance() | 87 CertificateReportingServiceFactory::GetInstance() |
| 88 ->SetServiceResetCallbackForTesting( | 88 ->SetServiceResetCallbackForTesting( |
| 89 base::Bind(&CertificateReportingServiceObserver::OnServiceReset, | 89 base::Bind(&CertificateReportingServiceObserver::OnServiceReset, |
| 90 base::Unretained(&service_observer_))); | 90 base::Unretained(&service_observer_))); |
| 91 InProcessBrowserTest::SetUpOnMainThread(); | |
| 92 } | 91 } |
| 93 | 92 |
| 94 void TearDownOnMainThread() override { | 93 void TearDownOnMainThread() override { |
| 95 test_helper()->ExpectNoRequests(service()); | 94 test_helper()->ExpectNoRequests(service()); |
| 96 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, | 95 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, |
| 97 base::BindOnce(&CleanUpOnIOThread)); | 96 base::BindOnce(&CleanUpOnIOThread)); |
| 98 EXPECT_GE(num_expected_failed_report_, 0) | 97 EXPECT_GE(num_expected_failed_report_, 0) |
| 99 << "Don't forget to set expected failed report count."; | 98 << "Don't forget to set expected failed report count."; |
| 100 // Check the histogram as the last thing. This makes sure no in-flight | 99 // Check the histogram as the last thing. This makes sure no in-flight |
| 101 // report is missed. | 100 // report is missed. |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 test_helper()->WaitForRequestsCreated( | 615 test_helper()->WaitForRequestsCreated( |
| 617 ReportExpectation::Delayed({{"report1", RetryStatus::NOT_RETRIED}})); | 616 ReportExpectation::Delayed({{"report1", RetryStatus::NOT_RETRIED}})); |
| 618 | 617 |
| 619 // Resume the delayed report and wait for it to complete. | 618 // Resume the delayed report and wait for it to complete. |
| 620 test_helper()->ResumeDelayedRequest(); | 619 test_helper()->ResumeDelayedRequest(); |
| 621 test_helper()->WaitForRequestsDestroyed( | 620 test_helper()->WaitForRequestsDestroyed( |
| 622 ReportExpectation::Delayed({{"report1", RetryStatus::NOT_RETRIED}})); | 621 ReportExpectation::Delayed({{"report1", RetryStatus::NOT_RETRIED}})); |
| 623 } | 622 } |
| 624 | 623 |
| 625 } // namespace safe_browsing | 624 } // namespace safe_browsing |
| OLD | NEW |