| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/json/json_string_value_serializer.h" | 7 #include "base/json/json_string_value_serializer.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 details).ptr())); | 77 details).ptr())); |
| 78 } | 78 } |
| 79 | 79 |
| 80 int GetAsMask(const base::DictionaryValue* dict, std::string path, | 80 int GetAsMask(const base::DictionaryValue* dict, std::string path, |
| 81 int mask_value) { | 81 int mask_value) { |
| 82 bool result; | 82 bool result; |
| 83 EXPECT_TRUE(dict->GetBoolean(path, &result)) << "for " << path; | 83 EXPECT_TRUE(dict->GetBoolean(path, &result)) << "for " << path; |
| 84 return result ? mask_value : 0; | 84 return result ? mask_value : 0; |
| 85 } | 85 } |
| 86 | 86 |
| 87 void RunRemoveBrowsingDataFunctionAndCompareRemovalMask( | 87 void RunBrowsingDataRemoveFunctionAndCompareRemovalMask( |
| 88 const std::string& data_types, | 88 const std::string& data_types, |
| 89 int expected_mask) { | 89 int expected_mask) { |
| 90 scoped_refptr<RemoveBrowsingDataFunction> function = | 90 scoped_refptr<BrowsingDataRemoveFunction> function = |
| 91 new RemoveBrowsingDataFunction(); | 91 new BrowsingDataRemoveFunction(); |
| 92 SCOPED_TRACE(data_types); | 92 SCOPED_TRACE(data_types); |
| 93 EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult( | 93 EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult( |
| 94 function.get(), | 94 function.get(), |
| 95 std::string("[{\"since\": 1},") + data_types + "]", | 95 std::string("[{\"since\": 1},") + data_types + "]", |
| 96 browser())); | 96 browser())); |
| 97 EXPECT_EQ(expected_mask, GetRemovalMask()); | 97 EXPECT_EQ(expected_mask, GetRemovalMask()); |
| 98 EXPECT_EQ(UNPROTECTED_WEB, GetOriginSetMask()); | 98 EXPECT_EQ(UNPROTECTED_WEB, GetOriginSetMask()); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void RunRemoveBrowsingDataWithKeyAndCompareRemovalMask( | 101 void RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 102 const std::string& key, | 102 const std::string& key, |
| 103 int expected_mask) { | 103 int expected_mask) { |
| 104 RunRemoveBrowsingDataFunctionAndCompareRemovalMask( | 104 RunBrowsingDataRemoveFunctionAndCompareRemovalMask( |
| 105 std::string("{\"") + key + "\": true}", expected_mask); | 105 std::string("{\"") + key + "\": true}", expected_mask); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void RunRemoveBrowsingDataFunctionAndCompareOriginSetMask( | 108 void RunBrowsingDataRemoveFunctionAndCompareOriginSetMask( |
| 109 const std::string& protectedStr, | 109 const std::string& protectedStr, |
| 110 int expected_mask) { | 110 int expected_mask) { |
| 111 scoped_refptr<RemoveBrowsingDataFunction> function = | 111 scoped_refptr<BrowsingDataRemoveFunction> function = |
| 112 new RemoveBrowsingDataFunction(); | 112 new BrowsingDataRemoveFunction(); |
| 113 SCOPED_TRACE(protectedStr); | 113 SCOPED_TRACE(protectedStr); |
| 114 EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult( | 114 EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult( |
| 115 function.get(), | 115 function.get(), |
| 116 "[{\"originTypes\": " + protectedStr + "}, {\"cookies\": true}]", | 116 "[{\"originTypes\": " + protectedStr + "}, {\"cookies\": true}]", |
| 117 browser())); | 117 browser())); |
| 118 EXPECT_EQ(expected_mask, GetOriginSetMask()); | 118 EXPECT_EQ(expected_mask, GetOriginSetMask()); |
| 119 } | 119 } |
| 120 | 120 |
| 121 template<class ShortcutFunction> | 121 template<class ShortcutFunction> |
| 122 void RunAndCompareRemovalMask(int expected_mask) { | 122 void RunAndCompareRemovalMask(int expected_mask) { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 GetAsMask(data_to_remove, "webSQL", | 231 GetAsMask(data_to_remove, "webSQL", |
| 232 BrowsingDataRemover::REMOVE_WEBSQL) | | 232 BrowsingDataRemover::REMOVE_WEBSQL) | |
| 233 GetAsMask(data_to_remove, "serverBoundCertificates", | 233 GetAsMask(data_to_remove, "serverBoundCertificates", |
| 234 BrowsingDataRemover::REMOVE_SERVER_BOUND_CERTS); | 234 BrowsingDataRemover::REMOVE_SERVER_BOUND_CERTS); |
| 235 EXPECT_EQ(expected_removal_mask, removal_mask); | 235 EXPECT_EQ(expected_removal_mask, removal_mask); |
| 236 } | 236 } |
| 237 | 237 |
| 238 // The kAllowDeletingBrowserHistory pref must be set to false before this | 238 // The kAllowDeletingBrowserHistory pref must be set to false before this |
| 239 // is called. | 239 // is called. |
| 240 void CheckRemovalPermitted(const std::string& data_types, bool permitted) { | 240 void CheckRemovalPermitted(const std::string& data_types, bool permitted) { |
| 241 scoped_refptr<RemoveBrowsingDataFunction> function = | 241 scoped_refptr<BrowsingDataRemoveFunction> function = |
| 242 new RemoveBrowsingDataFunction(); | 242 new BrowsingDataRemoveFunction(); |
| 243 std::string args = "[{\"since\": 1}," + data_types + "]"; | 243 std::string args = "[{\"since\": 1}," + data_types + "]"; |
| 244 | 244 |
| 245 if (permitted) { | 245 if (permitted) { |
| 246 EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult( | 246 EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult( |
| 247 function.get(), args, browser())) << " for " << args; | 247 function.get(), args, browser())) << " for " << args; |
| 248 } else { | 248 } else { |
| 249 EXPECT_TRUE(MatchPattern( | 249 EXPECT_TRUE(MatchPattern( |
| 250 RunFunctionAndReturnError(function.get(), args, browser()), | 250 RunFunctionAndReturnError(function.get(), args, browser()), |
| 251 extension_browsing_data_api_constants::kDeleteProhibitedError)) | 251 extension_browsing_data_api_constants::kDeleteProhibitedError)) |
| 252 << " for " << args; | 252 << " for " << args; |
| 253 } | 253 } |
| 254 } | 254 } |
| 255 | 255 |
| 256 private: | 256 private: |
| 257 scoped_ptr<BrowsingDataRemover::NotificationDetails> called_with_details_; | 257 scoped_ptr<BrowsingDataRemover::NotificationDetails> called_with_details_; |
| 258 content::NotificationRegistrar registrar_; | 258 content::NotificationRegistrar registrar_; |
| 259 }; | 259 }; |
| 260 | 260 |
| 261 } // namespace | 261 } // namespace |
| 262 | 262 |
| 263 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, OneAtATime) { | 263 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, OneAtATime) { |
| 264 BrowsingDataRemover::set_removing(true); | 264 BrowsingDataRemover::set_removing(true); |
| 265 scoped_refptr<RemoveBrowsingDataFunction> function = | 265 scoped_refptr<BrowsingDataRemoveFunction> function = |
| 266 new RemoveBrowsingDataFunction(); | 266 new BrowsingDataRemoveFunction(); |
| 267 EXPECT_TRUE( | 267 EXPECT_TRUE( |
| 268 MatchPattern(RunFunctionAndReturnError( | 268 MatchPattern(RunFunctionAndReturnError( |
| 269 function.get(), kRemoveEverythingArguments, browser()), | 269 function.get(), kRemoveEverythingArguments, browser()), |
| 270 extension_browsing_data_api_constants::kOneAtATimeError)); | 270 extension_browsing_data_api_constants::kOneAtATimeError)); |
| 271 BrowsingDataRemover::set_removing(false); | 271 BrowsingDataRemover::set_removing(false); |
| 272 | 272 |
| 273 EXPECT_EQ(base::Time(), GetBeginTime()); | 273 EXPECT_EQ(base::Time(), GetBeginTime()); |
| 274 EXPECT_EQ(-1, GetRemovalMask()); | 274 EXPECT_EQ(-1, GetRemovalMask()); |
| 275 } | 275 } |
| 276 | 276 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 298 // If a prohibited type is not selected, the removal is OK. | 298 // If a prohibited type is not selected, the removal is OK. |
| 299 CheckRemovalPermitted("{\"history\": false}", true); | 299 CheckRemovalPermitted("{\"history\": false}", true); |
| 300 CheckRemovalPermitted("{\"downloads\": false}", true); | 300 CheckRemovalPermitted("{\"downloads\": false}", true); |
| 301 CheckRemovalPermitted("{\"cache\": true, \"history\": false}", true); | 301 CheckRemovalPermitted("{\"cache\": true, \"history\": false}", true); |
| 302 CheckRemovalPermitted("{\"cookies\": true, \"downloads\": false}", true); | 302 CheckRemovalPermitted("{\"cookies\": true, \"downloads\": false}", true); |
| 303 } | 303 } |
| 304 | 304 |
| 305 // Use-after-free, see http://crbug.com/116522 | 305 // Use-after-free, see http://crbug.com/116522 |
| 306 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, | 306 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, |
| 307 DISABLED_RemoveBrowsingDataAll) { | 307 DISABLED_RemoveBrowsingDataAll) { |
| 308 scoped_refptr<RemoveBrowsingDataFunction> function = | 308 scoped_refptr<BrowsingDataRemoveFunction> function = |
| 309 new RemoveBrowsingDataFunction(); | 309 new BrowsingDataRemoveFunction(); |
| 310 EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult(function.get(), | 310 EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult(function.get(), |
| 311 kRemoveEverythingArguments, | 311 kRemoveEverythingArguments, |
| 312 browser())); | 312 browser())); |
| 313 | 313 |
| 314 EXPECT_EQ(base::Time::FromDoubleT(1.0), GetBeginTime()); | 314 EXPECT_EQ(base::Time::FromDoubleT(1.0), GetBeginTime()); |
| 315 EXPECT_EQ((BrowsingDataRemover::REMOVE_SITE_DATA | | 315 EXPECT_EQ((BrowsingDataRemover::REMOVE_SITE_DATA | |
| 316 BrowsingDataRemover::REMOVE_CACHE | | 316 BrowsingDataRemover::REMOVE_CACHE | |
| 317 BrowsingDataRemover::REMOVE_DOWNLOADS | | 317 BrowsingDataRemover::REMOVE_DOWNLOADS | |
| 318 BrowsingDataRemover::REMOVE_FORM_DATA | | 318 BrowsingDataRemover::REMOVE_FORM_DATA | |
| 319 BrowsingDataRemover::REMOVE_HISTORY | | 319 BrowsingDataRemover::REMOVE_HISTORY | |
| 320 BrowsingDataRemover::REMOVE_PASSWORDS) & | 320 BrowsingDataRemover::REMOVE_PASSWORDS) & |
| 321 // We can't remove plugin data inside a test profile. | 321 // We can't remove plugin data inside a test profile. |
| 322 ~BrowsingDataRemover::REMOVE_PLUGIN_DATA, GetRemovalMask()); | 322 ~BrowsingDataRemover::REMOVE_PLUGIN_DATA, GetRemovalMask()); |
| 323 } | 323 } |
| 324 | 324 |
| 325 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, BrowsingDataOriginSetMask) { | 325 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, BrowsingDataOriginSetMask) { |
| 326 RunRemoveBrowsingDataFunctionAndCompareOriginSetMask("{}", 0); | 326 RunBrowsingDataRemoveFunctionAndCompareOriginSetMask("{}", 0); |
| 327 | 327 |
| 328 RunRemoveBrowsingDataFunctionAndCompareOriginSetMask( | 328 RunBrowsingDataRemoveFunctionAndCompareOriginSetMask( |
| 329 "{\"unprotectedWeb\": true}", UNPROTECTED_WEB); | 329 "{\"unprotectedWeb\": true}", UNPROTECTED_WEB); |
| 330 RunRemoveBrowsingDataFunctionAndCompareOriginSetMask( | 330 RunBrowsingDataRemoveFunctionAndCompareOriginSetMask( |
| 331 "{\"protectedWeb\": true}", PROTECTED_WEB); | 331 "{\"protectedWeb\": true}", PROTECTED_WEB); |
| 332 RunRemoveBrowsingDataFunctionAndCompareOriginSetMask( | 332 RunBrowsingDataRemoveFunctionAndCompareOriginSetMask( |
| 333 "{\"extension\": true}", EXTENSION); | 333 "{\"extension\": true}", EXTENSION); |
| 334 | 334 |
| 335 RunRemoveBrowsingDataFunctionAndCompareOriginSetMask( | 335 RunBrowsingDataRemoveFunctionAndCompareOriginSetMask( |
| 336 "{\"unprotectedWeb\": true, \"protectedWeb\": true}", | 336 "{\"unprotectedWeb\": true, \"protectedWeb\": true}", |
| 337 UNPROTECTED_WEB | PROTECTED_WEB); | 337 UNPROTECTED_WEB | PROTECTED_WEB); |
| 338 RunRemoveBrowsingDataFunctionAndCompareOriginSetMask( | 338 RunBrowsingDataRemoveFunctionAndCompareOriginSetMask( |
| 339 "{\"unprotectedWeb\": true, \"extension\": true}", | 339 "{\"unprotectedWeb\": true, \"extension\": true}", |
| 340 UNPROTECTED_WEB | EXTENSION); | 340 UNPROTECTED_WEB | EXTENSION); |
| 341 RunRemoveBrowsingDataFunctionAndCompareOriginSetMask( | 341 RunBrowsingDataRemoveFunctionAndCompareOriginSetMask( |
| 342 "{\"protectedWeb\": true, \"extension\": true}", | 342 "{\"protectedWeb\": true, \"extension\": true}", |
| 343 PROTECTED_WEB | EXTENSION); | 343 PROTECTED_WEB | EXTENSION); |
| 344 | 344 |
| 345 RunRemoveBrowsingDataFunctionAndCompareOriginSetMask( | 345 RunBrowsingDataRemoveFunctionAndCompareOriginSetMask( |
| 346 ("{\"unprotectedWeb\": true, \"protectedWeb\": true, " | 346 ("{\"unprotectedWeb\": true, \"protectedWeb\": true, " |
| 347 "\"extension\": true}"), | 347 "\"extension\": true}"), |
| 348 UNPROTECTED_WEB | PROTECTED_WEB | EXTENSION); | 348 UNPROTECTED_WEB | PROTECTED_WEB | EXTENSION); |
| 349 } | 349 } |
| 350 | 350 |
| 351 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, | 351 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, |
| 352 FLAKY_BrowsingDataRemovalMask) { | 352 FLAKY_BrowsingDataRemovalMask) { |
| 353 RunRemoveBrowsingDataWithKeyAndCompareRemovalMask( | 353 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 354 "appcache", BrowsingDataRemover::REMOVE_APPCACHE); | 354 "appcache", BrowsingDataRemover::REMOVE_APPCACHE); |
| 355 RunRemoveBrowsingDataWithKeyAndCompareRemovalMask( | 355 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 356 "cache", BrowsingDataRemover::REMOVE_CACHE); | 356 "cache", BrowsingDataRemover::REMOVE_CACHE); |
| 357 RunRemoveBrowsingDataWithKeyAndCompareRemovalMask( | 357 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 358 "cookies", BrowsingDataRemover::REMOVE_COOKIES); | 358 "cookies", BrowsingDataRemover::REMOVE_COOKIES); |
| 359 RunRemoveBrowsingDataWithKeyAndCompareRemovalMask( | 359 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 360 "downloads", BrowsingDataRemover::REMOVE_DOWNLOADS); | 360 "downloads", BrowsingDataRemover::REMOVE_DOWNLOADS); |
| 361 RunRemoveBrowsingDataWithKeyAndCompareRemovalMask( | 361 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 362 "fileSystems", BrowsingDataRemover::REMOVE_FILE_SYSTEMS); | 362 "fileSystems", BrowsingDataRemover::REMOVE_FILE_SYSTEMS); |
| 363 RunRemoveBrowsingDataWithKeyAndCompareRemovalMask( | 363 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 364 "formData", BrowsingDataRemover::REMOVE_FORM_DATA); | 364 "formData", BrowsingDataRemover::REMOVE_FORM_DATA); |
| 365 RunRemoveBrowsingDataWithKeyAndCompareRemovalMask( | 365 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 366 "history", BrowsingDataRemover::REMOVE_HISTORY); | 366 "history", BrowsingDataRemover::REMOVE_HISTORY); |
| 367 RunRemoveBrowsingDataWithKeyAndCompareRemovalMask( | 367 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 368 "indexedDB", BrowsingDataRemover::REMOVE_INDEXEDDB); | 368 "indexedDB", BrowsingDataRemover::REMOVE_INDEXEDDB); |
| 369 RunRemoveBrowsingDataWithKeyAndCompareRemovalMask( | 369 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 370 "localStorage", BrowsingDataRemover::REMOVE_LOCAL_STORAGE); | 370 "localStorage", BrowsingDataRemover::REMOVE_LOCAL_STORAGE); |
| 371 RunRemoveBrowsingDataWithKeyAndCompareRemovalMask( | 371 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 372 "serverBoundCertificates", | 372 "serverBoundCertificates", |
| 373 BrowsingDataRemover::REMOVE_SERVER_BOUND_CERTS); | 373 BrowsingDataRemover::REMOVE_SERVER_BOUND_CERTS); |
| 374 RunRemoveBrowsingDataWithKeyAndCompareRemovalMask( | 374 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 375 "passwords", BrowsingDataRemover::REMOVE_PASSWORDS); | 375 "passwords", BrowsingDataRemover::REMOVE_PASSWORDS); |
| 376 // We can't remove plugin data inside a test profile. | 376 // We can't remove plugin data inside a test profile. |
| 377 RunRemoveBrowsingDataWithKeyAndCompareRemovalMask( | 377 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 378 "webSQL", BrowsingDataRemover::REMOVE_WEBSQL); | 378 "webSQL", BrowsingDataRemover::REMOVE_WEBSQL); |
| 379 } | 379 } |
| 380 | 380 |
| 381 // Test an arbitrary combination of data types. | 381 // Test an arbitrary combination of data types. |
| 382 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, | 382 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, |
| 383 BrowsingDataRemovalMaskCombination) { | 383 BrowsingDataRemovalMaskCombination) { |
| 384 RunRemoveBrowsingDataFunctionAndCompareRemovalMask( | 384 RunBrowsingDataRemoveFunctionAndCompareRemovalMask( |
| 385 "{\"appcache\": true, \"cookies\": true, \"history\": true}", | 385 "{\"appcache\": true, \"cookies\": true, \"history\": true}", |
| 386 BrowsingDataRemover::REMOVE_APPCACHE | | 386 BrowsingDataRemover::REMOVE_APPCACHE | |
| 387 BrowsingDataRemover::REMOVE_COOKIES | | 387 BrowsingDataRemover::REMOVE_COOKIES | |
| 388 BrowsingDataRemover::REMOVE_HISTORY); | 388 BrowsingDataRemover::REMOVE_HISTORY); |
| 389 } | 389 } |
| 390 | 390 |
| 391 // Make sure the remove() function accepts the format produced by settings(). | 391 // Make sure the remove() function accepts the format produced by settings(). |
| 392 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, | 392 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, |
| 393 BrowsingDataRemovalInputFromSettings) { | 393 BrowsingDataRemovalInputFromSettings) { |
| 394 PrefService* prefs = browser()->profile()->GetPrefs(); | 394 PrefService* prefs = browser()->profile()->GetPrefs(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 414 | 414 |
| 415 base::DictionaryValue* result; | 415 base::DictionaryValue* result; |
| 416 EXPECT_TRUE(result_value->GetAsDictionary(&result)); | 416 EXPECT_TRUE(result_value->GetAsDictionary(&result)); |
| 417 base::DictionaryValue* data_to_remove; | 417 base::DictionaryValue* data_to_remove; |
| 418 EXPECT_TRUE(result->GetDictionary("dataToRemove", &data_to_remove)); | 418 EXPECT_TRUE(result->GetDictionary("dataToRemove", &data_to_remove)); |
| 419 | 419 |
| 420 JSONStringValueSerializer serializer(&json); | 420 JSONStringValueSerializer serializer(&json); |
| 421 EXPECT_TRUE(serializer.Serialize(*data_to_remove)); | 421 EXPECT_TRUE(serializer.Serialize(*data_to_remove)); |
| 422 } | 422 } |
| 423 { | 423 { |
| 424 scoped_refptr<RemoveBrowsingDataFunction> remove_function = | 424 scoped_refptr<BrowsingDataRemoveFunction> remove_function = |
| 425 new RemoveBrowsingDataFunction(); | 425 new BrowsingDataRemoveFunction(); |
| 426 SCOPED_TRACE("remove_json"); | 426 SCOPED_TRACE("remove_json"); |
| 427 EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult( | 427 EXPECT_EQ(NULL, RunFunctionAndReturnSingleResult( |
| 428 remove_function.get(), | 428 remove_function.get(), |
| 429 std::string("[{\"since\": 1},") + json + "]", | 429 std::string("[{\"since\": 1},") + json + "]", |
| 430 browser())); | 430 browser())); |
| 431 EXPECT_EQ(expected_mask, GetRemovalMask()); | 431 EXPECT_EQ(expected_mask, GetRemovalMask()); |
| 432 EXPECT_EQ(UNPROTECTED_WEB, GetOriginSetMask()); | 432 EXPECT_EQ(UNPROTECTED_WEB, GetOriginSetMask()); |
| 433 } | 433 } |
| 434 } | 434 } |
| 435 | 435 |
| 436 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, ShortcutFunctionRemovalMask) { | 436 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, ShortcutFunctionRemovalMask) { |
| 437 RunAndCompareRemovalMask<RemoveAppCacheFunction>( | 437 RunAndCompareRemovalMask<BrowsingDataRemoveAppcacheFunction>( |
| 438 BrowsingDataRemover::REMOVE_APPCACHE); | 438 BrowsingDataRemover::REMOVE_APPCACHE); |
| 439 RunAndCompareRemovalMask<RemoveCacheFunction>( | 439 RunAndCompareRemovalMask<BrowsingDataRemoveCacheFunction>( |
| 440 BrowsingDataRemover::REMOVE_CACHE); | 440 BrowsingDataRemover::REMOVE_CACHE); |
| 441 RunAndCompareRemovalMask<RemoveCookiesFunction>( | 441 RunAndCompareRemovalMask<BrowsingDataRemoveCookiesFunction>( |
| 442 BrowsingDataRemover::REMOVE_COOKIES | | 442 BrowsingDataRemover::REMOVE_COOKIES | |
| 443 BrowsingDataRemover::REMOVE_SERVER_BOUND_CERTS); | 443 BrowsingDataRemover::REMOVE_SERVER_BOUND_CERTS); |
| 444 RunAndCompareRemovalMask<RemoveDownloadsFunction>( | 444 RunAndCompareRemovalMask<BrowsingDataRemoveDownloadsFunction>( |
| 445 BrowsingDataRemover::REMOVE_DOWNLOADS); | 445 BrowsingDataRemover::REMOVE_DOWNLOADS); |
| 446 RunAndCompareRemovalMask<RemoveFileSystemsFunction>( | 446 RunAndCompareRemovalMask<BrowsingDataRemoveFileSystemsFunction>( |
| 447 BrowsingDataRemover::REMOVE_FILE_SYSTEMS); | 447 BrowsingDataRemover::REMOVE_FILE_SYSTEMS); |
| 448 RunAndCompareRemovalMask<RemoveFormDataFunction>( | 448 RunAndCompareRemovalMask<BrowsingDataRemoveFormDataFunction>( |
| 449 BrowsingDataRemover::REMOVE_FORM_DATA); | 449 BrowsingDataRemover::REMOVE_FORM_DATA); |
| 450 RunAndCompareRemovalMask<RemoveHistoryFunction>( | 450 RunAndCompareRemovalMask<BrowsingDataRemoveHistoryFunction>( |
| 451 BrowsingDataRemover::REMOVE_HISTORY); | 451 BrowsingDataRemover::REMOVE_HISTORY); |
| 452 RunAndCompareRemovalMask<RemoveIndexedDBFunction>( | 452 RunAndCompareRemovalMask<BrowsingDataRemoveIndexedDBFunction>( |
| 453 BrowsingDataRemover::REMOVE_INDEXEDDB); | 453 BrowsingDataRemover::REMOVE_INDEXEDDB); |
| 454 RunAndCompareRemovalMask<RemoveLocalStorageFunction>( | 454 RunAndCompareRemovalMask<BrowsingDataRemoveLocalStorageFunction>( |
| 455 BrowsingDataRemover::REMOVE_LOCAL_STORAGE); | 455 BrowsingDataRemover::REMOVE_LOCAL_STORAGE); |
| 456 // We can't remove plugin data inside a test profile. | 456 // We can't remove plugin data inside a test profile. |
| 457 RunAndCompareRemovalMask<RemovePasswordsFunction>( | 457 RunAndCompareRemovalMask<BrowsingDataRemovePasswordsFunction>( |
| 458 BrowsingDataRemover::REMOVE_PASSWORDS); | 458 BrowsingDataRemover::REMOVE_PASSWORDS); |
| 459 RunAndCompareRemovalMask<RemoveWebSQLFunction>( | 459 RunAndCompareRemovalMask<BrowsingDataRemoveWebSQLFunction>( |
| 460 BrowsingDataRemover::REMOVE_WEBSQL); | 460 BrowsingDataRemover::REMOVE_WEBSQL); |
| 461 } | 461 } |
| 462 | 462 |
| 463 // Test the processing of the 'delete since' preference. | 463 // Test the processing of the 'delete since' preference. |
| 464 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, SettingsFunctionSince) { | 464 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, SettingsFunctionSince) { |
| 465 SetSinceAndVerify(BrowsingDataRemover::EVERYTHING); | 465 SetSinceAndVerify(BrowsingDataRemover::EVERYTHING); |
| 466 SetSinceAndVerify(BrowsingDataRemover::LAST_HOUR); | 466 SetSinceAndVerify(BrowsingDataRemover::LAST_HOUR); |
| 467 SetSinceAndVerify(BrowsingDataRemover::LAST_DAY); | 467 SetSinceAndVerify(BrowsingDataRemover::LAST_DAY); |
| 468 SetSinceAndVerify(BrowsingDataRemover::LAST_WEEK); | 468 SetSinceAndVerify(BrowsingDataRemover::LAST_WEEK); |
| 469 SetSinceAndVerify(BrowsingDataRemover::FOUR_WEEKS); | 469 SetSinceAndVerify(BrowsingDataRemover::FOUR_WEEKS); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 | 518 |
| 519 SetPrefsAndVerifySettings( | 519 SetPrefsAndVerifySettings( |
| 520 BrowsingDataRemover::REMOVE_COOKIES | | 520 BrowsingDataRemover::REMOVE_COOKIES | |
| 521 BrowsingDataRemover::REMOVE_HISTORY | | 521 BrowsingDataRemover::REMOVE_HISTORY | |
| 522 BrowsingDataRemover::REMOVE_DOWNLOADS, | 522 BrowsingDataRemover::REMOVE_DOWNLOADS, |
| 523 UNPROTECTED_WEB, | 523 UNPROTECTED_WEB, |
| 524 site_data_no_plugins | | 524 site_data_no_plugins | |
| 525 BrowsingDataRemover::REMOVE_HISTORY | | 525 BrowsingDataRemover::REMOVE_HISTORY | |
| 526 BrowsingDataRemover::REMOVE_DOWNLOADS); | 526 BrowsingDataRemover::REMOVE_DOWNLOADS); |
| 527 } | 527 } |
| OLD | NEW |