| 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 <memory> | 5 #include <memory> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/strings/pattern.h" | 10 #include "base/strings/pattern.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 GetAsMask(origin_types, "extension", EXTENSION); | 202 GetAsMask(origin_types, "extension", EXTENSION); |
| 203 EXPECT_EQ(expected_origin_type_mask, origin_type_mask); | 203 EXPECT_EQ(expected_origin_type_mask, origin_type_mask); |
| 204 | 204 |
| 205 base::DictionaryValue* data_to_remove; | 205 base::DictionaryValue* data_to_remove; |
| 206 EXPECT_TRUE(result->GetDictionary("dataToRemove", &data_to_remove)); | 206 EXPECT_TRUE(result->GetDictionary("dataToRemove", &data_to_remove)); |
| 207 int removal_mask = | 207 int removal_mask = |
| 208 GetAsMask(data_to_remove, "appcache", | 208 GetAsMask(data_to_remove, "appcache", |
| 209 BrowsingDataRemover::REMOVE_APPCACHE) | | 209 BrowsingDataRemover::REMOVE_APPCACHE) | |
| 210 GetAsMask(data_to_remove, "cache", BrowsingDataRemover::REMOVE_CACHE) | | 210 GetAsMask(data_to_remove, "cache", BrowsingDataRemover::REMOVE_CACHE) | |
| 211 GetAsMask(data_to_remove, "cookies", | 211 GetAsMask(data_to_remove, "cookies", |
| 212 BrowsingDataRemover::REMOVE_COOKIES | | 212 BrowsingDataRemover::REMOVE_COOKIES) | |
| 213 BrowsingDataRemover::REMOVE_WEBRTC_IDENTITY) | | |
| 214 GetAsMask(data_to_remove, "downloads", | 213 GetAsMask(data_to_remove, "downloads", |
| 215 BrowsingDataRemover::REMOVE_DOWNLOADS) | | 214 BrowsingDataRemover::REMOVE_DOWNLOADS) | |
| 216 GetAsMask(data_to_remove, "fileSystems", | 215 GetAsMask(data_to_remove, "fileSystems", |
| 217 BrowsingDataRemover::REMOVE_FILE_SYSTEMS) | | 216 BrowsingDataRemover::REMOVE_FILE_SYSTEMS) | |
| 218 GetAsMask(data_to_remove, "formData", | 217 GetAsMask(data_to_remove, "formData", |
| 219 BrowsingDataRemover::REMOVE_FORM_DATA) | | 218 BrowsingDataRemover::REMOVE_FORM_DATA) | |
| 220 GetAsMask(data_to_remove, "history", | 219 GetAsMask(data_to_remove, "history", |
| 221 BrowsingDataRemover::REMOVE_HISTORY) | | 220 BrowsingDataRemover::REMOVE_HISTORY) | |
| 222 GetAsMask(data_to_remove, "indexedDB", | 221 GetAsMask(data_to_remove, "indexedDB", |
| 223 BrowsingDataRemover::REMOVE_INDEXEDDB) | | 222 BrowsingDataRemover::REMOVE_INDEXEDDB) | |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 UNPROTECTED_WEB | PROTECTED_WEB | EXTENSION); | 357 UNPROTECTED_WEB | PROTECTED_WEB | EXTENSION); |
| 359 } | 358 } |
| 360 | 359 |
| 361 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, | 360 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, |
| 362 BrowsingDataRemovalMask) { | 361 BrowsingDataRemovalMask) { |
| 363 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( | 362 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 364 "appcache", BrowsingDataRemover::REMOVE_APPCACHE); | 363 "appcache", BrowsingDataRemover::REMOVE_APPCACHE); |
| 365 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( | 364 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 366 "cache", BrowsingDataRemover::REMOVE_CACHE); | 365 "cache", BrowsingDataRemover::REMOVE_CACHE); |
| 367 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( | 366 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 368 "cookies", BrowsingDataRemover::REMOVE_COOKIES | | 367 "cookies", BrowsingDataRemover::REMOVE_COOKIES); |
| 369 BrowsingDataRemover::REMOVE_WEBRTC_IDENTITY); | |
| 370 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( | 368 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 371 "downloads", BrowsingDataRemover::REMOVE_DOWNLOADS); | 369 "downloads", BrowsingDataRemover::REMOVE_DOWNLOADS); |
| 372 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( | 370 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 373 "fileSystems", BrowsingDataRemover::REMOVE_FILE_SYSTEMS); | 371 "fileSystems", BrowsingDataRemover::REMOVE_FILE_SYSTEMS); |
| 374 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( | 372 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 375 "formData", BrowsingDataRemover::REMOVE_FORM_DATA); | 373 "formData", BrowsingDataRemover::REMOVE_FORM_DATA); |
| 376 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( | 374 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 377 "history", BrowsingDataRemover::REMOVE_HISTORY); | 375 "history", BrowsingDataRemover::REMOVE_HISTORY); |
| 378 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( | 376 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
| 379 "indexedDB", BrowsingDataRemover::REMOVE_INDEXEDDB); | 377 "indexedDB", BrowsingDataRemover::REMOVE_INDEXEDDB); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 393 "webSQL", BrowsingDataRemover::REMOVE_WEBSQL); | 391 "webSQL", BrowsingDataRemover::REMOVE_WEBSQL); |
| 394 } | 392 } |
| 395 | 393 |
| 396 // Test an arbitrary combination of data types. | 394 // Test an arbitrary combination of data types. |
| 397 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, | 395 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, |
| 398 BrowsingDataRemovalMaskCombination) { | 396 BrowsingDataRemovalMaskCombination) { |
| 399 RunBrowsingDataRemoveFunctionAndCompareRemovalMask( | 397 RunBrowsingDataRemoveFunctionAndCompareRemovalMask( |
| 400 "{\"appcache\": true, \"cookies\": true, \"history\": true}", | 398 "{\"appcache\": true, \"cookies\": true, \"history\": true}", |
| 401 BrowsingDataRemover::REMOVE_APPCACHE | | 399 BrowsingDataRemover::REMOVE_APPCACHE | |
| 402 BrowsingDataRemover::REMOVE_COOKIES | | 400 BrowsingDataRemover::REMOVE_COOKIES | |
| 403 BrowsingDataRemover::REMOVE_WEBRTC_IDENTITY | | |
| 404 BrowsingDataRemover::REMOVE_HISTORY); | 401 BrowsingDataRemover::REMOVE_HISTORY); |
| 405 } | 402 } |
| 406 | 403 |
| 407 // Make sure the remove() function accepts the format produced by settings(). | 404 // Make sure the remove() function accepts the format produced by settings(). |
| 408 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, | 405 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, |
| 409 BrowsingDataRemovalInputFromSettings) { | 406 BrowsingDataRemovalInputFromSettings) { |
| 410 PrefService* prefs = browser()->profile()->GetPrefs(); | 407 PrefService* prefs = browser()->profile()->GetPrefs(); |
| 411 prefs->SetBoolean(prefs::kDeleteCache, true); | 408 prefs->SetBoolean(prefs::kDeleteCache, true); |
| 412 prefs->SetBoolean(prefs::kDeleteBrowsingHistory, true); | 409 prefs->SetBoolean(prefs::kDeleteBrowsingHistory, true); |
| 413 prefs->SetBoolean(prefs::kDeleteDownloadHistory, true); | 410 prefs->SetBoolean(prefs::kDeleteDownloadHistory, true); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 } | 446 } |
| 450 } | 447 } |
| 451 | 448 |
| 452 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, ShortcutFunctionRemovalMask) { | 449 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, ShortcutFunctionRemovalMask) { |
| 453 RunAndCompareRemovalMask<BrowsingDataRemoveAppcacheFunction>( | 450 RunAndCompareRemovalMask<BrowsingDataRemoveAppcacheFunction>( |
| 454 BrowsingDataRemover::REMOVE_APPCACHE); | 451 BrowsingDataRemover::REMOVE_APPCACHE); |
| 455 RunAndCompareRemovalMask<BrowsingDataRemoveCacheFunction>( | 452 RunAndCompareRemovalMask<BrowsingDataRemoveCacheFunction>( |
| 456 BrowsingDataRemover::REMOVE_CACHE); | 453 BrowsingDataRemover::REMOVE_CACHE); |
| 457 RunAndCompareRemovalMask<BrowsingDataRemoveCookiesFunction>( | 454 RunAndCompareRemovalMask<BrowsingDataRemoveCookiesFunction>( |
| 458 BrowsingDataRemover::REMOVE_COOKIES | | 455 BrowsingDataRemover::REMOVE_COOKIES | |
| 459 BrowsingDataRemover::REMOVE_CHANNEL_IDS | | 456 BrowsingDataRemover::REMOVE_CHANNEL_IDS); |
| 460 BrowsingDataRemover::REMOVE_WEBRTC_IDENTITY); | |
| 461 RunAndCompareRemovalMask<BrowsingDataRemoveDownloadsFunction>( | 457 RunAndCompareRemovalMask<BrowsingDataRemoveDownloadsFunction>( |
| 462 BrowsingDataRemover::REMOVE_DOWNLOADS); | 458 BrowsingDataRemover::REMOVE_DOWNLOADS); |
| 463 RunAndCompareRemovalMask<BrowsingDataRemoveFileSystemsFunction>( | 459 RunAndCompareRemovalMask<BrowsingDataRemoveFileSystemsFunction>( |
| 464 BrowsingDataRemover::REMOVE_FILE_SYSTEMS); | 460 BrowsingDataRemover::REMOVE_FILE_SYSTEMS); |
| 465 RunAndCompareRemovalMask<BrowsingDataRemoveFormDataFunction>( | 461 RunAndCompareRemovalMask<BrowsingDataRemoveFormDataFunction>( |
| 466 BrowsingDataRemover::REMOVE_FORM_DATA); | 462 BrowsingDataRemover::REMOVE_FORM_DATA); |
| 467 RunAndCompareRemovalMask<BrowsingDataRemoveHistoryFunction>( | 463 RunAndCompareRemovalMask<BrowsingDataRemoveHistoryFunction>( |
| 468 BrowsingDataRemover::REMOVE_HISTORY); | 464 BrowsingDataRemover::REMOVE_HISTORY); |
| 469 RunAndCompareRemovalMask<BrowsingDataRemoveIndexedDBFunction>( | 465 RunAndCompareRemovalMask<BrowsingDataRemoveIndexedDBFunction>( |
| 470 BrowsingDataRemover::REMOVE_INDEXEDDB); | 466 BrowsingDataRemover::REMOVE_INDEXEDDB); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 | 536 |
| 541 SetPrefsAndVerifySettings( | 537 SetPrefsAndVerifySettings( |
| 542 BrowsingDataRemover::REMOVE_COOKIES | | 538 BrowsingDataRemover::REMOVE_COOKIES | |
| 543 BrowsingDataRemover::REMOVE_HISTORY | | 539 BrowsingDataRemover::REMOVE_HISTORY | |
| 544 BrowsingDataRemover::REMOVE_DOWNLOADS, | 540 BrowsingDataRemover::REMOVE_DOWNLOADS, |
| 545 UNPROTECTED_WEB, | 541 UNPROTECTED_WEB, |
| 546 site_data_no_plugins | | 542 site_data_no_plugins | |
| 547 BrowsingDataRemover::REMOVE_HISTORY | | 543 BrowsingDataRemover::REMOVE_HISTORY | |
| 548 BrowsingDataRemover::REMOVE_DOWNLOADS); | 544 BrowsingDataRemover::REMOVE_DOWNLOADS); |
| 549 } | 545 } |
| OLD | NEW |