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

Side by Side Diff: chrome/test/base/cert_verifier_browser_test.h

Issue 1227943002: Allow browser tests to use a MockCertVerifier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move factory-setter to ProfileIOData to work with ChromeOS Created 5 years, 4 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_TEST_BASE_CERT_VERIFIER_BROWSER_TEST_H_
6 #define CHROME_TEST_BASE_CERT_VERIFIER_BROWSER_TEST_H_
7
8 #include "chrome/test/base/in_process_browser_test.h"
9 #include "net/cert/cert_verifier.h"
10
11 namespace net {
12 class MockCertVerifier;
13 } // namespace net
14
15 // CertVerifierBrowserTest allows tests to force certificate
16 // verification results for requests made with the profile's main
17 // request context (such as navigations). To do so, tests can use the
18 // MockCertVerifier exposed via
19 // CertVerifierBrowserTest::mock_cert_verifier().
20 class CertVerifierBrowserTest : public InProcessBrowserTest {
21 public:
22 CertVerifierBrowserTest();
23 ~CertVerifierBrowserTest() override;
24
25 // Sets up the mock cert verifier so that tests can set certificate
26 // verification results.
27 void SetUpInProcessBrowserTestFixture() override;
28
29 net::MockCertVerifier* mock_cert_verifier();
30
31 private:
32 // A mock CertVerifierFactory that has a single MockCertVerifier and
33 // always returns that when asked to create new CertVerifiers.
34 class MockCertVerifierFactory : public net::CertVerifierFactory {
35 public:
36 MockCertVerifierFactory();
37 ~MockCertVerifierFactory() override;
38
39 // net::CertVerifierFactory overrides
40 net::CertVerifier* CreateCertVerifier() override;
41
42 net::MockCertVerifier* mock_cert_verifier();
43
44 private:
45 // Ownership of this will be passed to the caller of CreateCertVerifier().
46 net::MockCertVerifier* mock_cert_verifier_;
47 };
48
49 MockCertVerifierFactory mock_cert_verifier_factory_;
50 };
51
52 #endif // CHROME_TEST_BASE_CERT_VERIFIER_BROWSER_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698