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 <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "net/url_request/url_request_context_getter.h" | 52 #include "net/url_request/url_request_context_getter.h" |
53 #include "testing/gmock/include/gmock/gmock.h" | 53 #include "testing/gmock/include/gmock/gmock.h" |
54 #include "testing/gtest/include/gtest/gtest.h" | 54 #include "testing/gtest/include/gtest/gtest.h" |
55 | 55 |
56 #if defined(OS_CHROMEOS) | 56 #if defined(OS_CHROMEOS) |
57 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" | 57 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" |
58 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 58 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
59 #include "chrome/browser/chromeos/settings/cros_settings.h" | 59 #include "chrome/browser/chromeos/settings/cros_settings.h" |
60 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 60 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
61 #include "chromeos/dbus/dbus_thread_manager.h" | 61 #include "chromeos/dbus/dbus_thread_manager.h" |
62 #include "chromeos/dbus/fake_dbus_thread_manager.h" | |
63 #include "chromeos/dbus/mock_cryptohome_client.h" | 62 #include "chromeos/dbus/mock_cryptohome_client.h" |
64 #endif | 63 #endif |
65 | 64 |
66 #if defined(ENABLE_EXTENSIONS) | 65 #if defined(ENABLE_EXTENSIONS) |
67 #include "chrome/browser/extensions/mock_extension_special_storage_policy.h" | 66 #include "chrome/browser/extensions/mock_extension_special_storage_policy.h" |
68 #endif | 67 #endif |
69 | 68 |
70 class MockExtensionSpecialStoragePolicy; | 69 class MockExtensionSpecialStoragePolicy; |
71 | 70 |
72 using content::BrowserThread; | 71 using content::BrowserThread; |
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1756 | 1755 |
1757 #if defined(OS_CHROMEOS) | 1756 #if defined(OS_CHROMEOS) |
1758 TEST_F(BrowsingDataRemoverTest, ContentProtectionPlatformKeysRemoval) { | 1757 TEST_F(BrowsingDataRemoverTest, ContentProtectionPlatformKeysRemoval) { |
1759 chromeos::ScopedTestDeviceSettingsService test_device_settings_service; | 1758 chromeos::ScopedTestDeviceSettingsService test_device_settings_service; |
1760 chromeos::ScopedTestCrosSettings test_cros_settings; | 1759 chromeos::ScopedTestCrosSettings test_cros_settings; |
1761 chromeos::MockUserManager* mock_user_manager = | 1760 chromeos::MockUserManager* mock_user_manager = |
1762 new testing::NiceMock<chromeos::MockUserManager>(); | 1761 new testing::NiceMock<chromeos::MockUserManager>(); |
1763 mock_user_manager->SetActiveUser("test@example.com"); | 1762 mock_user_manager->SetActiveUser("test@example.com"); |
1764 chromeos::ScopedUserManagerEnabler user_manager_enabler(mock_user_manager); | 1763 chromeos::ScopedUserManagerEnabler user_manager_enabler(mock_user_manager); |
1765 | 1764 |
1766 chromeos::FakeDBusThreadManager* fake_dbus_manager = | 1765 scoped_ptr<chromeos::DBusThreadManagerTestHelper> dbus_helper = |
1767 new chromeos::FakeDBusThreadManager; | 1766 chromeos::DBusThreadManager::GetDBusThreadManagerTestHelper(); |
1768 chromeos::MockCryptohomeClient* cryptohome_client = | 1767 chromeos::MockCryptohomeClient* cryptohome_client = |
1769 new chromeos::MockCryptohomeClient; | 1768 new chromeos::MockCryptohomeClient; |
1770 fake_dbus_manager->SetCryptohomeClient( | 1769 dbus_helper->SetCryptohomeClient( |
1771 scoped_ptr<chromeos::CryptohomeClient>(cryptohome_client)); | 1770 scoped_ptr<chromeos::CryptohomeClient>(cryptohome_client)); |
1772 chromeos::DBusThreadManager::InitializeForTesting(fake_dbus_manager); | |
1773 | 1771 |
1774 // Expect exactly one call. No calls means no attempt to delete keys and more | 1772 // Expect exactly one call. No calls means no attempt to delete keys and more |
1775 // than one call means a significant performance problem. | 1773 // than one call means a significant performance problem. |
1776 EXPECT_CALL(*cryptohome_client, TpmAttestationDeleteKeys(_, _, _, _)) | 1774 EXPECT_CALL(*cryptohome_client, TpmAttestationDeleteKeys(_, _, _, _)) |
1777 .WillOnce(WithArgs<3>(Invoke(FakeDBusCall))); | 1775 .WillOnce(WithArgs<3>(Invoke(FakeDBusCall))); |
1778 | 1776 |
1779 BlockUntilBrowsingDataRemoved( | 1777 BlockUntilBrowsingDataRemoved( |
1780 BrowsingDataRemover::EVERYTHING, | 1778 BrowsingDataRemover::EVERYTHING, |
1781 BrowsingDataRemover::REMOVE_CONTENT_LICENSES, false); | 1779 BrowsingDataRemover::REMOVE_CONTENT_LICENSES, false); |
1782 | 1780 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1830 EXPECT_EQ(1u, tester.clear_count()); | 1828 EXPECT_EQ(1u, tester.clear_count()); |
1831 EXPECT_EQ(CLEAR_CONTEXTS, tester.last_clear_mode()); | 1829 EXPECT_EQ(CLEAR_CONTEXTS, tester.last_clear_mode()); |
1832 } | 1830 } |
1833 | 1831 |
1834 TEST_F(BrowsingDataRemoverTest, DomainReliability_NoMonitor) { | 1832 TEST_F(BrowsingDataRemoverTest, DomainReliability_NoMonitor) { |
1835 BlockUntilBrowsingDataRemoved( | 1833 BlockUntilBrowsingDataRemoved( |
1836 BrowsingDataRemover::EVERYTHING, | 1834 BrowsingDataRemover::EVERYTHING, |
1837 BrowsingDataRemover::REMOVE_HISTORY | | 1835 BrowsingDataRemover::REMOVE_HISTORY | |
1838 BrowsingDataRemover::REMOVE_COOKIES, false); | 1836 BrowsingDataRemover::REMOVE_COOKIES, false); |
1839 } | 1837 } |
OLD | NEW |