OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browsing_data/browsing_data_remover.h" | 5 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/history/history_service_factory.h" | 24 #include "chrome/browser/history/history_service_factory.h" |
25 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 25 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
26 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
27 #include "chrome/test/base/testing_browser_process.h" | 27 #include "chrome/test/base/testing_browser_process.h" |
28 #include "chrome/test/base/testing_profile.h" | 28 #include "chrome/test/base/testing_profile.h" |
29 #include "components/autofill/core/browser/autofill_common_test.h" | 29 #include "components/autofill/core/browser/autofill_common_test.h" |
30 #include "components/autofill/core/browser/autofill_profile.h" | 30 #include "components/autofill/core/browser/autofill_profile.h" |
31 #include "components/autofill/core/browser/credit_card.h" | 31 #include "components/autofill/core/browser/credit_card.h" |
32 #include "components/autofill/core/browser/personal_data_manager.h" | 32 #include "components/autofill/core/browser/personal_data_manager.h" |
33 #include "components/autofill/core/browser/personal_data_manager_observer.h" | 33 #include "components/autofill/core/browser/personal_data_manager_observer.h" |
| 34 #include "content/public/browser/browser_context.h" |
| 35 #include "content/public/browser/cookie_store_factory.h" |
34 #include "content/public/browser/dom_storage_context.h" | 36 #include "content/public/browser/dom_storage_context.h" |
35 #include "content/public/browser/local_storage_usage_info.h" | 37 #include "content/public/browser/local_storage_usage_info.h" |
36 #include "content/public/browser/notification_service.h" | 38 #include "content/public/browser/notification_service.h" |
37 #include "content/public/browser/storage_partition.h" | 39 #include "content/public/browser/storage_partition.h" |
38 #include "content/public/test/test_browser_thread.h" | 40 #include "content/public/common/url_constants.h" |
39 #include "content/public/test/test_browser_thread_bundle.h" | 41 #include "content/public/test/test_browser_thread_bundle.h" |
| 42 #include "content/public/test/test_utils.h" |
40 #include "net/cookies/cookie_monster.h" | 43 #include "net/cookies/cookie_monster.h" |
41 #include "net/ssl/server_bound_cert_service.h" | 44 #include "net/ssl/server_bound_cert_service.h" |
42 #include "net/ssl/server_bound_cert_store.h" | 45 #include "net/ssl/server_bound_cert_store.h" |
43 #include "net/ssl/ssl_client_cert_type.h" | 46 #include "net/ssl/ssl_client_cert_type.h" |
44 #include "net/url_request/url_request_context.h" | 47 #include "net/url_request/url_request_context.h" |
45 #include "net/url_request/url_request_context_getter.h" | 48 #include "net/url_request/url_request_context_getter.h" |
46 #include "testing/gtest/include/gtest/gtest.h" | 49 #include "testing/gtest/include/gtest/gtest.h" |
47 #include "webkit/browser/quota/mock_quota_manager.h" | 50 #include "webkit/browser/quota/mock_quota_manager.h" |
48 #include "webkit/browser/quota/quota_manager.h" | 51 #include "webkit/browser/quota/quota_manager.h" |
49 #include "webkit/common/quota/quota_types.h" | 52 #include "webkit/common/quota/quota_types.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 bool get_cookie_success_; | 219 bool get_cookie_success_; |
217 AwaitCompletionHelper await_completion_; | 220 AwaitCompletionHelper await_completion_; |
218 net::CookieStore* monster_; | 221 net::CookieStore* monster_; |
219 | 222 |
220 DISALLOW_COPY_AND_ASSIGN(RemoveCookieTester); | 223 DISALLOW_COPY_AND_ASSIGN(RemoveCookieTester); |
221 }; | 224 }; |
222 | 225 |
223 class RemoveProfileCookieTester : public RemoveCookieTester { | 226 class RemoveProfileCookieTester : public RemoveCookieTester { |
224 public: | 227 public: |
225 explicit RemoveProfileCookieTester(TestingProfile* profile) { | 228 explicit RemoveProfileCookieTester(TestingProfile* profile) { |
226 SetMonster(profile->GetRequestContext()->GetURLRequestContext()-> | 229 SetMonster( |
227 cookie_store()->GetCookieMonster()); | 230 content::BrowserContext::GetDefaultStoragePartition(profile)-> |
| 231 GetCookieStoreForScheme(chrome::kHttpScheme)->GetCookieMonster()); |
228 } | 232 } |
229 }; | 233 }; |
230 | 234 |
231 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) | 235 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) |
232 class RemoveSafeBrowsingCookieTester : public RemoveCookieTester { | 236 class RemoveSafeBrowsingCookieTester : public RemoveCookieTester { |
233 public: | 237 public: |
234 RemoveSafeBrowsingCookieTester() | 238 RemoveSafeBrowsingCookieTester() |
235 : browser_process_(TestingBrowserProcess::GetGlobal()) { | 239 : browser_process_(TestingBrowserProcess::GetGlobal()) { |
236 scoped_refptr<SafeBrowsingService> sb_service = | 240 scoped_refptr<SafeBrowsingService> sb_service = |
237 SafeBrowsingService::CreateSafeBrowsingService(); | 241 SafeBrowsingService::CreateSafeBrowsingService(); |
238 browser_process_->SetSafeBrowsingService(sb_service.get()); | 242 browser_process_->SetSafeBrowsingService(sb_service.get()); |
239 sb_service->Initialize(); | 243 sb_service->Initialize(); |
240 base::MessageLoop::current()->RunUntilIdle(); | 244 base::MessageLoop::current()->RunUntilIdle(); |
241 | 245 |
242 // Create a cookiemonster that does not have persistant storage, and replace | 246 // Create a cookiemonster that does not have persistant storage, and replace |
243 // the SafeBrowsingService created one with it. | 247 // the SafeBrowsingService created one with it. |
244 net::CookieStore* monster = new net::CookieMonster(NULL, NULL); | 248 net::CookieStore* monster = |
| 249 content::CreateCookieStore(content::CookieStoreConfig())-> |
| 250 GetCookieMonster(); |
245 sb_service->url_request_context()->GetURLRequestContext()-> | 251 sb_service->url_request_context()->GetURLRequestContext()-> |
246 set_cookie_store(monster); | 252 set_cookie_store(monster); |
247 SetMonster(monster); | 253 SetMonster(monster); |
248 } | 254 } |
249 | 255 |
250 virtual ~RemoveSafeBrowsingCookieTester() { | 256 virtual ~RemoveSafeBrowsingCookieTester() { |
251 browser_process_->safe_browsing_service()->ShutDown(); | 257 browser_process_->safe_browsing_service()->ShutDown(); |
252 base::MessageLoop::current()->RunUntilIdle(); | 258 base::MessageLoop::current()->RunUntilIdle(); |
253 browser_process_->SetSafeBrowsingService(NULL); | 259 browser_process_->SetSafeBrowsingService(NULL); |
254 } | 260 } |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 BlockUntilBrowsingDataRemoved( | 1391 BlockUntilBrowsingDataRemoved( |
1386 BrowsingDataRemover::LAST_HOUR, | 1392 BrowsingDataRemover::LAST_HOUR, |
1387 BrowsingDataRemover::REMOVE_HISTORY, false); | 1393 BrowsingDataRemover::REMOVE_HISTORY, false); |
1388 | 1394 |
1389 EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask()); | 1395 EXPECT_EQ(BrowsingDataRemover::REMOVE_HISTORY, GetRemovalMask()); |
1390 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); | 1396 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); |
1391 EXPECT_TRUE(tester.HasOrigin(std::string())); | 1397 EXPECT_TRUE(tester.HasOrigin(std::string())); |
1392 EXPECT_FALSE(tester.HasOrigin(kWebOrigin)); | 1398 EXPECT_FALSE(tester.HasOrigin(kWebOrigin)); |
1393 EXPECT_TRUE(tester.HasOrigin(kChromeOrigin)); | 1399 EXPECT_TRUE(tester.HasOrigin(kChromeOrigin)); |
1394 } | 1400 } |
OLD | NEW |