| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 | 245 |
| 246 private: | 246 private: |
| 247 // Cached pointer to BrowsingDataRemover for access to testing methods. | 247 // Cached pointer to BrowsingDataRemover for access to testing methods. |
| 248 BrowsingDataRemover* remover_; | 248 BrowsingDataRemover* remover_; |
| 249 }; | 249 }; |
| 250 | 250 |
| 251 } // namespace | 251 } // namespace |
| 252 | 252 |
| 253 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, OneAtATime) { | |
| 254 BrowsingDataRemover* browsing_data_remover = | |
| 255 BrowsingDataRemoverFactory::GetForBrowserContext(browser()->profile()); | |
| 256 browsing_data_remover->SetRemoving(true); | |
| 257 scoped_refptr<BrowsingDataRemoveFunction> function = | |
| 258 new BrowsingDataRemoveFunction(); | |
| 259 EXPECT_TRUE(base::MatchPattern( | |
| 260 RunFunctionAndReturnError(function.get(), kRemoveEverythingArguments, | |
| 261 browser()), | |
| 262 extension_browsing_data_api_constants::kOneAtATimeError)); | |
| 263 browsing_data_remover->SetRemoving(false); | |
| 264 | |
| 265 EXPECT_EQ(base::Time(), GetBeginTime()); | |
| 266 EXPECT_EQ(-1, GetRemovalMask()); | |
| 267 } | |
| 268 | |
| 269 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, RemovalProhibited) { | 253 IN_PROC_BROWSER_TEST_F(ExtensionBrowsingDataTest, RemovalProhibited) { |
| 270 PrefService* prefs = browser()->profile()->GetPrefs(); | 254 PrefService* prefs = browser()->profile()->GetPrefs(); |
| 271 prefs->SetBoolean(prefs::kAllowDeletingBrowserHistory, false); | 255 prefs->SetBoolean(prefs::kAllowDeletingBrowserHistory, false); |
| 272 | 256 |
| 273 CheckRemovalPermitted("{\"appcache\": true}", true); | 257 CheckRemovalPermitted("{\"appcache\": true}", true); |
| 274 CheckRemovalPermitted("{\"cache\": true}", true); | 258 CheckRemovalPermitted("{\"cache\": true}", true); |
| 275 CheckRemovalPermitted("{\"cookies\": true}", true); | 259 CheckRemovalPermitted("{\"cookies\": true}", true); |
| 276 CheckRemovalPermitted("{\"downloads\": true}", false); | 260 CheckRemovalPermitted("{\"downloads\": true}", false); |
| 277 CheckRemovalPermitted("{\"fileSystems\": true}", true); | 261 CheckRemovalPermitted("{\"fileSystems\": true}", true); |
| 278 CheckRemovalPermitted("{\"formData\": true}", true); | 262 CheckRemovalPermitted("{\"formData\": true}", true); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 | 514 |
| 531 SetPrefsAndVerifySettings( | 515 SetPrefsAndVerifySettings( |
| 532 BrowsingDataRemover::REMOVE_COOKIES | | 516 BrowsingDataRemover::REMOVE_COOKIES | |
| 533 BrowsingDataRemover::REMOVE_HISTORY | | 517 BrowsingDataRemover::REMOVE_HISTORY | |
| 534 BrowsingDataRemover::REMOVE_DOWNLOADS, | 518 BrowsingDataRemover::REMOVE_DOWNLOADS, |
| 535 UNPROTECTED_WEB, | 519 UNPROTECTED_WEB, |
| 536 site_data_no_plugins_durable_usage | | 520 site_data_no_plugins_durable_usage | |
| 537 BrowsingDataRemover::REMOVE_HISTORY | | 521 BrowsingDataRemover::REMOVE_HISTORY | |
| 538 BrowsingDataRemover::REMOVE_DOWNLOADS); | 522 BrowsingDataRemover::REMOVE_DOWNLOADS); |
| 539 } | 523 } |
| OLD | NEW |