| 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 #include <vector> |
| 6 | 7 |
| 7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 8 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 9 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 10 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
| 11 #include "base/test/test_timeouts.h" | 12 #include "base/test/test_timeouts.h" |
| 12 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 13 #include "base/values.h" | 14 #include "base/values.h" |
| 14 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 15 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 15 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 16 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 16 #include "chrome/browser/content_settings/host_content_settings_map.h" | 17 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 17 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" | 18 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" |
| 18 #include "chrome/browser/extensions/extension_apitest.h" | 19 #include "chrome/browser/extensions/extension_apitest.h" |
| 19 #include "chrome/browser/favicon/favicon_tab_helper.h" | 20 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 20 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
| 21 #include "chrome/browser/prerender/prerender_contents.h" | 22 #include "chrome/browser/prerender/prerender_contents.h" |
| 22 #include "chrome/browser/prerender/prerender_handle.h" | 23 #include "chrome/browser/prerender/prerender_handle.h" |
| 23 #include "chrome/browser/prerender/prerender_link_manager.h" | 24 #include "chrome/browser/prerender/prerender_link_manager.h" |
| 24 #include "chrome/browser/prerender/prerender_link_manager_factory.h" | 25 #include "chrome/browser/prerender/prerender_link_manager_factory.h" |
| 25 #include "chrome/browser/prerender/prerender_manager.h" | 26 #include "chrome/browser/prerender/prerender_manager.h" |
| 26 #include "chrome/browser/prerender/prerender_manager_factory.h" | 27 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 27 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
| 28 #include "chrome/browser/safe_browsing/database_manager.h" | 29 #include "chrome/browser/safe_browsing/database_manager.h" |
| 29 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 30 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 31 #include "chrome/browser/safe_browsing/safe_browsing_util.h" |
| 30 #include "chrome/browser/task_manager/task_manager.h" | 32 #include "chrome/browser/task_manager/task_manager.h" |
| 31 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" | 33 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" |
| 32 #include "chrome/browser/ui/browser.h" | 34 #include "chrome/browser/ui/browser.h" |
| 33 #include "chrome/browser/ui/browser_commands.h" | 35 #include "chrome/browser/ui/browser_commands.h" |
| 34 #include "chrome/browser/ui/browser_finder.h" | 36 #include "chrome/browser/ui/browser_finder.h" |
| 35 #include "chrome/browser/ui/browser_tabstrip.h" | 37 #include "chrome/browser/ui/browser_tabstrip.h" |
| 36 #include "chrome/browser/ui/browser_window.h" | 38 #include "chrome/browser/ui/browser_window.h" |
| 37 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 39 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 38 #include "chrome/common/chrome_notification_types.h" | 40 #include "chrome/common/chrome_notification_types.h" |
| 39 #include "chrome/common/chrome_paths.h" | 41 #include "chrome/common/chrome_paths.h" |
| 40 #include "chrome/common/chrome_switches.h" | 42 #include "chrome/common/chrome_switches.h" |
| 41 #include "chrome/common/pref_names.h" | 43 #include "chrome/common/pref_names.h" |
| 42 #include "chrome/test/base/in_process_browser_test.h" | 44 #include "chrome/test/base/in_process_browser_test.h" |
| 43 #include "chrome/test/base/ui_test_utils.h" | 45 #include "chrome/test/base/ui_test_utils.h" |
| 44 #include "content/public/browser/browser_message_filter.h" | 46 #include "content/public/browser/browser_message_filter.h" |
| 45 #include "content/public/browser/devtools_agent_host.h" | 47 #include "content/public/browser/devtools_agent_host.h" |
| 46 #include "content/public/browser/devtools_client_host.h" | 48 #include "content/public/browser/devtools_client_host.h" |
| 47 #include "content/public/browser/devtools_manager.h" | 49 #include "content/public/browser/devtools_manager.h" |
| 48 #include "content/public/browser/notification_service.h" | 50 #include "content/public/browser/notification_service.h" |
| 49 #include "content/public/browser/render_process_host.h" | 51 #include "content/public/browser/render_process_host.h" |
| 50 #include "content/public/browser/render_view_host.h" | 52 #include "content/public/browser/render_view_host.h" |
| 51 #include "content/public/browser/web_contents.h" | 53 #include "content/public/browser/web_contents.h" |
| 52 #include "content/public/common/url_constants.h" | 54 #include "content/public/common/url_constants.h" |
| 53 #include "content/public/test/browser_test_utils.h" | 55 #include "content/public/test/browser_test_utils.h" |
| 54 #include "content/public/test/test_navigation_observer.h" | 56 #include "content/public/test/test_navigation_observer.h" |
| 55 #include "content/public/test/test_utils.h" | 57 #include "content/public/test/test_utils.h" |
| 58 #include "googleurl/src/gurl.h" |
| 56 #include "grit/generated_resources.h" | 59 #include "grit/generated_resources.h" |
| 57 #include "net/base/mock_host_resolver.h" | 60 #include "net/base/mock_host_resolver.h" |
| 58 #include "net/url_request/url_request_context.h" | 61 #include "net/url_request/url_request_context.h" |
| 59 #include "net/url_request/url_request_context_getter.h" | 62 #include "net/url_request/url_request_context_getter.h" |
| 60 #include "ui/base/l10n/l10n_util.h" | 63 #include "ui/base/l10n/l10n_util.h" |
| 61 | 64 |
| 62 using content::BrowserThread; | 65 using content::BrowserThread; |
| 63 using content::DevToolsAgentHost; | 66 using content::DevToolsAgentHost; |
| 64 using content::DevToolsClientHost; | 67 using content::DevToolsClientHost; |
| 65 using content::DevToolsManager; | 68 using content::DevToolsManager; |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 495 |
| 493 void SetThreatTypeForUrl(const GURL& url, SBThreatType threat_type) { | 496 void SetThreatTypeForUrl(const GURL& url, SBThreatType threat_type) { |
| 494 url_ = url; | 497 url_ = url; |
| 495 threat_type_ = threat_type; | 498 threat_type_ = threat_type; |
| 496 } | 499 } |
| 497 | 500 |
| 498 private: | 501 private: |
| 499 virtual ~FakeSafeBrowsingDatabaseManager() {} | 502 virtual ~FakeSafeBrowsingDatabaseManager() {} |
| 500 | 503 |
| 501 void OnCheckBrowseURLDone(const GURL& gurl, Client* client) { | 504 void OnCheckBrowseURLDone(const GURL& gurl, Client* client) { |
| 502 SafeBrowsingDatabaseManager::SafeBrowsingCheck check; | 505 SafeBrowsingDatabaseManager::SafeBrowsingCheck sb_check( |
| 503 check.urls.push_back(gurl); | 506 std::vector<GURL>(1, gurl), |
| 504 check.client = client; | 507 std::vector<SBFullHash>(), |
| 505 check.threat_type = threat_type_; | 508 client, |
| 506 client->OnSafeBrowsingResult(check); | 509 safe_browsing_util::MALWARE); |
| 510 sb_check.url_results[0] = threat_type_; |
| 511 client->OnSafeBrowsingResult(sb_check); |
| 507 } | 512 } |
| 508 | 513 |
| 509 GURL url_; | 514 GURL url_; |
| 510 SBThreatType threat_type_; | 515 SBThreatType threat_type_; |
| 511 DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingDatabaseManager); | 516 DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingDatabaseManager); |
| 512 }; | 517 }; |
| 513 | 518 |
| 514 class FakeSafeBrowsingService : public SafeBrowsingService { | 519 class FakeSafeBrowsingService : public SafeBrowsingService { |
| 515 public: | 520 public: |
| 516 FakeSafeBrowsingService() { } | 521 FakeSafeBrowsingService() { } |
| (...skipping 2192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2709 channel_close_watcher.WatchChannel( | 2714 channel_close_watcher.WatchChannel( |
| 2710 chrome::GetActiveWebContents(browser())->GetRenderProcessHost()); | 2715 chrome::GetActiveWebContents(browser())->GetRenderProcessHost()); |
| 2711 NavigateToDestURL(); | 2716 NavigateToDestURL(); |
| 2712 channel_close_watcher.WaitForChannelClose(); | 2717 channel_close_watcher.WaitForChannelClose(); |
| 2713 | 2718 |
| 2714 ASSERT_TRUE(IsEmptyPrerenderLinkManager()); | 2719 ASSERT_TRUE(IsEmptyPrerenderLinkManager()); |
| 2715 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 2720 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 2716 } | 2721 } |
| 2717 | 2722 |
| 2718 } // namespace prerender | 2723 } // namespace prerender |
| OLD | NEW |