diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-10 20:30:12 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-10 20:30:12 +0000 |
commit | 93ea1882c8b7e60e6325d67be11aecc61cdd4e9b (patch) | |
tree | e2136cd9c31c40ee0034d15aacd87eff6e2da14b /chrome/browser/browsing_data | |
parent | 19e89d483c8c93eaa7e7038bfef8c626d1572bc3 (diff) | |
download | chromium_src-93ea1882c8b7e60e6325d67be11aecc61cdd4e9b.zip chromium_src-93ea1882c8b7e60e6325d67be11aecc61cdd4e9b.tar.gz chromium_src-93ea1882c8b7e60e6325d67be11aecc61cdd4e9b.tar.bz2 |
Fixes for re-enabling more MSVC level 4 warnings: misc edition #1
This contains fixes for the following sorts of issues:
* Signedness mismatch
The problem here is that using enums to declare bitmasks results in the enum values being signed, when all consumers want to use the values in an unsigned context. Declaring them as consts allows using the more appropriate uint32 type.
In C++11 we could use "enum class" for this, but C++11 isn't legal yet.
BUG=81439
TEST=none
Review URL: https://codereview.chromium.org/385443002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282419 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browsing_data')
-rw-r--r-- | chrome/browser/browsing_data/browsing_data_remover_unittest.cc | 127 |
1 files changed, 45 insertions, 82 deletions
diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc index 860b909..909be18 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc @@ -827,11 +827,9 @@ TEST_F(BrowsingDataRemoverTest, RemoveCookieForever) { // Verify that storage partition was instructed to remove the cookies. StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_COOKIES)); + StoragePartition::REMOVE_DATA_MASK_COOKIES); EXPECT_EQ(removal_data.quota_storage_remove_mask, - static_cast<uint32>( - StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL)); + StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); EXPECT_TRUE(removal_data.remove_origin.is_empty()); EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); } @@ -847,14 +845,11 @@ TEST_F(BrowsingDataRemoverTest, RemoveCookieLastHour) { // Verify that storage partition was instructed to remove the cookies. StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_COOKIES)); + StoragePartition::REMOVE_DATA_MASK_COOKIES); // Removing with time period other than EVERYTHING should not clear // persistent storage data. EXPECT_EQ(removal_data.quota_storage_remove_mask, - static_cast<uint32>( - StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL & - ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT)); + ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT); EXPECT_TRUE(removal_data.remove_origin.is_empty()); EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); } @@ -948,11 +943,9 @@ TEST_F(BrowsingDataRemoverTest, RemoveUnprotectedLocalStorageForever) { // Verify that storage partition was instructed to remove the data correctly. StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE)); + StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE); EXPECT_EQ(removal_data.quota_storage_remove_mask, - static_cast<uint32>( - StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL)); + StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); EXPECT_TRUE(removal_data.remove_origin.is_empty()); EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); @@ -981,11 +974,9 @@ TEST_F(BrowsingDataRemoverTest, RemoveProtectedLocalStorageForever) { // Verify that storage partition was instructed to remove the data correctly. StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE)); + StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE); EXPECT_EQ(removal_data.quota_storage_remove_mask, - static_cast<uint32>( - StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL)); + StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); EXPECT_TRUE(removal_data.remove_origin.is_empty()); EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); @@ -1012,13 +1003,10 @@ TEST_F(BrowsingDataRemoverTest, RemoveLocalStorageForLastWeek) { // Verify that storage partition was instructed to remove the data correctly. StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE)); + StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE); // Persistent storage won't be deleted. EXPECT_EQ(removal_data.quota_storage_remove_mask, - static_cast<uint32>( - StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL & - ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT)); + ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT); EXPECT_TRUE(removal_data.remove_origin.is_empty()); EXPECT_EQ(removal_data.remove_begin, GetBeginTime()); @@ -1112,11 +1100,9 @@ TEST_F(BrowsingDataRemoverTest, RemoveMultipleTypes) { // partition was requested to remove cookie. StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_COOKIES)); + StoragePartition::REMOVE_DATA_MASK_COOKIES); EXPECT_EQ(removal_data.quota_storage_remove_mask, - static_cast<uint32>( - StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL)); + StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); } // This should crash (DCHECK) in Debug, but death tests don't work properly @@ -1147,13 +1133,10 @@ TEST_F(BrowsingDataRemoverTest, RemoveMultipleTypesHistoryProhibited) { // the partition was requested to remove cookie. StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_COOKIES)); + StoragePartition::REMOVE_DATA_MASK_COOKIES); // Persistent storage won't be deleted, since EVERYTHING was not specified. EXPECT_EQ(removal_data.quota_storage_remove_mask, - static_cast<uint32>( - StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL & - ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT)); + ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT); } #endif @@ -1174,14 +1157,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverBoth) { // Verify storage partition related stuffs. StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | + StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | StoragePartition::REMOVE_DATA_MASK_WEBSQL | StoragePartition::REMOVE_DATA_MASK_APPCACHE | - StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); + StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); EXPECT_EQ(removal_data.quota_storage_remove_mask, - static_cast<uint32>( - StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL)); + StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); EXPECT_TRUE(removal_data.remove_origin.is_empty()); } @@ -1207,14 +1188,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverOnlyTemporary) { StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | + StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | StoragePartition::REMOVE_DATA_MASK_WEBSQL | StoragePartition::REMOVE_DATA_MASK_APPCACHE | - StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); + StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); EXPECT_EQ(removal_data.quota_storage_remove_mask, - static_cast<uint32>( - StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL)); + StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); EXPECT_TRUE(removal_data.remove_origin.is_empty()); // Check that all related origin data would be removed, that is, origin @@ -1246,14 +1225,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverOnlyPersistent) { StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | + StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | StoragePartition::REMOVE_DATA_MASK_WEBSQL | StoragePartition::REMOVE_DATA_MASK_APPCACHE | - StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); + StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); EXPECT_EQ(removal_data.quota_storage_remove_mask, - static_cast<uint32>( - StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL)); + StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); EXPECT_TRUE(removal_data.remove_origin.is_empty()); // Check that all related origin data would be removed, that is, origin @@ -1286,14 +1263,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverNeither) { StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | + StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | StoragePartition::REMOVE_DATA_MASK_WEBSQL | StoragePartition::REMOVE_DATA_MASK_APPCACHE | - StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); + StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); EXPECT_EQ(removal_data.quota_storage_remove_mask, - static_cast<uint32>( - StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL)); + StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); EXPECT_TRUE(removal_data.remove_origin.is_empty()); // Check that all related origin data would be removed, that is, origin @@ -1322,14 +1297,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverSpecificOrigin) { StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | + StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | StoragePartition::REMOVE_DATA_MASK_WEBSQL | StoragePartition::REMOVE_DATA_MASK_APPCACHE | - StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); + StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); EXPECT_EQ(removal_data.quota_storage_remove_mask, - static_cast<uint32>( - StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL)); + StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); EXPECT_EQ(removal_data.remove_origin, kOrigin1); } @@ -1351,11 +1324,10 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForLastHour) { StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | + StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | StoragePartition::REMOVE_DATA_MASK_WEBSQL | StoragePartition::REMOVE_DATA_MASK_APPCACHE | - StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); + StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); // Persistent data would be left out since we are not removing from // beginning of time. @@ -1385,11 +1357,10 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForLastWeek) { StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | + StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | StoragePartition::REMOVE_DATA_MASK_WEBSQL | StoragePartition::REMOVE_DATA_MASK_APPCACHE | - StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); + StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); // Persistent data would be left out since we are not removing from // beginning of time. @@ -1425,14 +1396,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedUnprotectedOrigins) { StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | + StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | StoragePartition::REMOVE_DATA_MASK_WEBSQL | StoragePartition::REMOVE_DATA_MASK_APPCACHE | - StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); + StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); EXPECT_EQ(removal_data.quota_storage_remove_mask, - static_cast<uint32>( - StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL)); + StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); EXPECT_TRUE(removal_data.remove_origin.is_empty()); // Check OriginMatcherFunction, |kOrigin1| would not match mask since it @@ -1467,14 +1436,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedProtectedSpecificOrigin) { StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | + StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | StoragePartition::REMOVE_DATA_MASK_WEBSQL | StoragePartition::REMOVE_DATA_MASK_APPCACHE | - StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); + StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); EXPECT_EQ(removal_data.quota_storage_remove_mask, - static_cast<uint32>( - StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL)); + StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); EXPECT_EQ(removal_data.remove_origin, kOrigin1); // Check OriginMatcherFunction, |kOrigin1| would not match mask since it @@ -1510,14 +1477,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedProtectedOrigins) { StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | + StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | StoragePartition::REMOVE_DATA_MASK_WEBSQL | StoragePartition::REMOVE_DATA_MASK_APPCACHE | - StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); + StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); EXPECT_EQ(removal_data.quota_storage_remove_mask, - static_cast<uint32>( - StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL)); + StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); EXPECT_TRUE(removal_data.remove_origin.is_empty()); // Check OriginMatcherFunction, |kOrigin1| would match mask since we @@ -1549,14 +1514,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedIgnoreExtensionsAndDevTools) { StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData(); EXPECT_EQ(removal_data.remove_mask, - static_cast<uint32>( - StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | + StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS | StoragePartition::REMOVE_DATA_MASK_WEBSQL | StoragePartition::REMOVE_DATA_MASK_APPCACHE | - StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)); + StoragePartition::REMOVE_DATA_MASK_INDEXEDDB); EXPECT_EQ(removal_data.quota_storage_remove_mask, - static_cast<uint32>( - StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL)); + StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL); EXPECT_TRUE(removal_data.remove_origin.is_empty()); // Check that extension and devtools data wouldn't be removed, that is, |