| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/browser/browsing_data/clear_site_data_throttle.h" | 5 #include "content/browser/browsing_data/clear_site_data_throttle.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 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/scoped_observer.h" | 12 #include "base/scoped_observer.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "components/network_session_configurator/common/network_switches.h" | 15 #include "components/network_session_configurator/common/network_switches.h" |
| 16 #include "content/browser/browsing_data/browsing_data_filter_builder_impl.h" | 16 #include "content/browser/browsing_data/browsing_data_filter_builder_impl.h" |
| 17 #include "content/browser/service_worker/service_worker_context_core_observer.h" | 17 #include "content/browser/service_worker/service_worker_context_core_observer.h" |
| 18 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 18 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 19 #include "content/public/browser/browser_context.h" | 19 #include "content/public/browser/browser_context.h" |
| 20 #include "content/public/browser/browsing_data_remover.h" | 20 #include "content/public/browser/browsing_data_remover.h" |
| 21 #include "content/public/browser/content_browser_client.h" | 21 #include "content/public/browser/content_browser_client.h" |
| 22 #include "content/public/browser/storage_partition.h" | 22 #include "content/public/browser/storage_partition.h" |
| 23 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 24 #include "content/public/common/content_switches.h" | |
| 25 #include "content/public/test/browser_test_utils.h" | 24 #include "content/public/test/browser_test_utils.h" |
| 26 #include "content/public/test/cache_test_util.h" | 25 #include "content/public/test/cache_test_util.h" |
| 27 #include "content/public/test/content_browser_test.h" | 26 #include "content/public/test/content_browser_test.h" |
| 28 #include "content/public/test/content_browser_test_utils.h" | 27 #include "content/public/test/content_browser_test_utils.h" |
| 29 #include "content/public/test/mock_browsing_data_remover_delegate.h" | 28 #include "content/public/test/mock_browsing_data_remover_delegate.h" |
| 30 #include "content/public/test/test_navigation_observer.h" | 29 #include "content/public/test/test_navigation_observer.h" |
| 31 #include "content/shell/browser/shell.h" | 30 #include "content/shell/browser/shell.h" |
| 32 #include "net/base/escape.h" | 31 #include "net/base/escape.h" |
| 33 #include "net/base/url_util.h" | 32 #include "net/base/url_util.h" |
| 34 #include "net/cookies/cookie_store.h" | 33 #include "net/cookies/cookie_store.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 scoped_observer_; | 145 scoped_observer_; |
| 147 base::Closure callback_; | 146 base::Closure callback_; |
| 148 }; | 147 }; |
| 149 | 148 |
| 150 } // namespace | 149 } // namespace |
| 151 | 150 |
| 152 class ClearSiteDataThrottleBrowserTest : public ContentBrowserTest { | 151 class ClearSiteDataThrottleBrowserTest : public ContentBrowserTest { |
| 153 public: | 152 public: |
| 154 void SetUpCommandLine(base::CommandLine* command_line) override { | 153 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 155 ContentBrowserTest::SetUpCommandLine(command_line); | 154 ContentBrowserTest::SetUpCommandLine(command_line); |
| 156 command_line->AppendSwitch( | |
| 157 switches::kEnableExperimentalWebPlatformFeatures); | |
| 158 | 155 |
| 159 // We're redirecting all hosts to localhost even on HTTPS, so we'll get | 156 // We're redirecting all hosts to localhost even on HTTPS, so we'll get |
| 160 // certificate errors. | 157 // certificate errors. |
| 161 command_line->AppendSwitch(switches::kIgnoreCertificateErrors); | 158 command_line->AppendSwitch(switches::kIgnoreCertificateErrors); |
| 162 } | 159 } |
| 163 | 160 |
| 164 void SetUpOnMainThread() override { | 161 void SetUpOnMainThread() override { |
| 165 ContentBrowserTest::SetUpOnMainThread(); | 162 ContentBrowserTest::SetUpOnMainThread(); |
| 166 | 163 |
| 167 BrowserContext::GetBrowsingDataRemover(browser_context()) | 164 BrowserContext::GetBrowsingDataRemover(browser_context()) |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 // Tests that closing the tab right after executing Clear-Site-Data does | 857 // Tests that closing the tab right after executing Clear-Site-Data does |
| 861 // not crash. | 858 // not crash. |
| 862 IN_PROC_BROWSER_TEST_F(ClearSiteDataThrottleBrowserTest, ClosedTab) { | 859 IN_PROC_BROWSER_TEST_F(ClearSiteDataThrottleBrowserTest, ClosedTab) { |
| 863 GURL url = https_server()->GetURL("example.com", "/"); | 860 GURL url = https_server()->GetURL("example.com", "/"); |
| 864 AddQuery(&url, "header", kClearCookiesHeader); | 861 AddQuery(&url, "header", kClearCookiesHeader); |
| 865 shell()->LoadURL(url); | 862 shell()->LoadURL(url); |
| 866 shell()->Close(); | 863 shell()->Close(); |
| 867 } | 864 } |
| 868 | 865 |
| 869 } // namespace content | 866 } // namespace content |
| OLD | NEW |