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" |
24 #include "testing/gmock/include/gmock/gmock.h" | 25 #include "testing/gmock/include/gmock/gmock.h" |
25 #include "url/origin.h" | 26 #include "url/origin.h" |
26 #include "url/url_constants.h" | 27 #include "url/url_constants.h" |
27 | 28 |
28 using testing::_; | 29 using testing::_; |
29 | 30 |
30 namespace content { | 31 namespace content { |
31 | 32 |
32 namespace { | 33 namespace { |
33 | 34 |
34 class MockContentBrowserClient : public ContentBrowserClient { | 35 class MockContentBrowserClient : public ContentBrowserClient { |
35 public: | 36 public: |
36 MOCK_METHOD6(ClearSiteData, | 37 MOCK_METHOD6(ClearSiteData, |
37 void(content::BrowserContext* browser_context, | 38 void(content::BrowserContext* browser_context, |
38 const url::Origin& origin, | 39 const url::Origin& origin, |
39 bool remove_cookies, | 40 bool remove_cookies, |
40 bool remove_storage, | 41 bool remove_storage, |
41 bool remove_cache, | 42 bool remove_cache, |
42 const base::Closure& callback)); | 43 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 } |
43 }; | 51 }; |
44 | 52 |
45 class TestContentBrowserClient : public MockContentBrowserClient { | 53 class TestContentBrowserClient : public MockContentBrowserClient { |
46 public: | 54 public: |
47 void ClearSiteData(content::BrowserContext* browser_context, | 55 void ClearSiteData(content::BrowserContext* browser_context, |
48 const url::Origin& origin, | 56 const url::Origin& origin, |
49 bool remove_cookies, | 57 bool remove_cookies, |
50 bool remove_storage, | 58 bool remove_storage, |
51 bool remove_cache, | 59 bool remove_cache, |
52 const base::Closure& callback) override { | 60 const base::Closure& callback) override { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 url::Origin(url), test_case.remove_cookies, | 233 url::Origin(url), test_case.remove_cookies, |
226 test_case.remove_storage, test_case.remove_cache, _)); | 234 test_case.remove_storage, test_case.remove_cache, _)); |
227 | 235 |
228 NavigateToURL(shell(), url); | 236 NavigateToURL(shell(), url); |
229 | 237 |
230 testing::Mock::VerifyAndClearExpectations(GetContentBrowserClient()); | 238 testing::Mock::VerifyAndClearExpectations(GetContentBrowserClient()); |
231 } | 239 } |
232 } | 240 } |
233 | 241 |
234 } // namespace content | 242 } // namespace content |
OLD | NEW |