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 <deque> | 6 #include <deque> |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 #include "chrome/browser/prerender/prerender_field_trial.h" | 43 #include "chrome/browser/prerender/prerender_field_trial.h" |
44 #include "chrome/browser/prerender/prerender_handle.h" | 44 #include "chrome/browser/prerender/prerender_handle.h" |
45 #include "chrome/browser/prerender/prerender_link_manager.h" | 45 #include "chrome/browser/prerender/prerender_link_manager.h" |
46 #include "chrome/browser/prerender/prerender_link_manager_factory.h" | 46 #include "chrome/browser/prerender/prerender_link_manager_factory.h" |
47 #include "chrome/browser/prerender/prerender_manager.h" | 47 #include "chrome/browser/prerender/prerender_manager.h" |
48 #include "chrome/browser/prerender/prerender_manager_factory.h" | 48 #include "chrome/browser/prerender/prerender_manager_factory.h" |
49 #include "chrome/browser/profiles/profile.h" | 49 #include "chrome/browser/profiles/profile.h" |
50 #include "chrome/browser/profiles/profile_io_data.h" | 50 #include "chrome/browser/profiles/profile_io_data.h" |
51 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" | 51 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" |
52 #include "chrome/browser/safe_browsing/local_database_manager.h" | 52 #include "chrome/browser/safe_browsing/local_database_manager.h" |
53 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 53 #include "chrome/browser/safe_browsing/test_safe_browsing_service.h" |
54 #include "chrome/browser/task_management/providers/web_contents/web_contents_tag s_manager.h" | 54 #include "chrome/browser/task_management/providers/web_contents/web_contents_tag s_manager.h" |
55 #include "chrome/browser/task_management/task_management_browsertest_util.h" | 55 #include "chrome/browser/task_management/task_management_browsertest_util.h" |
56 #include "chrome/browser/task_manager/task_manager.h" | 56 #include "chrome/browser/task_manager/task_manager.h" |
57 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" | 57 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" |
58 #include "chrome/browser/ui/browser.h" | 58 #include "chrome/browser/ui/browser.h" |
59 #include "chrome/browser/ui/browser_commands.h" | 59 #include "chrome/browser/ui/browser_commands.h" |
60 #include "chrome/browser/ui/browser_finder.h" | 60 #include "chrome/browser/ui/browser_finder.h" |
61 #include "chrome/browser/ui/browser_window.h" | 61 #include "chrome/browser/ui/browser_window.h" |
62 #include "chrome/browser/ui/location_bar/location_bar.h" | 62 #include "chrome/browser/ui/location_bar/location_bar.h" |
63 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 63 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
734 handle(handle) { | 734 handle(handle) { |
735 } | 735 } |
736 | 736 |
737 FinalStatus final_status; | 737 FinalStatus final_status; |
738 base::WeakPtr<TestPrerender> handle; | 738 base::WeakPtr<TestPrerender> handle; |
739 }; | 739 }; |
740 | 740 |
741 std::deque<ExpectedContents> expected_contents_queue_; | 741 std::deque<ExpectedContents> expected_contents_queue_; |
742 }; | 742 }; |
743 | 743 |
744 // TODO(nparker): Switch this to use TestSafeBrowsingDatabaseManager and run | 744 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) |
Nathan Parker
2016/05/07 00:05:32
Is this file included in Android tests? If so, th
Jialiu Lin
2016/05/12 21:53:58
Good to know. ifdefs removed. Thanks!
| |
745 // with SAFE_BROWSING_DB_LOCAL || SAFE_BROWSING_DB_REMOTE. | |
746 // Note: don't forget to override GetProtocolManagerDelegate and return NULL, | |
747 // because FakeSafeBrowsingDatabaseManager does not implement | |
748 // LocalSafeBrowsingDatabaseManager. | |
749 #if defined(FULL_SAFE_BROWSING) | |
750 // A SafeBrowsingDatabaseManager implementation that returns a fixed result for | 745 // A SafeBrowsingDatabaseManager implementation that returns a fixed result for |
751 // a given URL. | 746 // a given URL. |
752 class FakeSafeBrowsingDatabaseManager | 747 class FakeSafeBrowsingDatabaseManager |
753 : public LocalSafeBrowsingDatabaseManager { | 748 : public safe_browsing::TestSafeBrowsingDatabaseManager { |
754 public: | 749 public: |
755 explicit FakeSafeBrowsingDatabaseManager(SafeBrowsingService* service) | 750 FakeSafeBrowsingDatabaseManager() {} |
756 : LocalSafeBrowsingDatabaseManager(service), | |
757 threat_type_(safe_browsing::SB_THREAT_TYPE_SAFE) {} | |
758 | 751 |
759 // Called on the IO thread to check if the given url is safe or not. If we | 752 // Called on the IO thread to check if the given url is safe or not. If we |
760 // can synchronously determine that the url is safe, CheckUrl returns true. | 753 // can synchronously determine that the url is safe, CheckUrl returns true. |
761 // Otherwise it returns false, and "client" is called asynchronously with the | 754 // Otherwise it returns false, and "client" is called asynchronously with the |
762 // result when it is ready. | 755 // result when it is ready. |
763 // Returns true, indicating a SAFE result, unless the URL is the fixed URL | 756 // Returns true, indicating a SAFE result, unless the URL is the fixed URL |
764 // specified by the user, and the user-specified result is not SAFE | 757 // specified by the user, and the user-specified result is not SAFE |
765 // (in which that result will be communicated back via a call into the | 758 // (in which that result will be communicated back via a call into the |
766 // client, and false will be returned). | 759 // client, and false will be returned). |
767 // Overrides SafeBrowsingDatabaseManager::CheckBrowseUrl. | 760 // Overrides SafeBrowsingDatabaseManager::CheckBrowseUrl. |
768 bool CheckBrowseUrl(const GURL& gurl, Client* client) override { | 761 bool CheckBrowseUrl(const GURL& gurl, Client* client) override { |
769 if (gurl != url_ || threat_type_ == safe_browsing::SB_THREAT_TYPE_SAFE) | 762 if (badurls_.find(gurl.spec())==badurls_.end() || |
Nathan Parker
2016/05/07 00:05:32
nit: spaces around ==
Jialiu Lin
2016/05/12 21:53:58
Done.
| |
763 badurls_[gurl.spec()] == safe_browsing::SB_THREAT_TYPE_SAFE) | |
770 return true; | 764 return true; |
771 | 765 |
772 BrowserThread::PostTask( | 766 BrowserThread::PostTask( |
773 BrowserThread::IO, FROM_HERE, | 767 BrowserThread::IO, FROM_HERE, |
774 base::Bind(&FakeSafeBrowsingDatabaseManager::OnCheckBrowseURLDone, | 768 base::Bind(&FakeSafeBrowsingDatabaseManager::OnCheckBrowseURLDone, |
775 this, gurl, client)); | 769 this, gurl, client)); |
776 return false; | 770 return false; |
777 } | 771 } |
778 | 772 |
779 void SetThreatTypeForUrl(const GURL& url, SBThreatType threat_type) { | 773 void SetThreatTypeForUrl(const GURL& url, SBThreatType threat_type) { |
780 url_ = url; | 774 badurls_[url.spec()] = threat_type; |
781 threat_type_ = threat_type; | 775 } |
776 | |
777 // These are called when checking URLs, so we implement them. | |
778 bool IsSupported() const override { return true; } | |
779 bool ChecksAreAlwaysAsync() const override { return false; } | |
780 bool CanCheckResourceType( | |
781 content::ResourceType /* resource_type */) const override { | |
782 return true; | |
783 } | |
784 | |
785 bool CheckExtensionIDs(const std::set<std::string>& extension_ids, | |
786 Client* client) override { | |
787 return true; | |
782 } | 788 } |
783 | 789 |
784 private: | 790 private: |
785 ~FakeSafeBrowsingDatabaseManager() override {} | 791 ~FakeSafeBrowsingDatabaseManager() override {} |
786 | 792 |
787 void OnCheckBrowseURLDone(const GURL& gurl, Client* client) { | 793 void OnCheckBrowseURLDone(const GURL& gurl, Client* client) { |
788 std::vector<SBThreatType> expected_threats; | 794 std::vector<SBThreatType> expected_threats; |
789 expected_threats.push_back(safe_browsing::SB_THREAT_TYPE_URL_MALWARE); | 795 expected_threats.push_back(safe_browsing::SB_THREAT_TYPE_URL_MALWARE); |
790 expected_threats.push_back(safe_browsing::SB_THREAT_TYPE_URL_PHISHING); | 796 expected_threats.push_back(safe_browsing::SB_THREAT_TYPE_URL_PHISHING); |
791 // TODO(nparker): Replace SafeBrowsingCheck w/ a call to | 797 // TODO(nparker): Replace SafeBrowsingCheck w/ a call to |
792 // client->OnCheckBrowseUrlResult() | 798 // client->OnCheckBrowseUrlResult() |
793 LocalSafeBrowsingDatabaseManager::SafeBrowsingCheck sb_check( | 799 LocalSafeBrowsingDatabaseManager::SafeBrowsingCheck sb_check( |
794 std::vector<GURL>(1, gurl), | 800 std::vector<GURL>(1, gurl), |
795 std::vector<safe_browsing::SBFullHash>(), | 801 std::vector<safe_browsing::SBFullHash>(), |
796 client, | 802 client, |
797 safe_browsing::MALWARE, | 803 safe_browsing::MALWARE, |
798 expected_threats); | 804 expected_threats); |
799 sb_check.url_results[0] = threat_type_; | 805 sb_check.url_results[0] = badurls_[gurl.spec()]; |
800 sb_check.OnSafeBrowsingResult(); | 806 sb_check.OnSafeBrowsingResult(); |
801 } | 807 } |
802 | 808 |
803 GURL url_; | 809 base::hash_map<std::string, SBThreatType> badurls_; |
804 SBThreatType threat_type_; | |
805 DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingDatabaseManager); | 810 DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingDatabaseManager); |
806 }; | 811 }; |
807 | 812 |
808 class FakeSafeBrowsingService : public SafeBrowsingService { | |
809 public: | |
810 FakeSafeBrowsingService() { } | |
811 | |
812 // Returned pointer has the same lifespan as the database_manager_ refcounted | |
813 // object. | |
814 FakeSafeBrowsingDatabaseManager* fake_database_manager() { | |
815 return fake_database_manager_; | |
816 } | |
817 | |
818 protected: | |
819 ~FakeSafeBrowsingService() override {} | |
820 | |
821 safe_browsing::SafeBrowsingDatabaseManager* CreateDatabaseManager() override { | |
822 fake_database_manager_ = new FakeSafeBrowsingDatabaseManager(this); | |
823 return fake_database_manager_; | |
824 } | |
825 | |
826 private: | |
827 FakeSafeBrowsingDatabaseManager* fake_database_manager_; | |
828 | |
829 DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingService); | |
830 }; | |
831 | |
832 // Factory that creates FakeSafeBrowsingService instances. | |
833 class TestSafeBrowsingServiceFactory | |
834 : public safe_browsing::SafeBrowsingServiceFactory { | |
835 public: | |
836 TestSafeBrowsingServiceFactory() : | |
837 most_recent_service_(NULL) { } | |
838 ~TestSafeBrowsingServiceFactory() override {} | |
839 | |
840 SafeBrowsingService* CreateSafeBrowsingService() override { | |
841 most_recent_service_ = new FakeSafeBrowsingService(); | |
842 return most_recent_service_; | |
843 } | |
844 | |
845 FakeSafeBrowsingService* most_recent_service() const { | |
846 return most_recent_service_; | |
847 } | |
848 | |
849 private: | |
850 FakeSafeBrowsingService* most_recent_service_; | |
851 }; | |
852 #endif | 813 #endif |
853 | 814 |
854 class FakeDevToolsClient : public content::DevToolsAgentHostClient { | 815 class FakeDevToolsClient : public content::DevToolsAgentHostClient { |
855 public: | 816 public: |
856 FakeDevToolsClient() {} | 817 FakeDevToolsClient() {} |
857 ~FakeDevToolsClient() override {} | 818 ~FakeDevToolsClient() override {} |
858 void DispatchProtocolMessage(DevToolsAgentHost* agent_host, | 819 void DispatchProtocolMessage(DevToolsAgentHost* agent_host, |
859 const std::string& message) override {} | 820 const std::string& message) override {} |
860 void AgentHostClosed(DevToolsAgentHost* agent_host, bool replaced) override {} | 821 void AgentHostClosed(DevToolsAgentHost* agent_host, bool replaced) override {} |
861 }; | 822 }; |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1123 base::FilePath().AppendASCII(file_name)); | 1084 base::FilePath().AppendASCII(file_name)); |
1124 } | 1085 } |
1125 | 1086 |
1126 } // namespace | 1087 } // namespace |
1127 | 1088 |
1128 class PrerenderBrowserTest : virtual public InProcessBrowserTest { | 1089 class PrerenderBrowserTest : virtual public InProcessBrowserTest { |
1129 public: | 1090 public: |
1130 PrerenderBrowserTest() | 1091 PrerenderBrowserTest() |
1131 : autostart_test_server_(true), | 1092 : autostart_test_server_(true), |
1132 prerender_contents_factory_(NULL), | 1093 prerender_contents_factory_(NULL), |
1133 #if defined(FULL_SAFE_BROWSING) | 1094 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) |
1134 safe_browsing_factory_(new TestSafeBrowsingServiceFactory()), | 1095 safe_browsing_factory_( |
1096 new safe_browsing::TestSafeBrowsingServiceFactory()), | |
1135 #endif | 1097 #endif |
1136 call_javascript_(true), | 1098 call_javascript_(true), |
1137 check_load_events_(true), | 1099 check_load_events_(true), |
1138 loader_path_("/prerender/prerender_loader.html"), | 1100 loader_path_("/prerender/prerender_loader.html"), |
1139 explicitly_set_browser_(NULL) { | 1101 explicitly_set_browser_(NULL) { |
1140 } | 1102 } |
1141 | 1103 |
1142 ~PrerenderBrowserTest() override {} | 1104 ~PrerenderBrowserTest() override {} |
1143 | 1105 |
1144 content::SessionStorageNamespace* GetSessionStorageNamespace() const { | 1106 content::SessionStorageNamespace* GetSessionStorageNamespace() const { |
1145 WebContents* web_contents = GetActiveWebContents(); | 1107 WebContents* web_contents = GetActiveWebContents(); |
1146 if (!web_contents) | 1108 if (!web_contents) |
1147 return NULL; | 1109 return NULL; |
1148 return web_contents->GetController().GetDefaultSessionStorageNamespace(); | 1110 return web_contents->GetController().GetDefaultSessionStorageNamespace(); |
1149 } | 1111 } |
1150 | 1112 |
1151 void SetUpInProcessBrowserTestFixture() override { | 1113 void SetUpInProcessBrowserTestFixture() override { |
1152 #if defined(FULL_SAFE_BROWSING) | 1114 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) |
1115 safe_browsing_factory_->SetTestDatabaseManager( | |
1116 new FakeSafeBrowsingDatabaseManager()); | |
1153 SafeBrowsingService::RegisterFactory(safe_browsing_factory_.get()); | 1117 SafeBrowsingService::RegisterFactory(safe_browsing_factory_.get()); |
1154 #endif | 1118 #endif |
1155 } | 1119 } |
1156 | 1120 |
1157 void TearDownInProcessBrowserTestFixture() override { | 1121 void TearDownInProcessBrowserTestFixture() override { |
1158 #if defined(FULL_SAFE_BROWSING) | 1122 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) |
1159 SafeBrowsingService::RegisterFactory(NULL); | 1123 SafeBrowsingService::RegisterFactory(NULL); |
1160 #endif | 1124 #endif |
1161 } | 1125 } |
1162 | 1126 |
1163 void SetUpCommandLine(base::CommandLine* command_line) override { | 1127 void SetUpCommandLine(base::CommandLine* command_line) override { |
1164 command_line->AppendSwitchASCII(switches::kPrerenderMode, | 1128 command_line->AppendSwitchASCII(switches::kPrerenderMode, |
1165 switches::kPrerenderModeSwitchValueEnabled); | 1129 switches::kPrerenderModeSwitchValueEnabled); |
1166 command_line->AppendSwitch(switches::kEnablePepperTesting); | 1130 command_line->AppendSwitch(switches::kEnablePepperTesting); |
1167 command_line->AppendSwitchASCII( | 1131 command_line->AppendSwitchASCII( |
1168 switches::kOverridePluginPowerSaverForTesting, "ignore-list"); | 1132 switches::kOverridePluginPowerSaverForTesting, "ignore-list"); |
(...skipping 10 matching lines...) Expand all Loading... | |
1179 ChromeResourceDispatcherHostDelegate:: | 1143 ChromeResourceDispatcherHostDelegate:: |
1180 SetExternalProtocolHandlerDelegateForTesting( | 1144 SetExternalProtocolHandlerDelegateForTesting( |
1181 &external_protocol_handler_delegate_); | 1145 &external_protocol_handler_delegate_); |
1182 | 1146 |
1183 PrerenderManager* prerender_manager = GetPrerenderManager(); | 1147 PrerenderManager* prerender_manager = GetPrerenderManager(); |
1184 ASSERT_TRUE(prerender_manager); | 1148 ASSERT_TRUE(prerender_manager); |
1185 prerender_manager->mutable_config().rate_limit_enabled = false; | 1149 prerender_manager->mutable_config().rate_limit_enabled = false; |
1186 ASSERT_TRUE(prerender_contents_factory_ == NULL); | 1150 ASSERT_TRUE(prerender_contents_factory_ == NULL); |
1187 prerender_contents_factory_ = new TestPrerenderContentsFactory; | 1151 prerender_contents_factory_ = new TestPrerenderContentsFactory; |
1188 prerender_manager->SetPrerenderContentsFactory(prerender_contents_factory_); | 1152 prerender_manager->SetPrerenderContentsFactory(prerender_contents_factory_); |
1153 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) | |
1154 // Note: Need to make GetProtocolManagerDelegate return NULL, | |
1155 // because FakeSafeBrowsingDatabaseManager does not implement | |
1156 // LocalSafeBrowsingDatabaseManager. | |
1157 DCHECK(safe_browsing_factory_->test_safe_browsing_service()); | |
Nathan Parker
2016/05/07 00:05:32
I'm not not sure how the comment applies to this D
Jialiu Lin
2016/05/12 21:53:58
Oops, sorry it is a todo for myself. Comments remo
| |
1158 #endif | |
1189 } | 1159 } |
1190 | 1160 |
1191 // Convenience function to get the currently active WebContents in | 1161 // Convenience function to get the currently active WebContents in |
1192 // current_browser(). | 1162 // current_browser(). |
1193 WebContents* GetActiveWebContents() const { | 1163 WebContents* GetActiveWebContents() const { |
1194 return current_browser()->tab_strip_model()->GetActiveWebContents(); | 1164 return current_browser()->tab_strip_model()->GetActiveWebContents(); |
1195 } | 1165 } |
1196 | 1166 |
1197 // Overload for a single expected final status | 1167 // Overload for a single expected final status |
1198 std::unique_ptr<TestPrerender> PrerenderTestURL( | 1168 std::unique_ptr<TestPrerender> PrerenderTestURL( |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1475 static_cast<base::DictionaryValue*>( | 1445 static_cast<base::DictionaryValue*>( |
1476 GetPrerenderManager()->GetAsValue())); | 1446 GetPrerenderManager()->GetAsValue())); |
1477 if (!prerender_dict.get()) | 1447 if (!prerender_dict.get()) |
1478 return -1; | 1448 return -1; |
1479 base::ListValue* history_list; | 1449 base::ListValue* history_list; |
1480 if (!prerender_dict->GetList("history", &history_list)) | 1450 if (!prerender_dict->GetList("history", &history_list)) |
1481 return -1; | 1451 return -1; |
1482 return static_cast<int>(history_list->GetSize()); | 1452 return static_cast<int>(history_list->GetSize()); |
1483 } | 1453 } |
1484 | 1454 |
1485 #if defined(FULL_SAFE_BROWSING) | 1455 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) |
1486 FakeSafeBrowsingDatabaseManager* GetFakeSafeBrowsingDatabaseManager() { | 1456 FakeSafeBrowsingDatabaseManager* GetFakeSafeBrowsingDatabaseManager() { |
1487 return safe_browsing_factory_->most_recent_service()-> | 1457 return static_cast<FakeSafeBrowsingDatabaseManager*>( |
1488 fake_database_manager(); | 1458 safe_browsing_factory_->test_safe_browsing_service() |
1459 ->database_manager().get()); | |
1489 } | 1460 } |
1490 #endif | 1461 #endif |
1491 | 1462 |
1492 TestPrerenderContents* GetPrerenderContentsFor(const GURL& url) const { | 1463 TestPrerenderContents* GetPrerenderContentsFor(const GURL& url) const { |
1493 PrerenderManager::PrerenderData* prerender_data = | 1464 PrerenderManager::PrerenderData* prerender_data = |
1494 GetPrerenderManager()->FindPrerenderData(url, NULL); | 1465 GetPrerenderManager()->FindPrerenderData(url, NULL); |
1495 return static_cast<TestPrerenderContents*>( | 1466 return static_cast<TestPrerenderContents*>( |
1496 prerender_data ? prerender_data->contents() : NULL); | 1467 prerender_data ? prerender_data->contents() : NULL); |
1497 } | 1468 } |
1498 | 1469 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1717 } else { | 1688 } else { |
1718 NavigationOrSwapObserver observer(current_browser()->tab_strip_model(), | 1689 NavigationOrSwapObserver observer(current_browser()->tab_strip_model(), |
1719 web_contents); | 1690 web_contents); |
1720 render_frame_host->ExecuteJavaScriptForTests( | 1691 render_frame_host->ExecuteJavaScriptForTests( |
1721 base::ASCIIToUTF16(javascript)); | 1692 base::ASCIIToUTF16(javascript)); |
1722 observer.Wait(); | 1693 observer.Wait(); |
1723 } | 1694 } |
1724 } | 1695 } |
1725 | 1696 |
1726 TestPrerenderContentsFactory* prerender_contents_factory_; | 1697 TestPrerenderContentsFactory* prerender_contents_factory_; |
1727 #if defined(FULL_SAFE_BROWSING) | 1698 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) |
1728 std::unique_ptr<TestSafeBrowsingServiceFactory> safe_browsing_factory_; | 1699 std::unique_ptr< |
1700 safe_browsing::TestSafeBrowsingServiceFactory> safe_browsing_factory_; | |
1729 #endif | 1701 #endif |
1730 NeverRunsExternalProtocolHandlerDelegate external_protocol_handler_delegate_; | 1702 NeverRunsExternalProtocolHandlerDelegate external_protocol_handler_delegate_; |
1731 GURL dest_url_; | 1703 GURL dest_url_; |
1732 std::unique_ptr<net::EmbeddedTestServer> https_src_server_; | 1704 std::unique_ptr<net::EmbeddedTestServer> https_src_server_; |
1733 bool call_javascript_; | 1705 bool call_javascript_; |
1734 bool check_load_events_; | 1706 bool check_load_events_; |
1735 std::string loader_host_override_; | 1707 std::string loader_host_override_; |
1736 std::string loader_path_; | 1708 std::string loader_path_; |
1737 std::string loader_query_; | 1709 std::string loader_query_; |
1738 Browser* explicitly_set_browser_; | 1710 Browser* explicitly_set_browser_; |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2989 std::make_pair("REPLACE_WITH_URL", https_url.spec())); | 2961 std::make_pair("REPLACE_WITH_URL", https_url.spec())); |
2990 std::string replacement_path; | 2962 std::string replacement_path; |
2991 net::test_server::GetFilePathWithReplacements( | 2963 net::test_server::GetFilePathWithReplacements( |
2992 "/prerender/prerender_with_iframe.html", replacement_text, | 2964 "/prerender/prerender_with_iframe.html", replacement_text, |
2993 &replacement_path); | 2965 &replacement_path); |
2994 PrerenderTestURL(replacement_path, | 2966 PrerenderTestURL(replacement_path, |
2995 FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED, | 2967 FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED, |
2996 0); | 2968 0); |
2997 } | 2969 } |
2998 | 2970 |
2999 #if defined(FULL_SAFE_BROWSING) | 2971 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) |
3000 // Ensures that we do not prerender pages with a safe browsing | 2972 // Ensures that we do not prerender pages with a safe browsing |
3001 // interstitial. | 2973 // interstitial. |
3002 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSafeBrowsingTopLevel) { | 2974 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSafeBrowsingTopLevel) { |
3003 GURL url = embedded_test_server()->GetURL("/prerender/prerender_page.html"); | 2975 GURL url = embedded_test_server()->GetURL("/prerender/prerender_page.html"); |
3004 GetFakeSafeBrowsingDatabaseManager()->SetThreatTypeForUrl( | 2976 GetFakeSafeBrowsingDatabaseManager()->SetThreatTypeForUrl( |
3005 url, safe_browsing::SB_THREAT_TYPE_URL_MALWARE); | 2977 url, safe_browsing::SB_THREAT_TYPE_URL_MALWARE); |
3006 PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_SAFE_BROWSING, | 2978 PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_SAFE_BROWSING, |
3007 0); | 2979 0); |
3008 } | 2980 } |
3009 | 2981 |
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4086 | 4058 |
4087 NavigateToDestURL(); | 4059 NavigateToDestURL(); |
4088 EXPECT_EQ(1U, task_manager.tasks().size()); | 4060 EXPECT_EQ(1U, task_manager.tasks().size()); |
4089 } | 4061 } |
4090 | 4062 |
4091 } // namespace | 4063 } // namespace |
4092 | 4064 |
4093 #endif // defined(ENABLE_TASK_MANAGER) | 4065 #endif // defined(ENABLE_TASK_MANAGER) |
4094 | 4066 |
4095 } // namespace prerender | 4067 } // namespace prerender |
OLD | NEW |