OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ssl/chrome_ssl_host_state_delegate.h" |
| 6 |
5 #include <stdint.h> | 7 #include <stdint.h> |
6 | 8 |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
9 #include "base/test/simple_test_clock.h" | 11 #include "base/test/simple_test_clock.h" |
10 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 12 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
11 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 13 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
12 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" | 14 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" |
13 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" | |
15 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" | 16 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" |
16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
18 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
20 #include "content/public/browser/ssl_host_state_delegate.h" | 21 #include "content/public/browser/ssl_host_state_delegate.h" |
21 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
22 #include "content/public/test/browser_test_utils.h" | 23 #include "content/public/test/browser_test_utils.h" |
23 #include "net/base/test_data_directory.h" | 24 #include "net/base/test_data_directory.h" |
24 #include "net/test/cert_test_util.h" | 25 #include "net/test/cert_test_util.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
26 | 27 |
27 namespace { | 28 namespace { |
28 | 29 |
29 const char kGoogleCertFile[] = "google.single.der"; | 30 const char kGoogleCertFile[] = "google.single.der"; |
30 | 31 |
31 const char kWWWGoogleHost[] = "www.google.com"; | 32 const char kWWWGoogleHost[] = "www.google.com"; |
32 const char kGoogleHost[] = "google.com"; | 33 const char kGoogleHost[] = "google.com"; |
33 const char kExampleHost[] = "example.com"; | 34 const char kExampleHost[] = "example.com"; |
34 | 35 |
35 const char* kForgetAtSessionEnd = "-1"; | 36 const char kForgetAtSessionEnd[] = "-1"; |
36 const char* kForgetInstantly = "0"; | 37 const char kForgetInstantly[] = "0"; |
37 const char* kDeltaSecondsString = "86400"; | 38 const char kDeltaSecondsString[] = "86400"; |
38 const uint64_t kDeltaOneDayInSeconds = UINT64_C(86400); | 39 const uint64_t kDeltaOneDayInSeconds = UINT64_C(86400); |
39 | 40 |
40 scoped_refptr<net::X509Certificate> GetGoogleCert() { | 41 scoped_refptr<net::X509Certificate> GetGoogleCert() { |
41 return net::ImportCertFromFile(net::GetTestCertsDirectory(), kGoogleCertFile); | 42 return net::ImportCertFromFile(net::GetTestCertsDirectory(), kGoogleCertFile); |
42 } | 43 } |
43 | 44 |
44 } // namespace | 45 } // namespace |
45 | 46 |
46 class ChromeSSLHostStateDelegateTest : public InProcessBrowserTest {}; | 47 class ChromeSSLHostStateDelegateTest : public InProcessBrowserTest {}; |
47 | 48 |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 // worth of browsing history and verify that the exception has been deleted. | 576 // worth of browsing history and verify that the exception has been deleted. |
576 state->AllowCert( | 577 state->AllowCert( |
577 kGoogleHost, google_cert.get(), net::CERT_STATUS_DATE_INVALID); | 578 kGoogleHost, google_cert.get(), net::CERT_STATUS_DATE_INVALID); |
578 RemoveAndWait(profile); | 579 RemoveAndWait(profile); |
579 EXPECT_EQ(net::CertPolicy::UNKNOWN, | 580 EXPECT_EQ(net::CertPolicy::UNKNOWN, |
580 state->QueryPolicy(kGoogleHost, | 581 state->QueryPolicy(kGoogleHost, |
581 google_cert.get(), | 582 google_cert.get(), |
582 net::CERT_STATUS_DATE_INVALID, | 583 net::CERT_STATUS_DATE_INVALID, |
583 &unused_value)); | 584 &unused_value)); |
584 } | 585 } |
OLD | NEW |