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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 323 |
324 void ExpectShouldClassifyForMalwareResult(bool should_classify) { | 324 void ExpectShouldClassifyForMalwareResult(bool should_classify) { |
325 EXPECT_EQ(should_classify, csd_host_->should_classify_for_malware_); | 325 EXPECT_EQ(should_classify, csd_host_->should_classify_for_malware_); |
326 } | 326 } |
327 | 327 |
328 void ExpectStartPhishingDetection(const GURL* url) { | 328 void ExpectStartPhishingDetection(const GURL* url) { |
329 const IPC::Message* msg = process()->sink().GetFirstMessageMatching( | 329 const IPC::Message* msg = process()->sink().GetFirstMessageMatching( |
330 SafeBrowsingMsg_StartPhishingDetection::ID); | 330 SafeBrowsingMsg_StartPhishingDetection::ID); |
331 if (url) { | 331 if (url) { |
332 ASSERT_TRUE(msg); | 332 ASSERT_TRUE(msg); |
333 Tuple1<GURL> actual_url; | 333 Tuple<GURL> actual_url; |
334 SafeBrowsingMsg_StartPhishingDetection::Read(msg, &actual_url); | 334 SafeBrowsingMsg_StartPhishingDetection::Read(msg, &actual_url); |
335 EXPECT_EQ(*url, actual_url.a); | 335 EXPECT_EQ(*url, get<0>(actual_url)); |
336 EXPECT_EQ(rvh()->GetRoutingID(), msg->routing_id()); | 336 EXPECT_EQ(rvh()->GetRoutingID(), msg->routing_id()); |
337 process()->sink().ClearMessages(); | 337 process()->sink().ClearMessages(); |
338 } else { | 338 } else { |
339 ASSERT_FALSE(msg); | 339 ASSERT_FALSE(msg); |
340 } | 340 } |
341 } | 341 } |
342 | 342 |
343 void TestUnsafeResourceCopied(const UnsafeResource& resource) { | 343 void TestUnsafeResourceCopied(const UnsafeResource& resource) { |
344 ASSERT_TRUE(csd_host_->unsafe_resource_.get()); | 344 ASSERT_TRUE(csd_host_->unsafe_resource_.get()); |
345 // Test that the resource from OnSafeBrowsingHit notification was copied | 345 // Test that the resource from OnSafeBrowsingHit notification was copied |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 EXPECT_EQ(url, resource.url); | 1143 EXPECT_EQ(url, resource.url); |
1144 EXPECT_EQ(url, resource.original_url); | 1144 EXPECT_EQ(url, resource.original_url); |
1145 | 1145 |
1146 ExpectStartPhishingDetection(NULL); | 1146 ExpectStartPhishingDetection(NULL); |
1147 | 1147 |
1148 // Showing a phishing warning will invalidate all the weak pointers which | 1148 // Showing a phishing warning will invalidate all the weak pointers which |
1149 // means we will not extract malware features. | 1149 // means we will not extract malware features. |
1150 ExpectShouldClassifyForMalwareResult(false); | 1150 ExpectShouldClassifyForMalwareResult(false); |
1151 } | 1151 } |
1152 } // namespace safe_browsing | 1152 } // namespace safe_browsing |
OLD | NEW |