| 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 <stdint.h> |
| 6 |
| 5 #include <map> | 7 #include <map> |
| 6 #include <queue> | 8 #include <queue> |
| 7 #include <string> | 9 #include <string> |
| 8 | 10 |
| 9 #include "base/bind.h" | 11 #include "base/bind.h" |
| 10 #include "base/callback.h" | 12 #include "base/callback.h" |
| 11 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
| 14 #include "base/metrics/field_trial.h" | 17 #include "base/metrics/field_trial.h" |
| 15 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 17 #include "chrome/browser/safe_browsing/client_side_detection_service.h" | 20 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
| 18 #include "chrome/common/safe_browsing/client_model.pb.h" | 21 #include "chrome/common/safe_browsing/client_model.pb.h" |
| 19 #include "chrome/common/safe_browsing/csd.pb.h" | 22 #include "chrome/common/safe_browsing/csd.pb.h" |
| 20 #include "components/variations/variations_associated_data.h" | 23 #include "components/variations/variations_associated_data.h" |
| 21 #include "content/public/test/test_browser_thread.h" | 24 #include "content/public/test/test_browser_thread.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 35 | 38 |
| 36 namespace safe_browsing { | 39 namespace safe_browsing { |
| 37 namespace { | 40 namespace { |
| 38 | 41 |
| 39 class MockModelLoader : public ModelLoader { | 42 class MockModelLoader : public ModelLoader { |
| 40 public: | 43 public: |
| 41 explicit MockModelLoader(const std::string& model_name) | 44 explicit MockModelLoader(const std::string& model_name) |
| 42 : ModelLoader(base::Closure(), model_name) {} | 45 : ModelLoader(base::Closure(), model_name) {} |
| 43 ~MockModelLoader() override {} | 46 ~MockModelLoader() override {} |
| 44 | 47 |
| 45 MOCK_METHOD1(ScheduleFetch, void(int64)); | 48 MOCK_METHOD1(ScheduleFetch, void(int64_t)); |
| 46 MOCK_METHOD0(CancelFetcher, void()); | 49 MOCK_METHOD0(CancelFetcher, void()); |
| 47 | 50 |
| 48 private: | 51 private: |
| 49 DISALLOW_COPY_AND_ASSIGN(MockModelLoader); | 52 DISALLOW_COPY_AND_ASSIGN(MockModelLoader); |
| 50 }; | 53 }; |
| 51 | 54 |
| 52 class MockClientSideDetectionService : public ClientSideDetectionService { | 55 class MockClientSideDetectionService : public ClientSideDetectionService { |
| 53 public: | 56 public: |
| 54 MockClientSideDetectionService() : ClientSideDetectionService(NULL) {} | 57 MockClientSideDetectionService() : ClientSideDetectionService(NULL) {} |
| 55 | 58 |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 | 480 |
| 478 // Check that disabling again doesn't request the model. | 481 // Check that disabling again doesn't request the model. |
| 479 csd_service_->SetEnabledAndRefreshState(false); | 482 csd_service_->SetEnabledAndRefreshState(false); |
| 480 // No calls expected. | 483 // No calls expected. |
| 481 msg_loop_.RunUntilIdle(); | 484 msg_loop_.RunUntilIdle(); |
| 482 Mock::VerifyAndClearExpectations(service); | 485 Mock::VerifyAndClearExpectations(service); |
| 483 Mock::VerifyAndClearExpectations(loader_1); | 486 Mock::VerifyAndClearExpectations(loader_1); |
| 484 Mock::VerifyAndClearExpectations(loader_2); | 487 Mock::VerifyAndClearExpectations(loader_2); |
| 485 } | 488 } |
| 486 } // namespace safe_browsing | 489 } // namespace safe_browsing |
| OLD | NEW |