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" | 5 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/test/simple_test_clock.h" | 13 #include "base/test/simple_test_clock.h" |
14 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 14 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
15 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 15 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
16 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 16 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
17 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" | 17 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" |
| 18 #include "chrome/browser/browsing_data/chrome_browsing_data_types.h" |
18 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 19 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" | 21 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" |
21 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
22 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
23 #include "chrome/test/base/in_process_browser_test.h" | 24 #include "chrome/test/base/in_process_browser_test.h" |
24 #include "components/browsing_data/core/browsing_data_utils.h" | 25 #include "components/browsing_data/core/browsing_data_utils.h" |
25 #include "components/content_settings/core/browser/host_content_settings_map.h" | 26 #include "components/content_settings/core/browser/host_content_settings_map.h" |
26 #include "components/content_settings/core/common/content_settings_pattern.h" | 27 #include "components/content_settings/core/common/content_settings_pattern.h" |
27 #include "content/public/browser/ssl_host_state_delegate.h" | 28 #include "content/public/browser/ssl_host_state_delegate.h" |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 class RemoveBrowsingHistorySSLHostStateDelegateTest | 616 class RemoveBrowsingHistorySSLHostStateDelegateTest |
616 : public ChromeSSLHostStateDelegateTest { | 617 : public ChromeSSLHostStateDelegateTest { |
617 public: | 618 public: |
618 void RemoveAndWait(Profile* profile) { | 619 void RemoveAndWait(Profile* profile) { |
619 BrowsingDataRemover* remover = | 620 BrowsingDataRemover* remover = |
620 BrowsingDataRemoverFactory::GetForBrowserContext(profile); | 621 BrowsingDataRemoverFactory::GetForBrowserContext(profile); |
621 BrowsingDataRemoverCompletionObserver completion_observer(remover); | 622 BrowsingDataRemoverCompletionObserver completion_observer(remover); |
622 remover->RemoveAndReply( | 623 remover->RemoveAndReply( |
623 browsing_data::CalculateBeginDeleteTime(browsing_data::LAST_HOUR), | 624 browsing_data::CalculateBeginDeleteTime(browsing_data::LAST_HOUR), |
624 browsing_data::CalculateEndDeleteTime(browsing_data::LAST_HOUR), | 625 browsing_data::CalculateEndDeleteTime(browsing_data::LAST_HOUR), |
625 BrowsingDataRemover::REMOVE_HISTORY, | 626 {&kBrowsingDataTypeHistory}, BrowsingDataHelper::UNPROTECTED_WEB, |
626 BrowsingDataHelper::UNPROTECTED_WEB, &completion_observer); | 627 &completion_observer); |
627 completion_observer.BlockUntilCompletion(); | 628 completion_observer.BlockUntilCompletion(); |
628 } | 629 } |
629 }; | 630 }; |
630 | 631 |
631 IN_PROC_BROWSER_TEST_F(RemoveBrowsingHistorySSLHostStateDelegateTest, | 632 IN_PROC_BROWSER_TEST_F(RemoveBrowsingHistorySSLHostStateDelegateTest, |
632 DeleteHistory) { | 633 DeleteHistory) { |
633 scoped_refptr<net::X509Certificate> cert = GetOkCert(); | 634 scoped_refptr<net::X509Certificate> cert = GetOkCert(); |
634 content::WebContents* tab = | 635 content::WebContents* tab = |
635 browser()->tab_strip_model()->GetActiveWebContents(); | 636 browser()->tab_strip_model()->GetActiveWebContents(); |
636 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); | 637 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 EXPECT_EQ( | 698 EXPECT_EQ( |
698 content::SSLHostStateDelegate::ALLOWED, | 699 content::SSLHostStateDelegate::ALLOWED, |
699 state->QueryPolicy("localhost", *cert, | 700 state->QueryPolicy("localhost", *cert, |
700 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); | 701 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); |
701 | 702 |
702 EXPECT_EQ( | 703 EXPECT_EQ( |
703 content::SSLHostStateDelegate::ALLOWED, | 704 content::SSLHostStateDelegate::ALLOWED, |
704 state->QueryPolicy("127.0.0.1", *cert, | 705 state->QueryPolicy("127.0.0.1", *cert, |
705 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); | 706 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); |
706 } | 707 } |
OLD | NEW |