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 <string> | 8 #include <string> |
7 | 9 |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
10 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
11 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
12 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
13 #include "base/time/time.h" | 16 #include "base/time/time.h" |
14 #include "chrome/browser/safe_browsing/client_side_model_loader.h" | 17 #include "chrome/browser/safe_browsing/client_side_model_loader.h" |
15 #include "chrome/common/safe_browsing/client_model.pb.h" | 18 #include "chrome/common/safe_browsing/client_model.pb.h" |
16 #include "chrome/common/safe_browsing/csd.pb.h" | 19 #include "chrome/common/safe_browsing/csd.pb.h" |
17 #include "components/variations/variations_associated_data.h" | 20 #include "components/variations/variations_associated_data.h" |
18 #include "content/public/test/test_browser_thread_bundle.h" | 21 #include "content/public/test/test_browser_thread_bundle.h" |
(...skipping 12 matching lines...) Expand all Loading... |
31 namespace safe_browsing { | 34 namespace safe_browsing { |
32 namespace { | 35 namespace { |
33 | 36 |
34 class MockModelLoader : public ModelLoader { | 37 class MockModelLoader : public ModelLoader { |
35 public: | 38 public: |
36 explicit MockModelLoader(base::Closure update_renderers_callback, | 39 explicit MockModelLoader(base::Closure update_renderers_callback, |
37 const std::string model_name) | 40 const std::string model_name) |
38 : ModelLoader(update_renderers_callback, model_name) {} | 41 : ModelLoader(update_renderers_callback, model_name) {} |
39 ~MockModelLoader() override {} | 42 ~MockModelLoader() override {} |
40 | 43 |
41 MOCK_METHOD1(ScheduleFetch, void(int64)); | 44 MOCK_METHOD1(ScheduleFetch, void(int64_t)); |
42 MOCK_METHOD2(EndFetch, void(ClientModelStatus, base::TimeDelta)); | 45 MOCK_METHOD2(EndFetch, void(ClientModelStatus, base::TimeDelta)); |
43 | 46 |
44 private: | 47 private: |
45 DISALLOW_COPY_AND_ASSIGN(MockModelLoader); | 48 DISALLOW_COPY_AND_ASSIGN(MockModelLoader); |
46 }; | 49 }; |
47 | 50 |
48 } // namespace | 51 } // namespace |
49 | 52 |
50 class ModelLoaderTest : public testing::Test { | 53 class ModelLoaderTest : public testing::Test { |
51 protected: | 54 protected: |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 EXPECT_FALSE(ModelLoader::ModelHasValidHashIds(model)); | 336 EXPECT_FALSE(ModelLoader::ModelHasValidHashIds(model)); |
334 | 337 |
335 rule->set_feature(2, 2); | 338 rule->set_feature(2, 2); |
336 EXPECT_FALSE(ModelLoader::ModelHasValidHashIds(model)); | 339 EXPECT_FALSE(ModelLoader::ModelHasValidHashIds(model)); |
337 | 340 |
338 rule->set_feature(2, 1); | 341 rule->set_feature(2, 1); |
339 EXPECT_TRUE(ModelLoader::ModelHasValidHashIds(model)); | 342 EXPECT_TRUE(ModelLoader::ModelHasValidHashIds(model)); |
340 } | 343 } |
341 | 344 |
342 } // namespace safe_browsing | 345 } // namespace safe_browsing |
OLD | NEW |