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