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_remover_delegate.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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 | 613 |
613 // Tests to make sure that if the user deletes their browser history, SSL | 614 // Tests to make sure that if the user deletes their browser history, SSL |
614 // exceptions will be deleted as well. | 615 // exceptions will be deleted as well. |
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(browsing_data::CalculateBeginDeleteTime( | 623 remover->RemoveAndReply( |
623 browsing_data::TimePeriod::LAST_HOUR), | 624 browsing_data::CalculateBeginDeleteTime( |
624 browsing_data::CalculateEndDeleteTime( | 625 browsing_data::TimePeriod::LAST_HOUR), |
625 browsing_data::TimePeriod::LAST_HOUR), | 626 browsing_data::CalculateEndDeleteTime( |
626 BrowsingDataRemover::REMOVE_HISTORY, | 627 browsing_data::TimePeriod::LAST_HOUR), |
627 BrowsingDataHelper::UNPROTECTED_WEB, | 628 ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY, |
628 &completion_observer); | 629 BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB, &completion_observer); |
629 completion_observer.BlockUntilCompletion(); | 630 completion_observer.BlockUntilCompletion(); |
630 } | 631 } |
631 }; | 632 }; |
632 | 633 |
633 IN_PROC_BROWSER_TEST_F(RemoveBrowsingHistorySSLHostStateDelegateTest, | 634 IN_PROC_BROWSER_TEST_F(RemoveBrowsingHistorySSLHostStateDelegateTest, |
634 DeleteHistory) { | 635 DeleteHistory) { |
635 scoped_refptr<net::X509Certificate> cert = GetOkCert(); | 636 scoped_refptr<net::X509Certificate> cert = GetOkCert(); |
636 content::WebContents* tab = | 637 content::WebContents* tab = |
637 browser()->tab_strip_model()->GetActiveWebContents(); | 638 browser()->tab_strip_model()->GetActiveWebContents(); |
638 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); | 639 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 EXPECT_EQ( | 700 EXPECT_EQ( |
700 content::SSLHostStateDelegate::ALLOWED, | 701 content::SSLHostStateDelegate::ALLOWED, |
701 state->QueryPolicy("localhost", *cert, | 702 state->QueryPolicy("localhost", *cert, |
702 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); | 703 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); |
703 | 704 |
704 EXPECT_EQ( | 705 EXPECT_EQ( |
705 content::SSLHostStateDelegate::ALLOWED, | 706 content::SSLHostStateDelegate::ALLOWED, |
706 state->QueryPolicy("127.0.0.1", *cert, | 707 state->QueryPolicy("127.0.0.1", *cert, |
707 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); | 708 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); |
708 } | 709 } |
OLD | NEW |