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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 2366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2377 | 2377 |
2378 EXPECT_CALL(*tester.store(), | 2378 EXPECT_CALL(*tester.store(), |
2379 RemoveLoginsByURLAndTimeImpl(ProbablySameFilter(filter), _, _)) | 2379 RemoveLoginsByURLAndTimeImpl(ProbablySameFilter(filter), _, _)) |
2380 .WillOnce(Return(password_manager::PasswordStoreChangeList())); | 2380 .WillOnce(Return(password_manager::PasswordStoreChangeList())); |
2381 BlockUntilOriginDataRemoved(browsing_data::EVERYTHING, | 2381 BlockUntilOriginDataRemoved(browsing_data::EVERYTHING, |
2382 BrowsingDataRemover::REMOVE_PASSWORDS, builder); | 2382 BrowsingDataRemover::REMOVE_PASSWORDS, builder); |
2383 } | 2383 } |
2384 | 2384 |
2385 TEST_F(BrowsingDataRemoverTest, DisableAutoSignIn) { | 2385 TEST_F(BrowsingDataRemoverTest, DisableAutoSignIn) { |
2386 RemovePasswordsTester tester(GetProfile()); | 2386 RemovePasswordsTester tester(GetProfile()); |
| 2387 base::Callback<bool(const GURL&)> empty_filter = |
| 2388 BrowsingDataFilterBuilder::BuildNoopFilter(); |
2387 | 2389 |
2388 EXPECT_CALL(*tester.store(), DisableAutoSignInForAllLoginsImpl()) | 2390 EXPECT_CALL( |
| 2391 *tester.store(), |
| 2392 DisableAutoSignInForOriginsImpl(ProbablySameFilter(empty_filter))) |
2389 .WillOnce(Return(password_manager::PasswordStoreChangeList())); | 2393 .WillOnce(Return(password_manager::PasswordStoreChangeList())); |
2390 | 2394 |
2391 BlockUntilBrowsingDataRemoved(browsing_data::EVERYTHING, | 2395 BlockUntilBrowsingDataRemoved(browsing_data::EVERYTHING, |
2392 BrowsingDataRemover::REMOVE_COOKIES, false); | 2396 BrowsingDataRemover::REMOVE_COOKIES, false); |
2393 } | 2397 } |
2394 | 2398 |
2395 TEST_F(BrowsingDataRemoverTest, DisableAutoSignInAfterRemovingPasswords) { | 2399 TEST_F(BrowsingDataRemoverTest, DisableAutoSignInAfterRemovingPasswords) { |
2396 RemovePasswordsTester tester(GetProfile()); | 2400 RemovePasswordsTester tester(GetProfile()); |
| 2401 base::Callback<bool(const GURL&)> empty_filter = |
| 2402 BrowsingDataFilterBuilder::BuildNoopFilter(); |
2397 | 2403 |
2398 EXPECT_CALL(*tester.store(), RemoveLoginsByURLAndTimeImpl(_, _, _)) | 2404 EXPECT_CALL(*tester.store(), RemoveLoginsByURLAndTimeImpl(_, _, _)) |
2399 .WillOnce(Return(password_manager::PasswordStoreChangeList())); | 2405 .WillOnce(Return(password_manager::PasswordStoreChangeList())); |
2400 EXPECT_CALL(*tester.store(), DisableAutoSignInForAllLoginsImpl()) | 2406 EXPECT_CALL( |
| 2407 *tester.store(), |
| 2408 DisableAutoSignInForOriginsImpl(ProbablySameFilter(empty_filter))) |
2401 .WillOnce(Return(password_manager::PasswordStoreChangeList())); | 2409 .WillOnce(Return(password_manager::PasswordStoreChangeList())); |
2402 | 2410 |
2403 BlockUntilBrowsingDataRemoved(browsing_data::EVERYTHING, | 2411 BlockUntilBrowsingDataRemoved(browsing_data::EVERYTHING, |
2404 BrowsingDataRemover::REMOVE_COOKIES | | 2412 BrowsingDataRemover::REMOVE_COOKIES | |
2405 BrowsingDataRemover::REMOVE_PASSWORDS, | 2413 BrowsingDataRemover::REMOVE_PASSWORDS, |
2406 false); | 2414 false); |
2407 } | 2415 } |
2408 | 2416 |
2409 TEST_F(BrowsingDataRemoverTest, RemoveContentSettingsWithBlacklist) { | 2417 TEST_F(BrowsingDataRemoverTest, RemoveContentSettingsWithBlacklist) { |
2410 // Add our settings. | 2418 // Add our settings. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2528 BrowsingDataRemover::ClearSettingsForOneTypeWithPredicate( | 2536 BrowsingDataRemover::ClearSettingsForOneTypeWithPredicate( |
2529 host_content_settings_map, CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, | 2537 host_content_settings_map, CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, |
2530 base::Bind(&MatchPrimaryPattern, http_pattern)); | 2538 base::Bind(&MatchPrimaryPattern, http_pattern)); |
2531 // Verify we only have one, and it's url1. | 2539 // Verify we only have one, and it's url1. |
2532 host_content_settings_map->GetSettingsForOneType( | 2540 host_content_settings_map->GetSettingsForOneType( |
2533 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), &host_settings); | 2541 CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), &host_settings); |
2534 EXPECT_EQ(1u, host_settings.size()); | 2542 EXPECT_EQ(1u, host_settings.size()); |
2535 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(url1), | 2543 EXPECT_EQ(ContentSettingsPattern::FromURLNoWildcard(url1), |
2536 host_settings[0].primary_pattern); | 2544 host_settings[0].primary_pattern); |
2537 } | 2545 } |
OLD | NEW |