Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: chrome/browser/browsing_data/browsing_data_remover_unittest.cc

Issue 385443002: Fixes for re-enabling more MSVC level 4 warnings: misc edition #1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fix, take 3 Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/data_deleter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, 814 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING,
815 BrowsingDataRemover::REMOVE_COOKIES, 815 BrowsingDataRemover::REMOVE_COOKIES,
816 false); 816 false);
817 817
818 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); 818 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask());
819 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 819 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
820 820
821 // Verify that storage partition was instructed to remove the cookies. 821 // Verify that storage partition was instructed to remove the cookies.
822 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 822 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
823 EXPECT_EQ(removal_data.remove_mask, 823 EXPECT_EQ(removal_data.remove_mask,
824 static_cast<uint32>( 824 StoragePartition::REMOVE_DATA_MASK_COOKIES);
825 StoragePartition::REMOVE_DATA_MASK_COOKIES));
826 EXPECT_EQ(removal_data.quota_storage_remove_mask, 825 EXPECT_EQ(removal_data.quota_storage_remove_mask,
827 static_cast<uint32>( 826 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
828 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
829 EXPECT_TRUE(removal_data.remove_origin.is_empty()); 827 EXPECT_TRUE(removal_data.remove_origin.is_empty());
830 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); 828 EXPECT_EQ(removal_data.remove_begin, GetBeginTime());
831 } 829 }
832 830
833 TEST_F(BrowsingDataRemoverTest, RemoveCookieLastHour) { 831 TEST_F(BrowsingDataRemoverTest, RemoveCookieLastHour) {
834 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::LAST_HOUR, 832 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::LAST_HOUR,
835 BrowsingDataRemover::REMOVE_COOKIES, 833 BrowsingDataRemover::REMOVE_COOKIES,
836 false); 834 false);
837 835
838 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask()); 836 EXPECT_EQ(BrowsingDataRemover::REMOVE_COOKIES, GetRemovalMask());
839 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 837 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
840 838
841 // Verify that storage partition was instructed to remove the cookies. 839 // Verify that storage partition was instructed to remove the cookies.
842 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 840 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
843 EXPECT_EQ(removal_data.remove_mask, 841 EXPECT_EQ(removal_data.remove_mask,
844 static_cast<uint32>( 842 StoragePartition::REMOVE_DATA_MASK_COOKIES);
845 StoragePartition::REMOVE_DATA_MASK_COOKIES));
846 // Removing with time period other than EVERYTHING should not clear 843 // Removing with time period other than EVERYTHING should not clear
847 // persistent storage data. 844 // persistent storage data.
848 EXPECT_EQ(removal_data.quota_storage_remove_mask, 845 EXPECT_EQ(removal_data.quota_storage_remove_mask,
849 static_cast<uint32>( 846 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT);
850 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL &
851 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT));
852 EXPECT_TRUE(removal_data.remove_origin.is_empty()); 847 EXPECT_TRUE(removal_data.remove_origin.is_empty());
853 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); 848 EXPECT_EQ(removal_data.remove_begin, GetBeginTime());
854 } 849 }
855 850
856 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) 851 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING)
857 TEST_F(BrowsingDataRemoverTest, RemoveSafeBrowsingCookieForever) { 852 TEST_F(BrowsingDataRemoverTest, RemoveSafeBrowsingCookieForever) {
858 RemoveSafeBrowsingCookieTester tester; 853 RemoveSafeBrowsingCookieTester tester;
859 854
860 tester.AddCookie(); 855 tester.AddCookie();
861 ASSERT_TRUE(tester.ContainsCookie()); 856 ASSERT_TRUE(tester.ContainsCookie());
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, 930 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING,
936 BrowsingDataRemover::REMOVE_LOCAL_STORAGE, 931 BrowsingDataRemover::REMOVE_LOCAL_STORAGE,
937 false); 932 false);
938 933
939 EXPECT_EQ(BrowsingDataRemover::REMOVE_LOCAL_STORAGE, GetRemovalMask()); 934 EXPECT_EQ(BrowsingDataRemover::REMOVE_LOCAL_STORAGE, GetRemovalMask());
940 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 935 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
941 936
942 // Verify that storage partition was instructed to remove the data correctly. 937 // Verify that storage partition was instructed to remove the data correctly.
943 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 938 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
944 EXPECT_EQ(removal_data.remove_mask, 939 EXPECT_EQ(removal_data.remove_mask,
945 static_cast<uint32>( 940 StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE);
946 StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE));
947 EXPECT_EQ(removal_data.quota_storage_remove_mask, 941 EXPECT_EQ(removal_data.quota_storage_remove_mask,
948 static_cast<uint32>( 942 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
949 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
950 EXPECT_TRUE(removal_data.remove_origin.is_empty()); 943 EXPECT_TRUE(removal_data.remove_origin.is_empty());
951 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); 944 EXPECT_EQ(removal_data.remove_begin, GetBeginTime());
952 945
953 // Check origin matcher. 946 // Check origin matcher.
954 EXPECT_FALSE(removal_data.origin_matcher.Run(kOrigin1, mock_policy)); 947 EXPECT_FALSE(removal_data.origin_matcher.Run(kOrigin1, mock_policy));
955 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy)); 948 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy));
956 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy)); 949 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy));
957 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginExt, mock_policy)); 950 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginExt, mock_policy));
958 } 951 }
959 952
960 TEST_F(BrowsingDataRemoverTest, RemoveProtectedLocalStorageForever) { 953 TEST_F(BrowsingDataRemoverTest, RemoveProtectedLocalStorageForever) {
961 // Protect kOrigin1. 954 // Protect kOrigin1.
962 scoped_refptr<MockExtensionSpecialStoragePolicy> mock_policy = 955 scoped_refptr<MockExtensionSpecialStoragePolicy> mock_policy =
963 new MockExtensionSpecialStoragePolicy; 956 new MockExtensionSpecialStoragePolicy;
964 mock_policy->AddProtected(kOrigin1.GetOrigin()); 957 mock_policy->AddProtected(kOrigin1.GetOrigin());
965 GetProfile()->SetExtensionSpecialStoragePolicy(mock_policy.get()); 958 GetProfile()->SetExtensionSpecialStoragePolicy(mock_policy.get());
966 959
967 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, 960 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING,
968 BrowsingDataRemover::REMOVE_LOCAL_STORAGE, 961 BrowsingDataRemover::REMOVE_LOCAL_STORAGE,
969 true); 962 true);
970 963
971 EXPECT_EQ(BrowsingDataRemover::REMOVE_LOCAL_STORAGE, GetRemovalMask()); 964 EXPECT_EQ(BrowsingDataRemover::REMOVE_LOCAL_STORAGE, GetRemovalMask());
972 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB | 965 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB |
973 BrowsingDataHelper::PROTECTED_WEB, GetOriginSetMask()); 966 BrowsingDataHelper::PROTECTED_WEB, GetOriginSetMask());
974 967
975 // Verify that storage partition was instructed to remove the data correctly. 968 // Verify that storage partition was instructed to remove the data correctly.
976 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 969 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
977 EXPECT_EQ(removal_data.remove_mask, 970 EXPECT_EQ(removal_data.remove_mask,
978 static_cast<uint32>( 971 StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE);
979 StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE));
980 EXPECT_EQ(removal_data.quota_storage_remove_mask, 972 EXPECT_EQ(removal_data.quota_storage_remove_mask,
981 static_cast<uint32>( 973 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
982 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
983 EXPECT_TRUE(removal_data.remove_origin.is_empty()); 974 EXPECT_TRUE(removal_data.remove_origin.is_empty());
984 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); 975 EXPECT_EQ(removal_data.remove_begin, GetBeginTime());
985 976
986 // Check origin matcher all http origin will match since we specified 977 // Check origin matcher all http origin will match since we specified
987 // both protected and unprotected. 978 // both protected and unprotected.
988 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy)); 979 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy));
989 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy)); 980 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy));
990 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy)); 981 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy));
991 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginExt, mock_policy)); 982 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginExt, mock_policy));
992 } 983 }
993 984
994 TEST_F(BrowsingDataRemoverTest, RemoveLocalStorageForLastWeek) { 985 TEST_F(BrowsingDataRemoverTest, RemoveLocalStorageForLastWeek) {
995 scoped_refptr<MockExtensionSpecialStoragePolicy> mock_policy = 986 scoped_refptr<MockExtensionSpecialStoragePolicy> mock_policy =
996 new MockExtensionSpecialStoragePolicy; 987 new MockExtensionSpecialStoragePolicy;
997 GetProfile()->SetExtensionSpecialStoragePolicy(mock_policy.get()); 988 GetProfile()->SetExtensionSpecialStoragePolicy(mock_policy.get());
998 989
999 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::LAST_WEEK, 990 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::LAST_WEEK,
1000 BrowsingDataRemover::REMOVE_LOCAL_STORAGE, 991 BrowsingDataRemover::REMOVE_LOCAL_STORAGE,
1001 false); 992 false);
1002 993
1003 EXPECT_EQ(BrowsingDataRemover::REMOVE_LOCAL_STORAGE, GetRemovalMask()); 994 EXPECT_EQ(BrowsingDataRemover::REMOVE_LOCAL_STORAGE, GetRemovalMask());
1004 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 995 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
1005 996
1006 // Verify that storage partition was instructed to remove the data correctly. 997 // Verify that storage partition was instructed to remove the data correctly.
1007 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 998 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
1008 EXPECT_EQ(removal_data.remove_mask, 999 EXPECT_EQ(removal_data.remove_mask,
1009 static_cast<uint32>( 1000 StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE);
1010 StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE));
1011 // Persistent storage won't be deleted. 1001 // Persistent storage won't be deleted.
1012 EXPECT_EQ(removal_data.quota_storage_remove_mask, 1002 EXPECT_EQ(removal_data.quota_storage_remove_mask,
1013 static_cast<uint32>( 1003 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT);
1014 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL &
1015 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT));
1016 EXPECT_TRUE(removal_data.remove_origin.is_empty()); 1004 EXPECT_TRUE(removal_data.remove_origin.is_empty());
1017 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); 1005 EXPECT_EQ(removal_data.remove_begin, GetBeginTime());
1018 1006
1019 // Check origin matcher. 1007 // Check origin matcher.
1020 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy)); 1008 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy));
1021 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy)); 1009 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy));
1022 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy)); 1010 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy));
1023 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginExt, mock_policy)); 1011 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginExt, mock_policy));
1024 } 1012 }
1025 1013
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 removal_mask, false); 1087 removal_mask, false);
1100 1088
1101 EXPECT_EQ(removal_mask, GetRemovalMask()); 1089 EXPECT_EQ(removal_mask, GetRemovalMask());
1102 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 1090 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
1103 EXPECT_FALSE(history_tester.HistoryContainsURL(kOrigin1)); 1091 EXPECT_FALSE(history_tester.HistoryContainsURL(kOrigin1));
1104 1092
1105 // The cookie would be deleted throught the StorageParition, check if the 1093 // The cookie would be deleted throught the StorageParition, check if the
1106 // partition was requested to remove cookie. 1094 // partition was requested to remove cookie.
1107 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 1095 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
1108 EXPECT_EQ(removal_data.remove_mask, 1096 EXPECT_EQ(removal_data.remove_mask,
1109 static_cast<uint32>( 1097 StoragePartition::REMOVE_DATA_MASK_COOKIES);
1110 StoragePartition::REMOVE_DATA_MASK_COOKIES));
1111 EXPECT_EQ(removal_data.quota_storage_remove_mask, 1098 EXPECT_EQ(removal_data.quota_storage_remove_mask,
1112 static_cast<uint32>( 1099 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
1113 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
1114 } 1100 }
1115 1101
1116 // This should crash (DCHECK) in Debug, but death tests don't work properly 1102 // This should crash (DCHECK) in Debug, but death tests don't work properly
1117 // here. 1103 // here.
1118 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) 1104 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
1119 TEST_F(BrowsingDataRemoverTest, RemoveMultipleTypesHistoryProhibited) { 1105 TEST_F(BrowsingDataRemoverTest, RemoveMultipleTypesHistoryProhibited) {
1120 PrefService* prefs = GetProfile()->GetPrefs(); 1106 PrefService* prefs = GetProfile()->GetPrefs();
1121 prefs->SetBoolean(prefs::kAllowDeletingBrowserHistory, false); 1107 prefs->SetBoolean(prefs::kAllowDeletingBrowserHistory, false);
1122 1108
1123 // Add some history. 1109 // Add some history.
(...skipping 10 matching lines...) Expand all
1134 EXPECT_EQ(removal_mask, GetRemovalMask()); 1120 EXPECT_EQ(removal_mask, GetRemovalMask());
1135 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 1121 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
1136 1122
1137 // 1/2. History should remain. 1123 // 1/2. History should remain.
1138 EXPECT_TRUE(history_tester.HistoryContainsURL(kOrigin1)); 1124 EXPECT_TRUE(history_tester.HistoryContainsURL(kOrigin1));
1139 1125
1140 // 2/2. The cookie(s) would be deleted throught the StorageParition, check if 1126 // 2/2. The cookie(s) would be deleted throught the StorageParition, check if
1141 // the partition was requested to remove cookie. 1127 // the partition was requested to remove cookie.
1142 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 1128 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
1143 EXPECT_EQ(removal_data.remove_mask, 1129 EXPECT_EQ(removal_data.remove_mask,
1144 static_cast<uint32>( 1130 StoragePartition::REMOVE_DATA_MASK_COOKIES);
1145 StoragePartition::REMOVE_DATA_MASK_COOKIES));
1146 // Persistent storage won't be deleted, since EVERYTHING was not specified. 1131 // Persistent storage won't be deleted, since EVERYTHING was not specified.
1147 EXPECT_EQ(removal_data.quota_storage_remove_mask, 1132 EXPECT_EQ(removal_data.quota_storage_remove_mask,
1148 static_cast<uint32>( 1133 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT);
1149 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL &
1150 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT));
1151 } 1134 }
1152 #endif 1135 #endif
1153 1136
1154 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverBoth) { 1137 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverBoth) {
1155 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, 1138 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING,
1156 BrowsingDataRemover::REMOVE_FILE_SYSTEMS | 1139 BrowsingDataRemover::REMOVE_FILE_SYSTEMS |
1157 BrowsingDataRemover::REMOVE_WEBSQL | 1140 BrowsingDataRemover::REMOVE_WEBSQL |
1158 BrowsingDataRemover::REMOVE_APPCACHE | 1141 BrowsingDataRemover::REMOVE_APPCACHE |
1159 BrowsingDataRemover::REMOVE_INDEXEDDB, 1142 BrowsingDataRemover::REMOVE_INDEXEDDB,
1160 false); 1143 false);
1161 1144
1162 EXPECT_EQ(BrowsingDataRemover::REMOVE_FILE_SYSTEMS | 1145 EXPECT_EQ(BrowsingDataRemover::REMOVE_FILE_SYSTEMS |
1163 BrowsingDataRemover::REMOVE_WEBSQL | 1146 BrowsingDataRemover::REMOVE_WEBSQL |
1164 BrowsingDataRemover::REMOVE_APPCACHE | 1147 BrowsingDataRemover::REMOVE_APPCACHE |
1165 BrowsingDataRemover::REMOVE_INDEXEDDB, GetRemovalMask()); 1148 BrowsingDataRemover::REMOVE_INDEXEDDB, GetRemovalMask());
1166 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 1149 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
1167 1150
1168 // Verify storage partition related stuffs. 1151 // Verify storage partition related stuffs.
1169 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 1152 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
1170 EXPECT_EQ(removal_data.remove_mask, 1153 EXPECT_EQ(removal_data.remove_mask,
1171 static_cast<uint32>( 1154 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1172 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1173 StoragePartition::REMOVE_DATA_MASK_WEBSQL | 1155 StoragePartition::REMOVE_DATA_MASK_WEBSQL |
1174 StoragePartition::REMOVE_DATA_MASK_APPCACHE | 1156 StoragePartition::REMOVE_DATA_MASK_APPCACHE |
1175 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); 1157 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
1176 EXPECT_EQ(removal_data.quota_storage_remove_mask, 1158 EXPECT_EQ(removal_data.quota_storage_remove_mask,
1177 static_cast<uint32>( 1159 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
1178 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
1179 EXPECT_TRUE(removal_data.remove_origin.is_empty()); 1160 EXPECT_TRUE(removal_data.remove_origin.is_empty());
1180 } 1161 }
1181 1162
1182 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverOnlyTemporary) { 1163 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverOnlyTemporary) {
1183 scoped_refptr<MockExtensionSpecialStoragePolicy> mock_policy = 1164 scoped_refptr<MockExtensionSpecialStoragePolicy> mock_policy =
1184 new MockExtensionSpecialStoragePolicy; 1165 new MockExtensionSpecialStoragePolicy;
1185 GetProfile()->SetExtensionSpecialStoragePolicy(mock_policy.get()); 1166 GetProfile()->SetExtensionSpecialStoragePolicy(mock_policy.get());
1186 1167
1187 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, 1168 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING,
1188 BrowsingDataRemover::REMOVE_FILE_SYSTEMS | 1169 BrowsingDataRemover::REMOVE_FILE_SYSTEMS |
1189 BrowsingDataRemover::REMOVE_WEBSQL | 1170 BrowsingDataRemover::REMOVE_WEBSQL |
1190 BrowsingDataRemover::REMOVE_APPCACHE | 1171 BrowsingDataRemover::REMOVE_APPCACHE |
1191 BrowsingDataRemover::REMOVE_INDEXEDDB, 1172 BrowsingDataRemover::REMOVE_INDEXEDDB,
1192 false); 1173 false);
1193 1174
1194 EXPECT_EQ(BrowsingDataRemover::REMOVE_FILE_SYSTEMS | 1175 EXPECT_EQ(BrowsingDataRemover::REMOVE_FILE_SYSTEMS |
1195 BrowsingDataRemover::REMOVE_WEBSQL | 1176 BrowsingDataRemover::REMOVE_WEBSQL |
1196 BrowsingDataRemover::REMOVE_APPCACHE | 1177 BrowsingDataRemover::REMOVE_APPCACHE |
1197 BrowsingDataRemover::REMOVE_INDEXEDDB, GetRemovalMask()); 1178 BrowsingDataRemover::REMOVE_INDEXEDDB, GetRemovalMask());
1198 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 1179 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
1199 1180
1200 // Verify storage partition related stuffs. 1181 // Verify storage partition related stuffs.
1201 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 1182 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
1202 1183
1203 EXPECT_EQ(removal_data.remove_mask, 1184 EXPECT_EQ(removal_data.remove_mask,
1204 static_cast<uint32>( 1185 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1205 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1206 StoragePartition::REMOVE_DATA_MASK_WEBSQL | 1186 StoragePartition::REMOVE_DATA_MASK_WEBSQL |
1207 StoragePartition::REMOVE_DATA_MASK_APPCACHE | 1187 StoragePartition::REMOVE_DATA_MASK_APPCACHE |
1208 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); 1188 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
1209 EXPECT_EQ(removal_data.quota_storage_remove_mask, 1189 EXPECT_EQ(removal_data.quota_storage_remove_mask,
1210 static_cast<uint32>( 1190 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
1211 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
1212 EXPECT_TRUE(removal_data.remove_origin.is_empty()); 1191 EXPECT_TRUE(removal_data.remove_origin.is_empty());
1213 1192
1214 // Check that all related origin data would be removed, that is, origin 1193 // Check that all related origin data would be removed, that is, origin
1215 // matcher would match these origin. 1194 // matcher would match these origin.
1216 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy)); 1195 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy));
1217 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy)); 1196 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy));
1218 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy)); 1197 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy));
1219 } 1198 }
1220 1199
1221 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverOnlyPersistent) { 1200 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverOnlyPersistent) {
(...skipping 11 matching lines...) Expand all
1233 EXPECT_EQ(BrowsingDataRemover::REMOVE_FILE_SYSTEMS | 1212 EXPECT_EQ(BrowsingDataRemover::REMOVE_FILE_SYSTEMS |
1234 BrowsingDataRemover::REMOVE_WEBSQL | 1213 BrowsingDataRemover::REMOVE_WEBSQL |
1235 BrowsingDataRemover::REMOVE_APPCACHE | 1214 BrowsingDataRemover::REMOVE_APPCACHE |
1236 BrowsingDataRemover::REMOVE_INDEXEDDB, GetRemovalMask()); 1215 BrowsingDataRemover::REMOVE_INDEXEDDB, GetRemovalMask());
1237 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 1216 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
1238 1217
1239 // Verify storage partition related stuffs. 1218 // Verify storage partition related stuffs.
1240 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 1219 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
1241 1220
1242 EXPECT_EQ(removal_data.remove_mask, 1221 EXPECT_EQ(removal_data.remove_mask,
1243 static_cast<uint32>( 1222 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1244 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1245 StoragePartition::REMOVE_DATA_MASK_WEBSQL | 1223 StoragePartition::REMOVE_DATA_MASK_WEBSQL |
1246 StoragePartition::REMOVE_DATA_MASK_APPCACHE | 1224 StoragePartition::REMOVE_DATA_MASK_APPCACHE |
1247 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); 1225 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
1248 EXPECT_EQ(removal_data.quota_storage_remove_mask, 1226 EXPECT_EQ(removal_data.quota_storage_remove_mask,
1249 static_cast<uint32>( 1227 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
1250 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
1251 EXPECT_TRUE(removal_data.remove_origin.is_empty()); 1228 EXPECT_TRUE(removal_data.remove_origin.is_empty());
1252 1229
1253 // Check that all related origin data would be removed, that is, origin 1230 // Check that all related origin data would be removed, that is, origin
1254 // matcher would match these origin. 1231 // matcher would match these origin.
1255 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy)); 1232 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy));
1256 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy)); 1233 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy));
1257 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy)); 1234 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy));
1258 } 1235 }
1259 1236
1260 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverNeither) { 1237 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverNeither) {
(...skipping 12 matching lines...) Expand all
1273 EXPECT_EQ(BrowsingDataRemover::REMOVE_FILE_SYSTEMS | 1250 EXPECT_EQ(BrowsingDataRemover::REMOVE_FILE_SYSTEMS |
1274 BrowsingDataRemover::REMOVE_WEBSQL | 1251 BrowsingDataRemover::REMOVE_WEBSQL |
1275 BrowsingDataRemover::REMOVE_APPCACHE | 1252 BrowsingDataRemover::REMOVE_APPCACHE |
1276 BrowsingDataRemover::REMOVE_INDEXEDDB, GetRemovalMask()); 1253 BrowsingDataRemover::REMOVE_INDEXEDDB, GetRemovalMask());
1277 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 1254 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
1278 1255
1279 // Verify storage partition related stuffs. 1256 // Verify storage partition related stuffs.
1280 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 1257 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
1281 1258
1282 EXPECT_EQ(removal_data.remove_mask, 1259 EXPECT_EQ(removal_data.remove_mask,
1283 static_cast<uint32>( 1260 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1284 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1285 StoragePartition::REMOVE_DATA_MASK_WEBSQL | 1261 StoragePartition::REMOVE_DATA_MASK_WEBSQL |
1286 StoragePartition::REMOVE_DATA_MASK_APPCACHE | 1262 StoragePartition::REMOVE_DATA_MASK_APPCACHE |
1287 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); 1263 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
1288 EXPECT_EQ(removal_data.quota_storage_remove_mask, 1264 EXPECT_EQ(removal_data.quota_storage_remove_mask,
1289 static_cast<uint32>( 1265 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
1290 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
1291 EXPECT_TRUE(removal_data.remove_origin.is_empty()); 1266 EXPECT_TRUE(removal_data.remove_origin.is_empty());
1292 1267
1293 // Check that all related origin data would be removed, that is, origin 1268 // Check that all related origin data would be removed, that is, origin
1294 // matcher would match these origin. 1269 // matcher would match these origin.
1295 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy)); 1270 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy));
1296 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy)); 1271 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy));
1297 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy)); 1272 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy));
1298 } 1273 }
1299 1274
1300 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverSpecificOrigin) { 1275 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverSpecificOrigin) {
1301 // Remove Origin 1. 1276 // Remove Origin 1.
1302 BlockUntilOriginDataRemoved(BrowsingDataRemover::EVERYTHING, 1277 BlockUntilOriginDataRemoved(BrowsingDataRemover::EVERYTHING,
1303 BrowsingDataRemover::REMOVE_APPCACHE | 1278 BrowsingDataRemover::REMOVE_APPCACHE |
1304 BrowsingDataRemover::REMOVE_FILE_SYSTEMS | 1279 BrowsingDataRemover::REMOVE_FILE_SYSTEMS |
1305 BrowsingDataRemover::REMOVE_INDEXEDDB | 1280 BrowsingDataRemover::REMOVE_INDEXEDDB |
1306 BrowsingDataRemover::REMOVE_WEBSQL, 1281 BrowsingDataRemover::REMOVE_WEBSQL,
1307 kOrigin1); 1282 kOrigin1);
1308 1283
1309 EXPECT_EQ(BrowsingDataRemover::REMOVE_APPCACHE | 1284 EXPECT_EQ(BrowsingDataRemover::REMOVE_APPCACHE |
1310 BrowsingDataRemover::REMOVE_FILE_SYSTEMS | 1285 BrowsingDataRemover::REMOVE_FILE_SYSTEMS |
1311 BrowsingDataRemover::REMOVE_INDEXEDDB | 1286 BrowsingDataRemover::REMOVE_INDEXEDDB |
1312 BrowsingDataRemover::REMOVE_WEBSQL, GetRemovalMask()); 1287 BrowsingDataRemover::REMOVE_WEBSQL, GetRemovalMask());
1313 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 1288 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
1314 1289
1315 // Verify storage partition related stuffs. 1290 // Verify storage partition related stuffs.
1316 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 1291 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
1317 1292
1318 EXPECT_EQ(removal_data.remove_mask, 1293 EXPECT_EQ(removal_data.remove_mask,
1319 static_cast<uint32>( 1294 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1320 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1321 StoragePartition::REMOVE_DATA_MASK_WEBSQL | 1295 StoragePartition::REMOVE_DATA_MASK_WEBSQL |
1322 StoragePartition::REMOVE_DATA_MASK_APPCACHE | 1296 StoragePartition::REMOVE_DATA_MASK_APPCACHE |
1323 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); 1297 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
1324 EXPECT_EQ(removal_data.quota_storage_remove_mask, 1298 EXPECT_EQ(removal_data.quota_storage_remove_mask,
1325 static_cast<uint32>( 1299 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
1326 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
1327 EXPECT_EQ(removal_data.remove_origin, kOrigin1); 1300 EXPECT_EQ(removal_data.remove_origin, kOrigin1);
1328 } 1301 }
1329 1302
1330 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForLastHour) { 1303 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForLastHour) {
1331 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::LAST_HOUR, 1304 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::LAST_HOUR,
1332 BrowsingDataRemover::REMOVE_FILE_SYSTEMS | 1305 BrowsingDataRemover::REMOVE_FILE_SYSTEMS |
1333 BrowsingDataRemover::REMOVE_WEBSQL | 1306 BrowsingDataRemover::REMOVE_WEBSQL |
1334 BrowsingDataRemover::REMOVE_APPCACHE | 1307 BrowsingDataRemover::REMOVE_APPCACHE |
1335 BrowsingDataRemover::REMOVE_INDEXEDDB, 1308 BrowsingDataRemover::REMOVE_INDEXEDDB,
1336 false); 1309 false);
1337 1310
1338 EXPECT_EQ(BrowsingDataRemover::REMOVE_FILE_SYSTEMS | 1311 EXPECT_EQ(BrowsingDataRemover::REMOVE_FILE_SYSTEMS |
1339 BrowsingDataRemover::REMOVE_WEBSQL | 1312 BrowsingDataRemover::REMOVE_WEBSQL |
1340 BrowsingDataRemover::REMOVE_APPCACHE | 1313 BrowsingDataRemover::REMOVE_APPCACHE |
1341 BrowsingDataRemover::REMOVE_INDEXEDDB, GetRemovalMask()); 1314 BrowsingDataRemover::REMOVE_INDEXEDDB, GetRemovalMask());
1342 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 1315 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
1343 1316
1344 // Verify storage partition related stuffs. 1317 // Verify storage partition related stuffs.
1345 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 1318 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
1346 1319
1347 EXPECT_EQ(removal_data.remove_mask, 1320 EXPECT_EQ(removal_data.remove_mask,
1348 static_cast<uint32>( 1321 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1349 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1350 StoragePartition::REMOVE_DATA_MASK_WEBSQL | 1322 StoragePartition::REMOVE_DATA_MASK_WEBSQL |
1351 StoragePartition::REMOVE_DATA_MASK_APPCACHE | 1323 StoragePartition::REMOVE_DATA_MASK_APPCACHE |
1352 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); 1324 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
1353 1325
1354 // Persistent data would be left out since we are not removing from 1326 // Persistent data would be left out since we are not removing from
1355 // beginning of time. 1327 // beginning of time.
1356 uint32 expected_quota_mask = 1328 uint32 expected_quota_mask =
1357 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT; 1329 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT;
1358 EXPECT_EQ(removal_data.quota_storage_remove_mask, expected_quota_mask); 1330 EXPECT_EQ(removal_data.quota_storage_remove_mask, expected_quota_mask);
1359 EXPECT_TRUE(removal_data.remove_origin.is_empty()); 1331 EXPECT_TRUE(removal_data.remove_origin.is_empty());
1360 // Check removal begin time. 1332 // Check removal begin time.
1361 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); 1333 EXPECT_EQ(removal_data.remove_begin, GetBeginTime());
1362 } 1334 }
1363 1335
1364 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForLastWeek) { 1336 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForLastWeek) {
1365 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::LAST_WEEK, 1337 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::LAST_WEEK,
1366 BrowsingDataRemover::REMOVE_FILE_SYSTEMS | 1338 BrowsingDataRemover::REMOVE_FILE_SYSTEMS |
1367 BrowsingDataRemover::REMOVE_WEBSQL | 1339 BrowsingDataRemover::REMOVE_WEBSQL |
1368 BrowsingDataRemover::REMOVE_APPCACHE | 1340 BrowsingDataRemover::REMOVE_APPCACHE |
1369 BrowsingDataRemover::REMOVE_INDEXEDDB, 1341 BrowsingDataRemover::REMOVE_INDEXEDDB,
1370 false); 1342 false);
1371 1343
1372 EXPECT_EQ(BrowsingDataRemover::REMOVE_FILE_SYSTEMS | 1344 EXPECT_EQ(BrowsingDataRemover::REMOVE_FILE_SYSTEMS |
1373 BrowsingDataRemover::REMOVE_WEBSQL | 1345 BrowsingDataRemover::REMOVE_WEBSQL |
1374 BrowsingDataRemover::REMOVE_APPCACHE | 1346 BrowsingDataRemover::REMOVE_APPCACHE |
1375 BrowsingDataRemover::REMOVE_INDEXEDDB, GetRemovalMask()); 1347 BrowsingDataRemover::REMOVE_INDEXEDDB, GetRemovalMask());
1376 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 1348 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
1377 1349
1378 // Verify storage partition related stuffs. 1350 // Verify storage partition related stuffs.
1379 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 1351 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
1380 1352
1381 EXPECT_EQ(removal_data.remove_mask, 1353 EXPECT_EQ(removal_data.remove_mask,
1382 static_cast<uint32>( 1354 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1383 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1384 StoragePartition::REMOVE_DATA_MASK_WEBSQL | 1355 StoragePartition::REMOVE_DATA_MASK_WEBSQL |
1385 StoragePartition::REMOVE_DATA_MASK_APPCACHE | 1356 StoragePartition::REMOVE_DATA_MASK_APPCACHE |
1386 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); 1357 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
1387 1358
1388 // Persistent data would be left out since we are not removing from 1359 // Persistent data would be left out since we are not removing from
1389 // beginning of time. 1360 // beginning of time.
1390 uint32 expected_quota_mask = 1361 uint32 expected_quota_mask =
1391 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT; 1362 ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT;
1392 EXPECT_EQ(removal_data.quota_storage_remove_mask, expected_quota_mask); 1363 EXPECT_EQ(removal_data.quota_storage_remove_mask, expected_quota_mask);
1393 EXPECT_TRUE(removal_data.remove_origin.is_empty()); 1364 EXPECT_TRUE(removal_data.remove_origin.is_empty());
1394 // Check removal begin time. 1365 // Check removal begin time.
1395 EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); 1366 EXPECT_EQ(removal_data.remove_begin, GetBeginTime());
1396 } 1367 }
(...skipping 15 matching lines...) Expand all
1412 EXPECT_EQ(BrowsingDataRemover::REMOVE_FILE_SYSTEMS | 1383 EXPECT_EQ(BrowsingDataRemover::REMOVE_FILE_SYSTEMS |
1413 BrowsingDataRemover::REMOVE_WEBSQL | 1384 BrowsingDataRemover::REMOVE_WEBSQL |
1414 BrowsingDataRemover::REMOVE_APPCACHE | 1385 BrowsingDataRemover::REMOVE_APPCACHE |
1415 BrowsingDataRemover::REMOVE_INDEXEDDB, GetRemovalMask()); 1386 BrowsingDataRemover::REMOVE_INDEXEDDB, GetRemovalMask());
1416 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 1387 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
1417 1388
1418 // Verify storage partition related stuffs. 1389 // Verify storage partition related stuffs.
1419 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 1390 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
1420 1391
1421 EXPECT_EQ(removal_data.remove_mask, 1392 EXPECT_EQ(removal_data.remove_mask,
1422 static_cast<uint32>( 1393 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1423 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1424 StoragePartition::REMOVE_DATA_MASK_WEBSQL | 1394 StoragePartition::REMOVE_DATA_MASK_WEBSQL |
1425 StoragePartition::REMOVE_DATA_MASK_APPCACHE | 1395 StoragePartition::REMOVE_DATA_MASK_APPCACHE |
1426 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); 1396 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
1427 EXPECT_EQ(removal_data.quota_storage_remove_mask, 1397 EXPECT_EQ(removal_data.quota_storage_remove_mask,
1428 static_cast<uint32>( 1398 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
1429 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
1430 EXPECT_TRUE(removal_data.remove_origin.is_empty()); 1399 EXPECT_TRUE(removal_data.remove_origin.is_empty());
1431 1400
1432 // Check OriginMatcherFunction, |kOrigin1| would not match mask since it 1401 // Check OriginMatcherFunction, |kOrigin1| would not match mask since it
1433 // is protected. 1402 // is protected.
1434 EXPECT_FALSE(removal_data.origin_matcher.Run(kOrigin1, mock_policy)); 1403 EXPECT_FALSE(removal_data.origin_matcher.Run(kOrigin1, mock_policy));
1435 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy)); 1404 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy));
1436 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy)); 1405 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy));
1437 } 1406 }
1438 1407
1439 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedProtectedSpecificOrigin) { 1408 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedProtectedSpecificOrigin) {
(...skipping 14 matching lines...) Expand all
1454 EXPECT_EQ(BrowsingDataRemover::REMOVE_APPCACHE | 1423 EXPECT_EQ(BrowsingDataRemover::REMOVE_APPCACHE |
1455 BrowsingDataRemover::REMOVE_FILE_SYSTEMS | 1424 BrowsingDataRemover::REMOVE_FILE_SYSTEMS |
1456 BrowsingDataRemover::REMOVE_INDEXEDDB | 1425 BrowsingDataRemover::REMOVE_INDEXEDDB |
1457 BrowsingDataRemover::REMOVE_WEBSQL, GetRemovalMask()); 1426 BrowsingDataRemover::REMOVE_WEBSQL, GetRemovalMask());
1458 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 1427 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
1459 1428
1460 // Verify storage partition related stuffs. 1429 // Verify storage partition related stuffs.
1461 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 1430 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
1462 1431
1463 EXPECT_EQ(removal_data.remove_mask, 1432 EXPECT_EQ(removal_data.remove_mask,
1464 static_cast<uint32>( 1433 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1465 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1466 StoragePartition::REMOVE_DATA_MASK_WEBSQL | 1434 StoragePartition::REMOVE_DATA_MASK_WEBSQL |
1467 StoragePartition::REMOVE_DATA_MASK_APPCACHE | 1435 StoragePartition::REMOVE_DATA_MASK_APPCACHE |
1468 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); 1436 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
1469 EXPECT_EQ(removal_data.quota_storage_remove_mask, 1437 EXPECT_EQ(removal_data.quota_storage_remove_mask,
1470 static_cast<uint32>( 1438 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
1471 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
1472 EXPECT_EQ(removal_data.remove_origin, kOrigin1); 1439 EXPECT_EQ(removal_data.remove_origin, kOrigin1);
1473 1440
1474 // Check OriginMatcherFunction, |kOrigin1| would not match mask since it 1441 // Check OriginMatcherFunction, |kOrigin1| would not match mask since it
1475 // is protected. 1442 // is protected.
1476 EXPECT_FALSE(removal_data.origin_matcher.Run(kOrigin1, mock_policy)); 1443 EXPECT_FALSE(removal_data.origin_matcher.Run(kOrigin1, mock_policy));
1477 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy)); 1444 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy));
1478 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy)); 1445 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy));
1479 } 1446 }
1480 1447
1481 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedProtectedOrigins) { 1448 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedProtectedOrigins) {
(...skipping 15 matching lines...) Expand all
1497 BrowsingDataRemover::REMOVE_FILE_SYSTEMS | 1464 BrowsingDataRemover::REMOVE_FILE_SYSTEMS |
1498 BrowsingDataRemover::REMOVE_INDEXEDDB | 1465 BrowsingDataRemover::REMOVE_INDEXEDDB |
1499 BrowsingDataRemover::REMOVE_WEBSQL, GetRemovalMask()); 1466 BrowsingDataRemover::REMOVE_WEBSQL, GetRemovalMask());
1500 EXPECT_EQ(BrowsingDataHelper::PROTECTED_WEB | 1467 EXPECT_EQ(BrowsingDataHelper::PROTECTED_WEB |
1501 BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 1468 BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
1502 1469
1503 // Verify storage partition related stuffs. 1470 // Verify storage partition related stuffs.
1504 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 1471 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
1505 1472
1506 EXPECT_EQ(removal_data.remove_mask, 1473 EXPECT_EQ(removal_data.remove_mask,
1507 static_cast<uint32>( 1474 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1508 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1509 StoragePartition::REMOVE_DATA_MASK_WEBSQL | 1475 StoragePartition::REMOVE_DATA_MASK_WEBSQL |
1510 StoragePartition::REMOVE_DATA_MASK_APPCACHE | 1476 StoragePartition::REMOVE_DATA_MASK_APPCACHE |
1511 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); 1477 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
1512 EXPECT_EQ(removal_data.quota_storage_remove_mask, 1478 EXPECT_EQ(removal_data.quota_storage_remove_mask,
1513 static_cast<uint32>( 1479 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
1514 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
1515 EXPECT_TRUE(removal_data.remove_origin.is_empty()); 1480 EXPECT_TRUE(removal_data.remove_origin.is_empty());
1516 1481
1517 // Check OriginMatcherFunction, |kOrigin1| would match mask since we 1482 // Check OriginMatcherFunction, |kOrigin1| would match mask since we
1518 // would have 'protected' specified in origin_set_mask. 1483 // would have 'protected' specified in origin_set_mask.
1519 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy)); 1484 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin1, mock_policy));
1520 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy)); 1485 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin2, mock_policy));
1521 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy)); 1486 EXPECT_TRUE(removal_data.origin_matcher.Run(kOrigin3, mock_policy));
1522 } 1487 }
1523 1488
1524 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedIgnoreExtensionsAndDevTools) { 1489 TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedIgnoreExtensionsAndDevTools) {
(...skipping 11 matching lines...) Expand all
1536 EXPECT_EQ(BrowsingDataRemover::REMOVE_APPCACHE | 1501 EXPECT_EQ(BrowsingDataRemover::REMOVE_APPCACHE |
1537 BrowsingDataRemover::REMOVE_FILE_SYSTEMS | 1502 BrowsingDataRemover::REMOVE_FILE_SYSTEMS |
1538 BrowsingDataRemover::REMOVE_INDEXEDDB | 1503 BrowsingDataRemover::REMOVE_INDEXEDDB |
1539 BrowsingDataRemover::REMOVE_WEBSQL, GetRemovalMask()); 1504 BrowsingDataRemover::REMOVE_WEBSQL, GetRemovalMask());
1540 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask()); 1505 EXPECT_EQ(BrowsingDataHelper::UNPROTECTED_WEB, GetOriginSetMask());
1541 1506
1542 // Verify storage partition related stuffs. 1507 // Verify storage partition related stuffs.
1543 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); 1508 StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
1544 1509
1545 EXPECT_EQ(removal_data.remove_mask, 1510 EXPECT_EQ(removal_data.remove_mask,
1546 static_cast<uint32>( 1511 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1547 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
1548 StoragePartition::REMOVE_DATA_MASK_WEBSQL | 1512 StoragePartition::REMOVE_DATA_MASK_WEBSQL |
1549 StoragePartition::REMOVE_DATA_MASK_APPCACHE | 1513 StoragePartition::REMOVE_DATA_MASK_APPCACHE |
1550 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); 1514 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
1551 EXPECT_EQ(removal_data.quota_storage_remove_mask, 1515 EXPECT_EQ(removal_data.quota_storage_remove_mask,
1552 static_cast<uint32>( 1516 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
1553 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
1554 EXPECT_TRUE(removal_data.remove_origin.is_empty()); 1517 EXPECT_TRUE(removal_data.remove_origin.is_empty());
1555 1518
1556 // Check that extension and devtools data wouldn't be removed, that is, 1519 // Check that extension and devtools data wouldn't be removed, that is,
1557 // origin matcher would not match these origin. 1520 // origin matcher would not match these origin.
1558 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginExt, mock_policy)); 1521 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginExt, mock_policy));
1559 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginDevTools, mock_policy)); 1522 EXPECT_FALSE(removal_data.origin_matcher.Run(kOriginDevTools, mock_policy));
1560 } 1523 }
1561 1524
1562 TEST_F(BrowsingDataRemoverTest, OriginBasedHistoryRemoval) { 1525 TEST_F(BrowsingDataRemoverTest, OriginBasedHistoryRemoval) {
1563 RemoveHistoryTester tester; 1526 RemoveHistoryTester tester;
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 EXPECT_EQ(1u, tester.clear_count()); 1743 EXPECT_EQ(1u, tester.clear_count());
1781 EXPECT_EQ(CLEAR_CONTEXTS, tester.last_clear_mode()); 1744 EXPECT_EQ(CLEAR_CONTEXTS, tester.last_clear_mode());
1782 } 1745 }
1783 1746
1784 TEST_F(BrowsingDataRemoverTest, DomainReliability_NoMonitor) { 1747 TEST_F(BrowsingDataRemoverTest, DomainReliability_NoMonitor) {
1785 BlockUntilBrowsingDataRemoved( 1748 BlockUntilBrowsingDataRemoved(
1786 BrowsingDataRemover::EVERYTHING, 1749 BrowsingDataRemover::EVERYTHING,
1787 BrowsingDataRemover::REMOVE_HISTORY | 1750 BrowsingDataRemover::REMOVE_HISTORY |
1788 BrowsingDataRemover::REMOVE_COOKIES, false); 1751 BrowsingDataRemover::REMOVE_COOKIES, false);
1789 } 1752 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/data_deleter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698