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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 BrowsingDataRemover::REMOVE_INDEXEDDB) | | 224 BrowsingDataRemover::REMOVE_INDEXEDDB) | |
225 GetAsMask(data_to_remove, "localStorage", | 225 GetAsMask(data_to_remove, "localStorage", |
226 BrowsingDataRemover::REMOVE_LOCAL_STORAGE) | | 226 BrowsingDataRemover::REMOVE_LOCAL_STORAGE) | |
227 GetAsMask(data_to_remove, "pluginData", | 227 GetAsMask(data_to_remove, "pluginData", |
228 BrowsingDataRemover::REMOVE_PLUGIN_DATA) | | 228 BrowsingDataRemover::REMOVE_PLUGIN_DATA) | |
229 GetAsMask(data_to_remove, "passwords", | 229 GetAsMask(data_to_remove, "passwords", |
230 BrowsingDataRemover::REMOVE_PASSWORDS) | | 230 BrowsingDataRemover::REMOVE_PASSWORDS) | |
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_CHANNEL_IDS); |
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<BrowsingDataRemoveFunction> function = | 241 scoped_refptr<BrowsingDataRemoveFunction> function = |
242 new BrowsingDataRemoveFunction(); | 242 new BrowsingDataRemoveFunction(); |
243 std::string args = "[{\"since\": 1}," + data_types + "]"; | 243 std::string args = "[{\"since\": 1}," + data_types + "]"; |
244 | 244 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( | 363 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
364 "formData", BrowsingDataRemover::REMOVE_FORM_DATA); | 364 "formData", BrowsingDataRemover::REMOVE_FORM_DATA); |
365 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( | 365 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
366 "history", BrowsingDataRemover::REMOVE_HISTORY); | 366 "history", BrowsingDataRemover::REMOVE_HISTORY); |
367 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( | 367 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
368 "indexedDB", BrowsingDataRemover::REMOVE_INDEXEDDB); | 368 "indexedDB", BrowsingDataRemover::REMOVE_INDEXEDDB); |
369 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( | 369 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
370 "localStorage", BrowsingDataRemover::REMOVE_LOCAL_STORAGE); | 370 "localStorage", BrowsingDataRemover::REMOVE_LOCAL_STORAGE); |
371 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( | 371 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( |
372 "serverBoundCertificates", | 372 "serverBoundCertificates", |
373 BrowsingDataRemover::REMOVE_SERVER_BOUND_CERTS); | 373 BrowsingDataRemover::REMOVE_CHANNEL_IDS); |
374 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( | 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 RunBrowsingDataRemoveWithKeyAndCompareRemovalMask( | 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) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 } | 433 } |
434 } | 434 } |
435 | 435 |
436 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, ShortcutFunctionRemovalMask) { | 436 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, ShortcutFunctionRemovalMask) { |
437 RunAndCompareRemovalMask<BrowsingDataRemoveAppcacheFunction>( | 437 RunAndCompareRemovalMask<BrowsingDataRemoveAppcacheFunction>( |
438 BrowsingDataRemover::REMOVE_APPCACHE); | 438 BrowsingDataRemover::REMOVE_APPCACHE); |
439 RunAndCompareRemovalMask<BrowsingDataRemoveCacheFunction>( | 439 RunAndCompareRemovalMask<BrowsingDataRemoveCacheFunction>( |
440 BrowsingDataRemover::REMOVE_CACHE); | 440 BrowsingDataRemover::REMOVE_CACHE); |
441 RunAndCompareRemovalMask<BrowsingDataRemoveCookiesFunction>( | 441 RunAndCompareRemovalMask<BrowsingDataRemoveCookiesFunction>( |
442 BrowsingDataRemover::REMOVE_COOKIES | | 442 BrowsingDataRemover::REMOVE_COOKIES | |
443 BrowsingDataRemover::REMOVE_SERVER_BOUND_CERTS); | 443 BrowsingDataRemover::REMOVE_CHANNEL_IDS); |
444 RunAndCompareRemovalMask<BrowsingDataRemoveDownloadsFunction>( | 444 RunAndCompareRemovalMask<BrowsingDataRemoveDownloadsFunction>( |
445 BrowsingDataRemover::REMOVE_DOWNLOADS); | 445 BrowsingDataRemover::REMOVE_DOWNLOADS); |
446 RunAndCompareRemovalMask<BrowsingDataRemoveFileSystemsFunction>( | 446 RunAndCompareRemovalMask<BrowsingDataRemoveFileSystemsFunction>( |
447 BrowsingDataRemover::REMOVE_FILE_SYSTEMS); | 447 BrowsingDataRemover::REMOVE_FILE_SYSTEMS); |
448 RunAndCompareRemovalMask<BrowsingDataRemoveFormDataFunction>( | 448 RunAndCompareRemovalMask<BrowsingDataRemoveFormDataFunction>( |
449 BrowsingDataRemover::REMOVE_FORM_DATA); | 449 BrowsingDataRemover::REMOVE_FORM_DATA); |
450 RunAndCompareRemovalMask<BrowsingDataRemoveHistoryFunction>( | 450 RunAndCompareRemovalMask<BrowsingDataRemoveHistoryFunction>( |
451 BrowsingDataRemover::REMOVE_HISTORY); | 451 BrowsingDataRemover::REMOVE_HISTORY); |
452 RunAndCompareRemovalMask<BrowsingDataRemoveIndexedDBFunction>( | 452 RunAndCompareRemovalMask<BrowsingDataRemoveIndexedDBFunction>( |
453 BrowsingDataRemover::REMOVE_INDEXEDDB); | 453 BrowsingDataRemover::REMOVE_INDEXEDDB); |
(...skipping 64 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 |