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 <list> | 10 #include <list> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 #include "content/public/test/test_utils.h" | 82 #include "content/public/test/test_utils.h" |
83 #include "extensions/features/features.h" | 83 #include "extensions/features/features.h" |
84 #include "net/cookies/cookie_store.h" | 84 #include "net/cookies/cookie_store.h" |
85 #include "net/http/http_network_session.h" | 85 #include "net/http/http_network_session.h" |
86 #include "net/http/http_transaction_factory.h" | 86 #include "net/http/http_transaction_factory.h" |
87 #include "net/ssl/channel_id_service.h" | 87 #include "net/ssl/channel_id_service.h" |
88 #include "net/ssl/channel_id_store.h" | 88 #include "net/ssl/channel_id_store.h" |
89 #include "net/ssl/ssl_client_cert_type.h" | 89 #include "net/ssl/ssl_client_cert_type.h" |
90 #include "net/url_request/url_request_context.h" | 90 #include "net/url_request/url_request_context.h" |
91 #include "net/url_request/url_request_context_getter.h" | 91 #include "net/url_request/url_request_context_getter.h" |
| 92 #include "ppapi/features/features.h" |
92 #include "testing/gmock/include/gmock/gmock.h" | 93 #include "testing/gmock/include/gmock/gmock.h" |
93 #include "testing/gtest/include/gtest/gtest.h" | 94 #include "testing/gtest/include/gtest/gtest.h" |
94 #include "third_party/skia/include/core/SkBitmap.h" | 95 #include "third_party/skia/include/core/SkBitmap.h" |
95 #include "ui/gfx/favicon_size.h" | 96 #include "ui/gfx/favicon_size.h" |
96 #include "url/origin.h" | 97 #include "url/origin.h" |
97 | 98 |
98 #if BUILDFLAG(ANDROID_JAVA_UI) | 99 #if BUILDFLAG(ANDROID_JAVA_UI) |
99 #include "chrome/browser/android/webapps/webapp_registry.h" | 100 #include "chrome/browser/android/webapps/webapp_registry.h" |
100 #endif | 101 #endif |
101 | 102 |
102 #if defined(OS_CHROMEOS) | 103 #if defined(OS_CHROMEOS) |
103 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" | 104 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" |
104 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 105 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
105 #include "chrome/browser/chromeos/settings/cros_settings.h" | 106 #include "chrome/browser/chromeos/settings/cros_settings.h" |
106 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 107 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
107 #include "chromeos/dbus/dbus_thread_manager.h" | 108 #include "chromeos/dbus/dbus_thread_manager.h" |
108 #include "chromeos/dbus/mock_cryptohome_client.h" | 109 #include "chromeos/dbus/mock_cryptohome_client.h" |
109 #include "components/signin/core/account_id/account_id.h" | 110 #include "components/signin/core/account_id/account_id.h" |
110 #endif | 111 #endif |
111 | 112 |
112 #if BUILDFLAG(ENABLE_EXTENSIONS) | 113 #if BUILDFLAG(ENABLE_EXTENSIONS) |
113 #include "chrome/browser/extensions/mock_extension_special_storage_policy.h" | 114 #include "chrome/browser/extensions/mock_extension_special_storage_policy.h" |
114 #endif | 115 #endif |
115 | 116 |
116 #if defined(ENABLE_PLUGINS) | 117 #if BUILDFLAG(ENABLE_PLUGINS) |
117 #include "chrome/browser/browsing_data/mock_browsing_data_flash_lso_helper.h" | 118 #include "chrome/browser/browsing_data/mock_browsing_data_flash_lso_helper.h" |
118 #endif | 119 #endif |
119 | 120 |
120 class MockExtensionSpecialStoragePolicy; | 121 class MockExtensionSpecialStoragePolicy; |
121 | 122 |
122 using content::BrowserThread; | 123 using content::BrowserThread; |
123 using content::StoragePartition; | 124 using content::StoragePartition; |
124 using domain_reliability::CLEAR_BEACONS; | 125 using domain_reliability::CLEAR_BEACONS; |
125 using domain_reliability::CLEAR_CONTEXTS; | 126 using domain_reliability::CLEAR_CONTEXTS; |
126 using domain_reliability::DomainReliabilityClearMode; | 127 using domain_reliability::DomainReliabilityClearMode; |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 return PermissionDecisionAutoBlocker::ShouldChangeDismissalToBlock( | 1055 return PermissionDecisionAutoBlocker::ShouldChangeDismissalToBlock( |
1055 url, permission, profile_); | 1056 url, permission, profile_); |
1056 } | 1057 } |
1057 | 1058 |
1058 private: | 1059 private: |
1059 TestingProfile* profile_; | 1060 TestingProfile* profile_; |
1060 | 1061 |
1061 DISALLOW_COPY_AND_ASSIGN(RemovePermissionPromptCountsTest); | 1062 DISALLOW_COPY_AND_ASSIGN(RemovePermissionPromptCountsTest); |
1062 }; | 1063 }; |
1063 | 1064 |
1064 #if defined(ENABLE_PLUGINS) | 1065 #if BUILDFLAG(ENABLE_PLUGINS) |
1065 // A small modification to MockBrowsingDataFlashLSOHelper so that it responds | 1066 // A small modification to MockBrowsingDataFlashLSOHelper so that it responds |
1066 // immediately and does not wait for the Notify() call. Otherwise it would | 1067 // immediately and does not wait for the Notify() call. Otherwise it would |
1067 // deadlock BrowsingDataRemover::RemoveImpl. | 1068 // deadlock BrowsingDataRemover::RemoveImpl. |
1068 class TestBrowsingDataFlashLSOHelper : public MockBrowsingDataFlashLSOHelper { | 1069 class TestBrowsingDataFlashLSOHelper : public MockBrowsingDataFlashLSOHelper { |
1069 public: | 1070 public: |
1070 explicit TestBrowsingDataFlashLSOHelper(TestingProfile* profile) | 1071 explicit TestBrowsingDataFlashLSOHelper(TestingProfile* profile) |
1071 : MockBrowsingDataFlashLSOHelper(profile) {} | 1072 : MockBrowsingDataFlashLSOHelper(profile) {} |
1072 | 1073 |
1073 void StartFetching(const GetSitesWithFlashDataCallback& callback) override { | 1074 void StartFetching(const GetSitesWithFlashDataCallback& callback) override { |
1074 MockBrowsingDataFlashLSOHelper::StartFetching(callback); | 1075 MockBrowsingDataFlashLSOHelper::StartFetching(callback); |
(...skipping 1740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2815 content::PermissionType::NOTIFICATIONS)); | 2816 content::PermissionType::NOTIFICATIONS)); |
2816 EXPECT_EQ(0, tester.GetDismissCount(kOrigin1, | 2817 EXPECT_EQ(0, tester.GetDismissCount(kOrigin1, |
2817 content::PermissionType::MIDI_SYSEX)); | 2818 content::PermissionType::MIDI_SYSEX)); |
2818 EXPECT_EQ(0, tester.GetIgnoreCount( | 2819 EXPECT_EQ(0, tester.GetIgnoreCount( |
2819 kOrigin2, content::PermissionType::DURABLE_STORAGE)); | 2820 kOrigin2, content::PermissionType::DURABLE_STORAGE)); |
2820 EXPECT_EQ(0, tester.GetDismissCount( | 2821 EXPECT_EQ(0, tester.GetDismissCount( |
2821 kOrigin2, content::PermissionType::NOTIFICATIONS)); | 2822 kOrigin2, content::PermissionType::NOTIFICATIONS)); |
2822 } | 2823 } |
2823 } | 2824 } |
2824 | 2825 |
2825 #if defined(ENABLE_PLUGINS) | 2826 #if BUILDFLAG(ENABLE_PLUGINS) |
2826 TEST_F(BrowsingDataRemoverTest, RemovePluginData) { | 2827 TEST_F(BrowsingDataRemoverTest, RemovePluginData) { |
2827 RemovePluginDataTester tester(GetProfile()); | 2828 RemovePluginDataTester tester(GetProfile()); |
2828 | 2829 |
2829 tester.AddDomain(kOrigin1.host()); | 2830 tester.AddDomain(kOrigin1.host()); |
2830 tester.AddDomain(kOrigin2.host()); | 2831 tester.AddDomain(kOrigin2.host()); |
2831 tester.AddDomain(kOrigin3.host()); | 2832 tester.AddDomain(kOrigin3.host()); |
2832 | 2833 |
2833 std::vector<std::string> expected = { | 2834 std::vector<std::string> expected = { |
2834 kOrigin1.host(), kOrigin2.host(), kOrigin3.host() }; | 2835 kOrigin1.host(), kOrigin2.host(), kOrigin3.host() }; |
2835 EXPECT_EQ(expected, tester.GetDomains()); | 2836 EXPECT_EQ(expected, tester.GetDomains()); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3036 EXPECT_TRUE(remover->is_removing()); | 3037 EXPECT_TRUE(remover->is_removing()); |
3037 | 3038 |
3038 // Add one more deletion and wait for it. | 3039 // Add one more deletion and wait for it. |
3039 BlockUntilBrowsingDataRemoved( | 3040 BlockUntilBrowsingDataRemoved( |
3040 browsing_data::ALL_TIME, | 3041 browsing_data::ALL_TIME, |
3041 BrowsingDataRemover::REMOVE_COOKIES, | 3042 BrowsingDataRemover::REMOVE_COOKIES, |
3042 BrowsingDataHelper::UNPROTECTED_WEB); | 3043 BrowsingDataHelper::UNPROTECTED_WEB); |
3043 | 3044 |
3044 EXPECT_FALSE(remover->is_removing()); | 3045 EXPECT_FALSE(remover->is_removing()); |
3045 } | 3046 } |
OLD | NEW |