OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_SSL_CERTIFICATE_REPORTING_TEST_UTILS_H_ | 5 #ifndef CHROME_BROWSER_SSL_CERTIFICATE_REPORTING_TEST_UTILS_H_ |
6 #define CHROME_BROWSER_SSL_CERTIFICATE_REPORTING_TEST_UTILS_H_ | 6 #define CHROME_BROWSER_SSL_CERTIFICATE_REPORTING_TEST_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/net/certificate_error_reporter.h" | 10 #include "chrome/browser/net/certificate_error_reporter.h" |
(...skipping 20 matching lines...) Expand all Loading... | |
31 // A test class that tracks the latest hostname for which a certificate | 31 // A test class that tracks the latest hostname for which a certificate |
32 // report would have been sent over the network. | 32 // report would have been sent over the network. |
33 class CertificateReportingTest : public InProcessBrowserTest { | 33 class CertificateReportingTest : public InProcessBrowserTest { |
34 public: | 34 public: |
35 // Set up the mock reporter that keeps track of certificate reports | 35 // Set up the mock reporter that keeps track of certificate reports |
36 // that the safe browsing service sends. | 36 // that the safe browsing service sends. |
37 void SetUpMockReporter(); | 37 void SetUpMockReporter(); |
38 | 38 |
39 protected: | 39 protected: |
40 // Get the latest hostname for which a certificate report was sent. | 40 // Get the latest hostname for which a certificate report was sent. |
41 const std::string& GetLatestHostnameReported(); | 41 const std::string& GetLatestHostnameReported(); |
meacer
2015/07/21 06:04:31
const method
estark
2015/07/21 14:50:09
Done.
| |
42 | 42 |
43 private: | 43 private: |
44 MockReporter* reporter_; | 44 MockReporter* reporter_; |
45 }; | 45 }; |
46 | 46 |
47 // Sets the browser preference to enable or disable extended reporting. | 47 // Sets the browser preference to enable or disable extended reporting. |
48 void SetCertReportingOptIn(Browser* browser, OptIn opt_in); | 48 void SetCertReportingOptIn(Browser* browser, OptIn opt_in); |
49 | 49 |
50 // Sets up a mock SSLCertReporter and return a pointer to it, which will | 50 // Sets up a mock SSLCertReporter and return a pointer to it, which will |
51 // be owned by the caller. The mock SSLCertReporter will call | 51 // be owned by the caller. The mock SSLCertReporter will call |
52 // |run_loop|'s QuitClosure when a report is sent. It also checks that a | 52 // |run_loop|'s QuitClosure when a report is sent. It also checks that a |
53 // report is sent or not sent according to |expect_report|. | 53 // report is sent or not sent according to |expect_report|. |
54 scoped_ptr<SSLCertReporter> SetUpMockSSLCertReporter( | 54 scoped_ptr<SSLCertReporter> SetUpMockSSLCertReporter( |
55 base::RunLoop* run_loop, | 55 base::RunLoop* run_loop, |
56 ExpectReport expect_report); | 56 ExpectReport expect_report); |
57 | 57 |
58 // Forces a Finch config for the cert reporting experiment. | 58 // Returns whether a report should be expected (due to the Finch config) |
59 void SetCertReportingFinchConfig(const std::string& group_name, | 59 // if the user opts in. |
60 const std::string& param_value); | 60 ExpectReport GetReportExpectedFromFinch(); |
61 void SetCertReportingFinchConfig(const std::string& group_name); | |
62 | 61 |
63 } // namespace CertificateReportingTestUtils | 62 } // namespace CertificateReportingTestUtils |
64 | 63 |
65 #endif // CHROME_BROWSER_SSL_CERTIFICATE_REPORTING_TEST_UTILS_H_ | 64 #endif // CHROME_BROWSER_SSL_CERTIFICATE_REPORTING_TEST_UTILS_H_ |
OLD | NEW |