| 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 "chrome/browser/browsing_data/browsing_data_remover.h" | 5 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 #include "net/ssl/channel_id_store.h" | 69 #include "net/ssl/channel_id_store.h" |
| 70 #include "net/ssl/ssl_client_cert_type.h" | 70 #include "net/ssl/ssl_client_cert_type.h" |
| 71 #include "net/url_request/url_request_context.h" | 71 #include "net/url_request/url_request_context.h" |
| 72 #include "net/url_request/url_request_context_getter.h" | 72 #include "net/url_request/url_request_context_getter.h" |
| 73 #include "testing/gmock/include/gmock/gmock.h" | 73 #include "testing/gmock/include/gmock/gmock.h" |
| 74 #include "testing/gtest/include/gtest/gtest.h" | 74 #include "testing/gtest/include/gtest/gtest.h" |
| 75 #include "third_party/skia/include/core/SkBitmap.h" | 75 #include "third_party/skia/include/core/SkBitmap.h" |
| 76 #include "ui/gfx/favicon_size.h" | 76 #include "ui/gfx/favicon_size.h" |
| 77 #include "url/origin.h" | 77 #include "url/origin.h" |
| 78 | 78 |
| 79 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 80 #include "chrome/browser/android/webapps/webapp_registry.h" |
| 81 #endif |
| 82 |
| 79 #if defined(OS_CHROMEOS) | 83 #if defined(OS_CHROMEOS) |
| 80 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" | 84 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" |
| 81 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 85 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 82 #include "chrome/browser/chromeos/settings/cros_settings.h" | 86 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 83 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 87 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 84 #include "chromeos/dbus/dbus_thread_manager.h" | 88 #include "chromeos/dbus/dbus_thread_manager.h" |
| 85 #include "chromeos/dbus/mock_cryptohome_client.h" | 89 #include "chromeos/dbus/mock_cryptohome_client.h" |
| 86 #include "components/signin/core/account_id/account_id.h" | 90 #include "components/signin/core/account_id/account_id.h" |
| 87 #endif | 91 #endif |
| 88 | 92 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 private: | 257 private: |
| 254 void AsyncRunCallback(const base::Closure& callback) { | 258 void AsyncRunCallback(const base::Closure& callback) { |
| 255 callback.Run(); | 259 callback.Run(); |
| 256 } | 260 } |
| 257 | 261 |
| 258 StoragePartitionRemovalData storage_partition_removal_data_; | 262 StoragePartitionRemovalData storage_partition_removal_data_; |
| 259 | 263 |
| 260 DISALLOW_COPY_AND_ASSIGN(TestStoragePartition); | 264 DISALLOW_COPY_AND_ASSIGN(TestStoragePartition); |
| 261 }; | 265 }; |
| 262 | 266 |
| 267 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 268 class TestWebappRegistry : public WebappRegistry { |
| 269 public: |
| 270 TestWebappRegistry() : WebappRegistry() { } |
| 271 |
| 272 void UnregisterWebapps(const base::Closure& callback) override { |
| 273 // Mocks out a JNI call and runs the callback as a delayed task. |
| 274 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, callback, |
| 275 base::TimeDelta::FromMilliseconds(10)); |
| 276 } |
| 277 }; |
| 278 #endif |
| 279 |
| 263 // Custom matcher to test the equivalence of two URL filters. Since those are | 280 // Custom matcher to test the equivalence of two URL filters. Since those are |
| 264 // blackbox predicates, we can only approximate the equivalence by testing | 281 // blackbox predicates, we can only approximate the equivalence by testing |
| 265 // whether the filter give the same answer for several URLs. This is currently | 282 // whether the filter give the same answer for several URLs. This is currently |
| 266 // good enough for our testing purposes, to distinguish whitelists | 283 // good enough for our testing purposes, to distinguish whitelists |
| 267 // and blacklists, empty and non-empty filters and such. | 284 // and blacklists, empty and non-empty filters and such. |
| 268 // TODO(msramek): BrowsingDataRemover and some of its backends support URL | 285 // TODO(msramek): BrowsingDataRemover and some of its backends support URL |
| 269 // filters, but its constructor currently only takes a single URL and constructs | 286 // filters, but its constructor currently only takes a single URL and constructs |
| 270 // its own url filter. If an url filter was directly passed to | 287 // its own url filter. If an url filter was directly passed to |
| 271 // BrowsingDataRemover (what should eventually be the case), we can use the same | 288 // BrowsingDataRemover (what should eventually be the case), we can use the same |
| 272 // instance in the test as well, and thus simply test base::Callback::Equals() | 289 // instance in the test as well, and thus simply test base::Callback::Equals() |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 | 952 |
| 936 class BrowsingDataRemoverTest : public testing::Test { | 953 class BrowsingDataRemoverTest : public testing::Test { |
| 937 public: | 954 public: |
| 938 BrowsingDataRemoverTest() | 955 BrowsingDataRemoverTest() |
| 939 : profile_(new TestingProfile()), | 956 : profile_(new TestingProfile()), |
| 940 clear_domain_reliability_tester_(GetProfile()) { | 957 clear_domain_reliability_tester_(GetProfile()) { |
| 941 callback_subscription_ = | 958 callback_subscription_ = |
| 942 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( | 959 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( |
| 943 base::Bind(&BrowsingDataRemoverTest::NotifyWithDetails, | 960 base::Bind(&BrowsingDataRemoverTest::NotifyWithDetails, |
| 944 base::Unretained(this))); | 961 base::Unretained(this))); |
| 962 |
| 963 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 964 BrowsingDataRemover* remover = |
| 965 BrowsingDataRemoverFactory::GetForBrowserContext(profile_.get()); |
| 966 remover->OverrideWebappRegistryForTesting( |
| 967 scoped_ptr<WebappRegistry>(new TestWebappRegistry())); |
| 968 #endif |
| 945 } | 969 } |
| 946 | 970 |
| 947 ~BrowsingDataRemoverTest() override {} | 971 ~BrowsingDataRemoverTest() override {} |
| 948 | 972 |
| 949 void TearDown() override { | 973 void TearDown() override { |
| 950 #if defined(ENABLE_EXTENSIONS) | 974 #if defined(ENABLE_EXTENSIONS) |
| 951 mock_policy_ = nullptr; | 975 mock_policy_ = nullptr; |
| 952 #endif | 976 #endif |
| 953 | 977 |
| 954 // TestingProfile contains a DOMStorageContext. BrowserContext's destructor | 978 // TestingProfile contains a DOMStorageContext. BrowserContext's destructor |
| (...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2276 EXPECT_CALL(*tester.store(), RemoveLoginsByURLAndTimeImpl(_, _, _)) | 2300 EXPECT_CALL(*tester.store(), RemoveLoginsByURLAndTimeImpl(_, _, _)) |
| 2277 .WillOnce(Return(password_manager::PasswordStoreChangeList())); | 2301 .WillOnce(Return(password_manager::PasswordStoreChangeList())); |
| 2278 EXPECT_CALL(*tester.store(), DisableAutoSignInForAllLoginsImpl()) | 2302 EXPECT_CALL(*tester.store(), DisableAutoSignInForAllLoginsImpl()) |
| 2279 .WillOnce(Return(password_manager::PasswordStoreChangeList())); | 2303 .WillOnce(Return(password_manager::PasswordStoreChangeList())); |
| 2280 | 2304 |
| 2281 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, | 2305 BlockUntilBrowsingDataRemoved(BrowsingDataRemover::EVERYTHING, |
| 2282 BrowsingDataRemover::REMOVE_COOKIES | | 2306 BrowsingDataRemover::REMOVE_COOKIES | |
| 2283 BrowsingDataRemover::REMOVE_PASSWORDS, | 2307 BrowsingDataRemover::REMOVE_PASSWORDS, |
| 2284 false); | 2308 false); |
| 2285 } | 2309 } |
| OLD | NEW |