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/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/test/simple_test_clock.h" | 12 #include "base/test/simple_test_clock.h" |
13 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 13 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
14 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 14 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
15 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 15 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
16 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" | 16 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" |
17 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 17 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" | 19 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" |
20 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/test/base/in_process_browser_test.h" | 23 #include "chrome/test/base/in_process_browser_test.h" |
| 24 #include "components/browsing_data/browsing_data_utils.h" |
24 #include "components/content_settings/core/browser/host_content_settings_map.h" | 25 #include "components/content_settings/core/browser/host_content_settings_map.h" |
25 #include "components/content_settings/core/common/content_settings_pattern.h" | 26 #include "components/content_settings/core/common/content_settings_pattern.h" |
26 #include "content/public/browser/ssl_host_state_delegate.h" | 27 #include "content/public/browser/ssl_host_state_delegate.h" |
27 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
28 #include "content/public/test/browser_test_utils.h" | 29 #include "content/public/test/browser_test_utils.h" |
29 #include "net/test/cert_test_util.h" | 30 #include "net/test/cert_test_util.h" |
30 #include "net/test/test_data_directory.h" | 31 #include "net/test/test_data_directory.h" |
31 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
32 | 33 |
33 namespace { | 34 namespace { |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 | 540 |
540 // Tests to make sure that if the user deletes their browser history, SSL | 541 // Tests to make sure that if the user deletes their browser history, SSL |
541 // exceptions will be deleted as well. | 542 // exceptions will be deleted as well. |
542 class RemoveBrowsingHistorySSLHostStateDelegateTest | 543 class RemoveBrowsingHistorySSLHostStateDelegateTest |
543 : public ChromeSSLHostStateDelegateTest { | 544 : public ChromeSSLHostStateDelegateTest { |
544 public: | 545 public: |
545 void RemoveAndWait(Profile* profile) { | 546 void RemoveAndWait(Profile* profile) { |
546 BrowsingDataRemover* remover = | 547 BrowsingDataRemover* remover = |
547 BrowsingDataRemoverFactory::GetForBrowserContext(profile); | 548 BrowsingDataRemoverFactory::GetForBrowserContext(profile); |
548 BrowsingDataRemoverCompletionObserver completion_observer(remover); | 549 BrowsingDataRemoverCompletionObserver completion_observer(remover); |
549 remover->Remove(BrowsingDataRemover::Period(BrowsingDataRemover::LAST_HOUR), | 550 remover->Remove(BrowsingDataRemover::Period(browsing_data::LAST_HOUR), |
550 BrowsingDataRemover::REMOVE_HISTORY, | 551 BrowsingDataRemover::REMOVE_HISTORY, |
551 BrowsingDataHelper::UNPROTECTED_WEB); | 552 BrowsingDataHelper::UNPROTECTED_WEB); |
552 completion_observer.BlockUntilCompletion(); | 553 completion_observer.BlockUntilCompletion(); |
553 } | 554 } |
554 }; | 555 }; |
555 | 556 |
556 IN_PROC_BROWSER_TEST_F(RemoveBrowsingHistorySSLHostStateDelegateTest, | 557 IN_PROC_BROWSER_TEST_F(RemoveBrowsingHistorySSLHostStateDelegateTest, |
557 DeleteHistory) { | 558 DeleteHistory) { |
558 scoped_refptr<net::X509Certificate> cert = GetOkCert(); | 559 scoped_refptr<net::X509Certificate> cert = GetOkCert(); |
559 content::WebContents* tab = | 560 content::WebContents* tab = |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 EXPECT_EQ( | 623 EXPECT_EQ( |
623 content::SSLHostStateDelegate::ALLOWED, | 624 content::SSLHostStateDelegate::ALLOWED, |
624 state->QueryPolicy("localhost", *cert, | 625 state->QueryPolicy("localhost", *cert, |
625 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); | 626 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); |
626 | 627 |
627 EXPECT_EQ( | 628 EXPECT_EQ( |
628 content::SSLHostStateDelegate::ALLOWED, | 629 content::SSLHostStateDelegate::ALLOWED, |
629 state->QueryPolicy("127.0.0.1", *cert, | 630 state->QueryPolicy("127.0.0.1", *cert, |
630 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); | 631 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); |
631 } | 632 } |
OLD | NEW |