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/file_path.h" | 5 #include "base/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/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "chrome/browser/safe_browsing/browser_feature_extractor.h" | 9 #include "chrome/browser/safe_browsing/browser_feature_extractor.h" |
10 #include "chrome/browser/safe_browsing/client_side_detection_host.h" | 10 #include "chrome/browser/safe_browsing/client_side_detection_host.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 // parse. | 316 // parse. |
317 MockBrowserFeatureExtractor* mock_extractor = new MockBrowserFeatureExtractor( | 317 MockBrowserFeatureExtractor* mock_extractor = new MockBrowserFeatureExtractor( |
318 contents(), | 318 contents(), |
319 csd_service_.get()); | 319 csd_service_.get()); |
320 SetFeatureExtractor(mock_extractor); // The host class takes ownership. | 320 SetFeatureExtractor(mock_extractor); // The host class takes ownership. |
321 EXPECT_CALL(*mock_extractor, ExtractFeatures(_, _, _)).Times(0); | 321 EXPECT_CALL(*mock_extractor, ExtractFeatures(_, _, _)).Times(0); |
322 OnPhishingDetectionDone("Invalid Protocol Buffer"); | 322 OnPhishingDetectionDone("Invalid Protocol Buffer"); |
323 EXPECT_TRUE(Mock::VerifyAndClear(mock_extractor)); | 323 EXPECT_TRUE(Mock::VerifyAndClear(mock_extractor)); |
324 } | 324 } |
325 | 325 |
326 TEST_F(ClientSideDetectionHostTest, OnPhishingDetectionDoneNotPhishing) { | 326 #if defined(OS_LINUX) |
| 327 // Crashes on linux_chromeos. http://crbug.com/115979 |
| 328 #define MAYBE_OnPhishingDetectionDoneNotPhishing \ |
| 329 DISABLED_OnPhishingDetectionDoneNotPhishing |
| 330 #else |
| 331 #define MAYBE_OnPhishingDetectionDoneNotPhishing \ |
| 332 OnPhishingDetectionDoneNotPhishing |
| 333 #endif |
| 334 |
| 335 TEST_F(ClientSideDetectionHostTest, |
| 336 MAYBE_OnPhishingDetectionDoneNotPhishing) { |
327 // Case 1: client thinks the page is phishing. The server does not agree. | 337 // Case 1: client thinks the page is phishing. The server does not agree. |
328 // No interstitial is shown. | 338 // No interstitial is shown. |
329 MockBrowserFeatureExtractor* mock_extractor = new MockBrowserFeatureExtractor( | 339 MockBrowserFeatureExtractor* mock_extractor = new MockBrowserFeatureExtractor( |
330 contents(), | 340 contents(), |
331 csd_service_.get()); | 341 csd_service_.get()); |
332 SetFeatureExtractor(mock_extractor); // The host class takes ownership. | 342 SetFeatureExtractor(mock_extractor); // The host class takes ownership. |
333 | 343 |
334 ClientSideDetectionService::ClientReportPhishingRequestCallback cb; | 344 ClientSideDetectionService::ClientReportPhishingRequestCallback cb; |
335 ClientPhishingRequest verdict; | 345 ClientPhishingRequest verdict; |
336 verdict.set_url("http://phishingurl.com/"); | 346 verdict.set_url("http://phishingurl.com/"); |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 EXPECT_TRUE(Mock::VerifyAndClear(sb_service_.get())); | 758 EXPECT_TRUE(Mock::VerifyAndClear(sb_service_.get())); |
749 EXPECT_EQ(url, resource.url); | 759 EXPECT_EQ(url, resource.url); |
750 EXPECT_EQ(url, resource.original_url); | 760 EXPECT_EQ(url, resource.original_url); |
751 resource.callback.Reset(); | 761 resource.callback.Reset(); |
752 msg = process()->sink().GetFirstMessageMatching( | 762 msg = process()->sink().GetFirstMessageMatching( |
753 SafeBrowsingMsg_StartPhishingDetection::ID); | 763 SafeBrowsingMsg_StartPhishingDetection::ID); |
754 ASSERT_FALSE(msg); | 764 ASSERT_FALSE(msg); |
755 } | 765 } |
756 | 766 |
757 } // namespace safe_browsing | 767 } // namespace safe_browsing |
OLD | NEW |