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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
11 | 11 |
12 #include "base/base64.h" | 12 #include "base/base64.h" |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/json/json_string_value_serializer.h" | 16 #include "base/json/json_string_value_serializer.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
20 #include "base/run_loop.h" | 20 #include "base/run_loop.h" |
21 #include "base/stl_util.h" | 21 #include "base/stl_util.h" |
22 #include "base/synchronization/lock.h" | 22 #include "base/synchronization/lock.h" |
23 #include "base/threading/thread_task_runner_handle.h" | 23 #include "base/threading/thread_task_runner_handle.h" |
24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
25 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
26 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 26 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
27 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 27 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
28 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 28 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 29 #include "chrome/browser/browsing_data/chrome_browsing_data_types.h" |
29 #include "chrome/browser/net/predictor.h" | 30 #include "chrome/browser/net/predictor.h" |
30 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
31 #include "chrome/browser/ui/browser.h" | 32 #include "chrome/browser/ui/browser.h" |
32 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 33 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
33 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
34 #include "chrome/test/base/in_process_browser_test.h" | 35 #include "chrome/test/base/in_process_browser_test.h" |
35 #include "chrome/test/base/ui_test_utils.h" | 36 #include "chrome/test/base/ui_test_utils.h" |
36 #include "components/prefs/pref_service.h" | 37 #include "components/prefs/pref_service.h" |
37 #include "content/public/common/content_switches.h" | 38 #include "content/public/common/content_switches.h" |
38 #include "content/public/test/browser_test_utils.h" | 39 #include "content/public/test/browser_test_utils.h" |
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 GetListFromPrefsAsString(prefs::kDnsPrefetchingStartupList, | 1403 GetListFromPrefsAsString(prefs::kDnsPrefetchingStartupList, |
1403 &cleared_startup_list); | 1404 &cleared_startup_list); |
1404 GetListFromPrefsAsString(prefs::kDnsPrefetchingHostReferralList, | 1405 GetListFromPrefsAsString(prefs::kDnsPrefetchingHostReferralList, |
1405 &cleared_referral_list); | 1406 &cleared_referral_list); |
1406 EXPECT_THAT(cleared_referral_list, HasSubstr(referring_url_.host())); | 1407 EXPECT_THAT(cleared_referral_list, HasSubstr(referring_url_.host())); |
1407 EXPECT_THAT(cleared_referral_list, HasSubstr(target_url_.host())); | 1408 EXPECT_THAT(cleared_referral_list, HasSubstr(target_url_.host())); |
1408 | 1409 |
1409 // Clear cache which should clear all prefs. | 1410 // Clear cache which should clear all prefs. |
1410 BrowsingDataRemover* remover = | 1411 BrowsingDataRemover* remover = |
1411 BrowsingDataRemoverFactory::GetForBrowserContext(browser()->profile()); | 1412 BrowsingDataRemoverFactory::GetForBrowserContext(browser()->profile()); |
1412 remover->Remove(base::Time(), base::Time::Max(), | 1413 remover->Remove(base::Time(), base::Time::Max(), {&kBrowsingDataTypeHistory}, |
1413 BrowsingDataRemover::REMOVE_HISTORY, | |
1414 BrowsingDataHelper::UNPROTECTED_WEB); | 1414 BrowsingDataHelper::UNPROTECTED_WEB); |
1415 | 1415 |
1416 GetListFromPrefsAsString(prefs::kDnsPrefetchingStartupList, | 1416 GetListFromPrefsAsString(prefs::kDnsPrefetchingStartupList, |
1417 &cleared_startup_list); | 1417 &cleared_startup_list); |
1418 GetListFromPrefsAsString(prefs::kDnsPrefetchingHostReferralList, | 1418 GetListFromPrefsAsString(prefs::kDnsPrefetchingHostReferralList, |
1419 &cleared_referral_list); | 1419 &cleared_referral_list); |
1420 EXPECT_THAT(cleared_referral_list, Not(HasSubstr(referring_url_.host()))); | 1420 EXPECT_THAT(cleared_referral_list, Not(HasSubstr(referring_url_.host()))); |
1421 EXPECT_THAT(cleared_referral_list, Not(HasSubstr(target_url_.host()))); | 1421 EXPECT_THAT(cleared_referral_list, Not(HasSubstr(target_url_.host()))); |
1422 } | 1422 } |
1423 | 1423 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 // Second navigation to content with an img. | 1563 // Second navigation to content with an img. |
1564 std::string img_content = | 1564 std::string img_content = |
1565 "<img src=\"" + preconnect_url.spec() + "test.gif\">"; | 1565 "<img src=\"" + preconnect_url.spec() + "test.gif\">"; |
1566 NavigateToDataURLWithContent(img_content); | 1566 NavigateToDataURLWithContent(img_content); |
1567 connection_listener_->WaitUntilFirstConnectionRead(); | 1567 connection_listener_->WaitUntilFirstConnectionRead(); |
1568 EXPECT_EQ(2u, connection_listener_->GetAcceptedSocketCount()); | 1568 EXPECT_EQ(2u, connection_listener_->GetAcceptedSocketCount()); |
1569 EXPECT_EQ(1u, connection_listener_->GetReadSocketCount()); | 1569 EXPECT_EQ(1u, connection_listener_->GetReadSocketCount()); |
1570 } | 1570 } |
1571 | 1571 |
1572 } // namespace chrome_browser_net | 1572 } // namespace chrome_browser_net |
OLD | NEW |