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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 typedef SafeBrowsingUIManager::UnsafeResource UnsafeResource; | 203 typedef SafeBrowsingUIManager::UnsafeResource UnsafeResource; |
204 | 204 |
205 void SetUp() override { | 205 void SetUp() override { |
206 ChromeRenderViewHostTestHarness::SetUp(); | 206 ChromeRenderViewHostTestHarness::SetUp(); |
207 | 207 |
208 // Inject service classes. | 208 // Inject service classes. |
209 csd_service_.reset(new StrictMock<MockClientSideDetectionService>()); | 209 csd_service_.reset(new StrictMock<MockClientSideDetectionService>()); |
210 database_manager_ = new StrictMock<MockSafeBrowsingDatabaseManager>(); | 210 database_manager_ = new StrictMock<MockSafeBrowsingDatabaseManager>(); |
211 ui_manager_ = new StrictMock<MockSafeBrowsingUIManager>( | 211 ui_manager_ = new StrictMock<MockSafeBrowsingUIManager>( |
212 SafeBrowsingService::CreateSafeBrowsingService()); | 212 SafeBrowsingService::CreateSafeBrowsingService()); |
213 csd_host_.reset(safe_browsing::ClientSideDetectionHost::Create( | 213 csd_host_.reset(ClientSideDetectionHost::Create(web_contents())); |
214 web_contents())); | |
215 csd_host_->set_client_side_detection_service(csd_service_.get()); | 214 csd_host_->set_client_side_detection_service(csd_service_.get()); |
216 csd_host_->set_safe_browsing_managers(ui_manager_.get(), | 215 csd_host_->set_safe_browsing_managers(ui_manager_.get(), |
217 database_manager_.get()); | 216 database_manager_.get()); |
218 // We need to create this here since we don't call DidStopLanding in | 217 // We need to create this here since we don't call DidStopLanding in |
219 // this test. | 218 // this test. |
220 csd_host_->browse_info_.reset(new BrowseInfo); | 219 csd_host_->browse_info_.reset(new BrowseInfo); |
221 } | 220 } |
222 | 221 |
223 void TearDown() override { | 222 void TearDown() override { |
224 // Delete the host object on the UI thread and release the | 223 // Delete the host object on the UI thread and release the |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 EXPECT_EQ(url, resource.url); | 1138 EXPECT_EQ(url, resource.url); |
1140 EXPECT_EQ(url, resource.original_url); | 1139 EXPECT_EQ(url, resource.original_url); |
1141 | 1140 |
1142 ExpectStartPhishingDetection(NULL); | 1141 ExpectStartPhishingDetection(NULL); |
1143 | 1142 |
1144 // Showing a phishing warning will invalidate all the weak pointers which | 1143 // Showing a phishing warning will invalidate all the weak pointers which |
1145 // means we will not extract malware features. | 1144 // means we will not extract malware features. |
1146 ExpectShouldClassifyForMalwareResult(false); | 1145 ExpectShouldClassifyForMalwareResult(false); |
1147 } | 1146 } |
1148 } // namespace safe_browsing | 1147 } // namespace safe_browsing |
OLD | NEW |