| 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 <map> | 5 #include <map> |
| 6 #include <queue> | 6 #include <queue> |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 ACTION(QuitCurrentMessageLoop) { | 57 ACTION(QuitCurrentMessageLoop) { |
| 58 base::MessageLoop::current()->Quit(); | 58 base::MessageLoop::current()->Quit(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace | 61 } // namespace |
| 62 | 62 |
| 63 class ClientSideDetectionServiceTest : public testing::Test { | 63 class ClientSideDetectionServiceTest : public testing::Test { |
| 64 protected: | 64 protected: |
| 65 virtual void SetUp() { | 65 void SetUp() override { |
| 66 file_thread_.reset(new content::TestBrowserThread(BrowserThread::FILE, | 66 file_thread_.reset(new content::TestBrowserThread(BrowserThread::FILE, |
| 67 &msg_loop_)); | 67 &msg_loop_)); |
| 68 | 68 |
| 69 factory_.reset(new net::FakeURLFetcherFactory(NULL)); | 69 factory_.reset(new net::FakeURLFetcherFactory(NULL)); |
| 70 | 70 |
| 71 browser_thread_.reset(new content::TestBrowserThread(BrowserThread::UI, | 71 browser_thread_.reset(new content::TestBrowserThread(BrowserThread::UI, |
| 72 &msg_loop_)); | 72 &msg_loop_)); |
| 73 } | 73 } |
| 74 | 74 |
| 75 virtual void TearDown() { | 75 void TearDown() override { |
| 76 msg_loop_.RunUntilIdle(); | 76 msg_loop_.RunUntilIdle(); |
| 77 csd_service_.reset(); | 77 csd_service_.reset(); |
| 78 file_thread_.reset(); | 78 file_thread_.reset(); |
| 79 browser_thread_.reset(); | 79 browser_thread_.reset(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool SendClientReportPhishingRequest(const GURL& phishing_url, | 82 bool SendClientReportPhishingRequest(const GURL& phishing_url, |
| 83 float score) { | 83 float score) { |
| 84 ClientPhishingRequest* request = new ClientPhishingRequest(); | 84 ClientPhishingRequest* request = new ClientPhishingRequest(); |
| 85 request->set_url(phishing_url.spec()); | 85 request->set_url(phishing_url.spec()); |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 EXPECT_CALL(*service, ScheduleFetchModel(_)) | 695 EXPECT_CALL(*service, ScheduleFetchModel(_)) |
| 696 .WillOnce(Invoke(service, &MockClientSideDetectionService::Schedule)); | 696 .WillOnce(Invoke(service, &MockClientSideDetectionService::Schedule)); |
| 697 EXPECT_CALL(*service, EndFetchModel( | 697 EXPECT_CALL(*service, EndFetchModel( |
| 698 ClientSideDetectionService::MODEL_NOT_CHANGED)) | 698 ClientSideDetectionService::MODEL_NOT_CHANGED)) |
| 699 .WillOnce(Invoke(service, &MockClientSideDetectionService::Disable)); | 699 .WillOnce(Invoke(service, &MockClientSideDetectionService::Disable)); |
| 700 csd_service_->SetEnabledAndRefreshState(true); | 700 csd_service_->SetEnabledAndRefreshState(true); |
| 701 EXPECT_FALSE(SendClientReportPhishingRequest(GURL("http://a.com/"), 0.4f)); | 701 EXPECT_FALSE(SendClientReportPhishingRequest(GURL("http://a.com/"), 0.4f)); |
| 702 Mock::VerifyAndClearExpectations(service); | 702 Mock::VerifyAndClearExpectations(service); |
| 703 } | 703 } |
| 704 } // namespace safe_browsing | 704 } // namespace safe_browsing |
| OLD | NEW |