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 <list> | 10 #include <list> |
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 | 1019 |
1020 private: | 1020 private: |
1021 password_manager::MockPasswordStore* store_; | 1021 password_manager::MockPasswordStore* store_; |
1022 | 1022 |
1023 DISALLOW_COPY_AND_ASSIGN(RemovePasswordsTester); | 1023 DISALLOW_COPY_AND_ASSIGN(RemovePasswordsTester); |
1024 }; | 1024 }; |
1025 | 1025 |
1026 class RemovePermissionPromptCountsTest { | 1026 class RemovePermissionPromptCountsTest { |
1027 public: | 1027 public: |
1028 explicit RemovePermissionPromptCountsTest(TestingProfile* profile) | 1028 explicit RemovePermissionPromptCountsTest(TestingProfile* profile) |
1029 : blocker_(new PermissionDecisionAutoBlocker(profile)) {} | 1029 : blocker_(new PermissionDecisionAutoBlocker(profile)), |
| 1030 profile_(profile) {} |
1030 | 1031 |
1031 int GetDismissCount(const GURL& url, content::PermissionType permission) { | 1032 int GetDismissCount(const GURL& url, content::PermissionType permission) { |
1032 return blocker_->GetActionCountForTest(url, permission, | 1033 return PermissionDecisionAutoBlocker::GetDismissCount( |
1033 PermissionDecisionAutoBlocker::kPromptDismissCountKey); | 1034 url, permission, profile_); |
1034 } | 1035 } |
1035 | 1036 |
1036 int GetIgnoreCount(const GURL& url, content::PermissionType permission) { | 1037 int GetIgnoreCount(const GURL& url, content::PermissionType permission) { |
1037 return blocker_->GetActionCountForTest(url, permission, | 1038 return PermissionDecisionAutoBlocker::GetIgnoreCount( |
1038 PermissionDecisionAutoBlocker::kPromptIgnoreCountKey); | 1039 url, permission, profile_); |
1039 } | 1040 } |
1040 | 1041 |
1041 int RecordIgnore(const GURL& url, content::PermissionType permission) { | 1042 int RecordIgnore(const GURL& url, content::PermissionType permission) { |
1042 return blocker_->RecordIgnore(url, permission); | 1043 return blocker_->RecordIgnore(url, permission); |
1043 } | 1044 } |
1044 | 1045 |
1045 bool ShouldChangeDismissalToBlock(const GURL& url, | 1046 bool ShouldChangeDismissalToBlock(const GURL& url, |
1046 content::PermissionType permission) { | 1047 content::PermissionType permission) { |
1047 return blocker_->ShouldChangeDismissalToBlock(url, permission); | 1048 return blocker_->ShouldChangeDismissalToBlock(url, permission); |
1048 } | 1049 } |
1049 | 1050 |
1050 private: | 1051 private: |
1051 std::unique_ptr<PermissionDecisionAutoBlocker> blocker_; | 1052 std::unique_ptr<PermissionDecisionAutoBlocker> blocker_; |
| 1053 TestingProfile* profile_; |
1052 | 1054 |
1053 DISALLOW_COPY_AND_ASSIGN(RemovePermissionPromptCountsTest); | 1055 DISALLOW_COPY_AND_ASSIGN(RemovePermissionPromptCountsTest); |
1054 }; | 1056 }; |
1055 | 1057 |
1056 // Test Class ---------------------------------------------------------------- | 1058 // Test Class ---------------------------------------------------------------- |
1057 | 1059 |
1058 class BrowsingDataRemoverTest : public testing::Test { | 1060 class BrowsingDataRemoverTest : public testing::Test { |
1059 public: | 1061 public: |
1060 BrowsingDataRemoverTest() | 1062 BrowsingDataRemoverTest() |
1061 : profile_(new TestingProfile()), | 1063 : profile_(new TestingProfile()), |
(...skipping 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2925 EXPECT_TRUE(remover->is_removing()); | 2927 EXPECT_TRUE(remover->is_removing()); |
2926 | 2928 |
2927 // Add one more deletion and wait for it. | 2929 // Add one more deletion and wait for it. |
2928 BlockUntilBrowsingDataRemoved( | 2930 BlockUntilBrowsingDataRemoved( |
2929 browsing_data::ALL_TIME, | 2931 browsing_data::ALL_TIME, |
2930 BrowsingDataRemover::REMOVE_COOKIES, | 2932 BrowsingDataRemover::REMOVE_COOKIES, |
2931 BrowsingDataHelper::UNPROTECTED_WEB); | 2933 BrowsingDataHelper::UNPROTECTED_WEB); |
2932 | 2934 |
2933 EXPECT_FALSE(remover->is_removing()); | 2935 EXPECT_FALSE(remover->is_removing()); |
2934 } | 2936 } |
OLD | NEW |