| 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 "content/public/browser/content_browser_client.h" | 12 #include "content/public/browser/content_browser_client.h" |
| 13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
| 15 #include "content/public/test/content_browser_test.h" | 15 #include "content/public/test/content_browser_test.h" |
| 16 #include "content/public/test/content_browser_test_utils.h" | 16 #include "content/public/test/content_browser_test_utils.h" |
| 17 #include "content/public/test/test_navigation_observer.h" | 17 #include "content/public/test/test_navigation_observer.h" |
| 18 #include "content/shell/browser/shell.h" | 18 #include "content/shell/browser/shell.h" |
| 19 #include "net/base/escape.h" | 19 #include "net/base/escape.h" |
| 20 #include "net/base/url_util.h" | 20 #include "net/base/url_util.h" |
| 21 #include "net/dns/mock_host_resolver.h" | 21 #include "net/dns/mock_host_resolver.h" |
| 22 #include "net/test/embedded_test_server/http_request.h" | 22 #include "net/test/embedded_test_server/http_request.h" |
| 23 #include "net/test/embedded_test_server/http_response.h" | 23 #include "net/test/embedded_test_server/http_response.h" |
| 24 #include "storage/browser/quota/quota_settings.h" | |
| 25 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
| 26 #include "url/origin.h" | 25 #include "url/origin.h" |
| 27 #include "url/url_constants.h" | 26 #include "url/url_constants.h" |
| 28 | 27 |
| 29 using testing::_; | 28 using testing::_; |
| 30 | 29 |
| 31 namespace content { | 30 namespace content { |
| 32 | 31 |
| 33 namespace { | 32 namespace { |
| 34 | 33 |
| 35 class MockContentBrowserClient : public ContentBrowserClient { | 34 class MockContentBrowserClient : public ContentBrowserClient { |
| 36 public: | 35 public: |
| 37 MOCK_METHOD6(ClearSiteData, | 36 MOCK_METHOD6(ClearSiteData, |
| 38 void(content::BrowserContext* browser_context, | 37 void(content::BrowserContext* browser_context, |
| 39 const url::Origin& origin, | 38 const url::Origin& origin, |
| 40 bool remove_cookies, | 39 bool remove_cookies, |
| 41 bool remove_storage, | 40 bool remove_storage, |
| 42 bool remove_cache, | 41 bool remove_cache, |
| 43 const base::Closure& callback)); | 42 const base::Closure& callback)); |
| 44 | |
| 45 void GetQuotaSettings( | |
| 46 content::BrowserContext* context, | |
| 47 content::StoragePartition* partition, | |
| 48 const storage::OptionalQuotaSettingsCallback& callback) override { | |
| 49 callback.Run(storage::GetHardCodedSettings(100 * 1024 * 1024)); | |
| 50 } | |
| 51 }; | 43 }; |
| 52 | 44 |
| 53 class TestContentBrowserClient : public MockContentBrowserClient { | 45 class TestContentBrowserClient : public MockContentBrowserClient { |
| 54 public: | 46 public: |
| 55 void ClearSiteData(content::BrowserContext* browser_context, | 47 void ClearSiteData(content::BrowserContext* browser_context, |
| 56 const url::Origin& origin, | 48 const url::Origin& origin, |
| 57 bool remove_cookies, | 49 bool remove_cookies, |
| 58 bool remove_storage, | 50 bool remove_storage, |
| 59 bool remove_cache, | 51 bool remove_cache, |
| 60 const base::Closure& callback) override { | 52 const base::Closure& callback) override { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 url::Origin(url), test_case.remove_cookies, | 225 url::Origin(url), test_case.remove_cookies, |
| 234 test_case.remove_storage, test_case.remove_cache, _)); | 226 test_case.remove_storage, test_case.remove_cache, _)); |
| 235 | 227 |
| 236 NavigateToURL(shell(), url); | 228 NavigateToURL(shell(), url); |
| 237 | 229 |
| 238 testing::Mock::VerifyAndClearExpectations(GetContentBrowserClient()); | 230 testing::Mock::VerifyAndClearExpectations(GetContentBrowserClient()); |
| 239 } | 231 } |
| 240 } | 232 } |
| 241 | 233 |
| 242 } // namespace content | 234 } // namespace content |
| OLD | NEW |