| 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 <deque> | 5 #include <deque> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| 11 #include "base/test/test_timeouts.h" | 11 #include "base/test/test_timeouts.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 14 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 15 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 15 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 16 #include "chrome/browser/content_settings/host_content_settings_map.h" | 16 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 17 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" | 17 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" |
| 18 #include "chrome/browser/extensions/extension_apitest.h" | 18 #include "chrome/browser/extensions/extension_apitest.h" |
| 19 #include "chrome/browser/favicon/favicon_tab_helper.h" | 19 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 20 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
| 21 #include "chrome/browser/prerender/prerender_contents.h" | 21 #include "chrome/browser/prerender/prerender_contents.h" |
| 22 #include "chrome/browser/prerender/prerender_handle.h" | 22 #include "chrome/browser/prerender/prerender_handle.h" |
| 23 #include "chrome/browser/prerender/prerender_link_manager.h" | 23 #include "chrome/browser/prerender/prerender_link_manager.h" |
| 24 #include "chrome/browser/prerender/prerender_link_manager_factory.h" | 24 #include "chrome/browser/prerender/prerender_link_manager_factory.h" |
| 25 #include "chrome/browser/prerender/prerender_manager.h" | 25 #include "chrome/browser/prerender/prerender_manager.h" |
| 26 #include "chrome/browser/prerender/prerender_manager_factory.h" | 26 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 27 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
| 28 #include "chrome/browser/safe_browsing/database_manager.h" | 28 #include "chrome/browser/safe_browsing/database_manager.h" |
| 29 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 29 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 30 #include "chrome/browser/safe_browsing/safe_browsing_util.h" |
| 30 #include "chrome/browser/task_manager/task_manager.h" | 31 #include "chrome/browser/task_manager/task_manager.h" |
| 31 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" | 32 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" |
| 32 #include "chrome/browser/ui/browser.h" | 33 #include "chrome/browser/ui/browser.h" |
| 33 #include "chrome/browser/ui/browser_commands.h" | 34 #include "chrome/browser/ui/browser_commands.h" |
| 34 #include "chrome/browser/ui/browser_finder.h" | 35 #include "chrome/browser/ui/browser_finder.h" |
| 35 #include "chrome/browser/ui/browser_tabstrip.h" | 36 #include "chrome/browser/ui/browser_tabstrip.h" |
| 36 #include "chrome/browser/ui/browser_window.h" | 37 #include "chrome/browser/ui/browser_window.h" |
| 37 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 38 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 38 #include "chrome/common/chrome_notification_types.h" | 39 #include "chrome/common/chrome_notification_types.h" |
| 39 #include "chrome/common/chrome_paths.h" | 40 #include "chrome/common/chrome_paths.h" |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 493 |
| 493 void SetThreatTypeForUrl(const GURL& url, SBThreatType threat_type) { | 494 void SetThreatTypeForUrl(const GURL& url, SBThreatType threat_type) { |
| 494 url_ = url; | 495 url_ = url; |
| 495 threat_type_ = threat_type; | 496 threat_type_ = threat_type; |
| 496 } | 497 } |
| 497 | 498 |
| 498 private: | 499 private: |
| 499 virtual ~FakeSafeBrowsingDatabaseManager() {} | 500 virtual ~FakeSafeBrowsingDatabaseManager() {} |
| 500 | 501 |
| 501 void OnCheckBrowseURLDone(const GURL& gurl, Client* client) { | 502 void OnCheckBrowseURLDone(const GURL& gurl, Client* client) { |
| 502 SafeBrowsingDatabaseManager::SafeBrowsingCheck check; | 503 SafeBrowsingDatabaseManager::SafeBrowsingCheck check( |
| 503 check.urls.push_back(gurl); | 504 std::vector<GURL>(1, gurl), |
| 504 check.client = client; | 505 std::vector<SBFullHash>(), |
| 505 check.threat_type = threat_type_; | 506 client, |
| 507 safe_browsing_util::MALWARE); |
| 506 client->OnSafeBrowsingResult(check); | 508 client->OnSafeBrowsingResult(check); |
| 507 } | 509 } |
| 508 | 510 |
| 509 GURL url_; | 511 GURL url_; |
| 510 SBThreatType threat_type_; | 512 SBThreatType threat_type_; |
| 511 DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingDatabaseManager); | 513 DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingDatabaseManager); |
| 512 }; | 514 }; |
| 513 | 515 |
| 514 class FakeSafeBrowsingService : public SafeBrowsingService { | 516 class FakeSafeBrowsingService : public SafeBrowsingService { |
| 515 public: | 517 public: |
| (...skipping 2193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2709 channel_close_watcher.WatchChannel( | 2711 channel_close_watcher.WatchChannel( |
| 2710 chrome::GetActiveWebContents(browser())->GetRenderProcessHost()); | 2712 chrome::GetActiveWebContents(browser())->GetRenderProcessHost()); |
| 2711 NavigateToDestURL(); | 2713 NavigateToDestURL(); |
| 2712 channel_close_watcher.WaitForChannelClose(); | 2714 channel_close_watcher.WaitForChannelClose(); |
| 2713 | 2715 |
| 2714 ASSERT_TRUE(IsEmptyPrerenderLinkManager()); | 2716 ASSERT_TRUE(IsEmptyPrerenderLinkManager()); |
| 2715 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 2717 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 2716 } | 2718 } |
| 2717 | 2719 |
| 2718 } // namespace prerender | 2720 } // namespace prerender |
| OLD | NEW |