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

Side by Side Diff: chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc

Issue 2827523003: Move BrowsingDataRemover to content/ (Closed)
Patch Set: Rebase over codereview.chromium.org/2815913005 Created 3 years, 8 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
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
16 #include "chrome/browser/browsing_data/browsing_data_remover_factory.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" 16 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h"
19 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 17 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
20 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" 19 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h"
22 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/tabs/tab_strip_model.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model.h"
24 #include "chrome/test/base/in_process_browser_test.h" 22 #include "chrome/test/base/in_process_browser_test.h"
25 #include "components/browsing_data/core/browsing_data_utils.h" 23 #include "components/browsing_data/core/browsing_data_utils.h"
26 #include "components/content_settings/core/browser/host_content_settings_map.h" 24 #include "components/content_settings/core/browser/host_content_settings_map.h"
27 #include "components/content_settings/core/common/content_settings_pattern.h" 25 #include "components/content_settings/core/common/content_settings_pattern.h"
26 #include "content/public/browser/browsing_data_remover.h"
28 #include "content/public/browser/ssl_host_state_delegate.h" 27 #include "content/public/browser/ssl_host_state_delegate.h"
29 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
30 #include "content/public/common/content_switches.h" 29 #include "content/public/common/content_switches.h"
31 #include "content/public/test/browser_test_utils.h" 30 #include "content/public/test/browser_test_utils.h"
31 #include "content/public/test/browsing_data_remover_test_util.h"
32 #include "net/test/cert_test_util.h" 32 #include "net/test/cert_test_util.h"
33 #include "net/test/test_data_directory.h" 33 #include "net/test/test_data_directory.h"
34 #include "testing/gtest/include/gtest/gtest.h" 34 #include "testing/gtest/include/gtest/gtest.h"
35 35
36 namespace { 36 namespace {
37 37
38 const char kOkCertFile[] = "ok_cert.pem"; 38 const char kOkCertFile[] = "ok_cert.pem";
39 39
40 const char kWWWGoogleHost[] = "www.google.com"; 40 const char kWWWGoogleHost[] = "www.google.com";
41 const char kGoogleHost[] = "google.com"; 41 const char kGoogleHost[] = "google.com";
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 &expired_previous_decision)); 610 &expired_previous_decision));
611 EXPECT_FALSE(expired_previous_decision); 611 EXPECT_FALSE(expired_previous_decision);
612 } 612 }
613 613
614 // 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
615 // exceptions will be deleted as well. 615 // exceptions will be deleted as well.
616 class RemoveBrowsingHistorySSLHostStateDelegateTest 616 class RemoveBrowsingHistorySSLHostStateDelegateTest
617 : public ChromeSSLHostStateDelegateTest { 617 : public ChromeSSLHostStateDelegateTest {
618 public: 618 public:
619 void RemoveAndWait(Profile* profile) { 619 void RemoveAndWait(Profile* profile) {
620 BrowsingDataRemover* remover = 620 content::BrowsingDataRemover* remover =
621 BrowsingDataRemoverFactory::GetForBrowserContext(profile); 621 content::BrowserContext::GetBrowsingDataRemover(profile);
622 BrowsingDataRemoverCompletionObserver completion_observer(remover); 622 content::BrowsingDataRemoverCompletionObserver completion_observer(remover);
623 remover->RemoveAndReply( 623 remover->RemoveAndReply(
624 browsing_data::CalculateBeginDeleteTime( 624 browsing_data::CalculateBeginDeleteTime(
625 browsing_data::TimePeriod::LAST_HOUR), 625 browsing_data::TimePeriod::LAST_HOUR),
626 browsing_data::CalculateEndDeleteTime( 626 browsing_data::CalculateEndDeleteTime(
627 browsing_data::TimePeriod::LAST_HOUR), 627 browsing_data::TimePeriod::LAST_HOUR),
628 ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY, 628 ChromeBrowsingDataRemoverDelegate::DATA_TYPE_HISTORY,
629 BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB, &completion_observer); 629 content::BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB,
630 &completion_observer);
630 completion_observer.BlockUntilCompletion(); 631 completion_observer.BlockUntilCompletion();
631 } 632 }
632 }; 633 };
633 634
634 IN_PROC_BROWSER_TEST_F(RemoveBrowsingHistorySSLHostStateDelegateTest, 635 IN_PROC_BROWSER_TEST_F(RemoveBrowsingHistorySSLHostStateDelegateTest,
635 DeleteHistory) { 636 DeleteHistory) {
636 scoped_refptr<net::X509Certificate> cert = GetOkCert(); 637 scoped_refptr<net::X509Certificate> cert = GetOkCert();
637 content::WebContents* tab = 638 content::WebContents* tab =
638 browser()->tab_strip_model()->GetActiveWebContents(); 639 browser()->tab_strip_model()->GetActiveWebContents();
639 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); 640 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext());
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 EXPECT_EQ( 701 EXPECT_EQ(
701 content::SSLHostStateDelegate::ALLOWED, 702 content::SSLHostStateDelegate::ALLOWED,
702 state->QueryPolicy("localhost", *cert, 703 state->QueryPolicy("localhost", *cert,
703 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); 704 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value));
704 705
705 EXPECT_EQ( 706 EXPECT_EQ(
706 content::SSLHostStateDelegate::ALLOWED, 707 content::SSLHostStateDelegate::ALLOWED,
707 state->QueryPolicy("127.0.0.1", *cert, 708 state->QueryPolicy("127.0.0.1", *cert,
708 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value)); 709 net::CERT_STATUS_COMMON_NAME_INVALID, &unused_value));
709 } 710 }
OLDNEW
« no previous file with comments | « chrome/browser/push_messaging/push_messaging_browsertest.cc ('k') | chrome/browser/ui/browser_commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698