Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: components/translate/core/browser/mock_translate_ranker.h

Issue 2565873002: [translate] Add translate ranker model loader. (Closed)
Patch Set: comments from sdefresne Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_MOCK_TRANSLATE_RANKER_H_
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_MOCK_TRANSLATE_RANKER_H_
7
8 #include <memory>
9 #include <string>
10 #include <vector>
11
12 #include "components/translate/core/browser/translate_ranker.h"
13
14 namespace metrics {
15 class TranslateEventProto;
16 }
17
18 namespace translate {
19
20 class TranslatePrefs;
21
22 namespace testing {
23
24 class MockTranslateRanker : public TranslateRanker {
25 public:
26 MockTranslateRanker();
27 ~MockTranslateRanker() override;
28
29 void set_is_logging_enabled(bool val) { is_logging_enabled_ = val; }
30 void set_is_query_enabled(bool val) { is_query_enabled_ = val; }
31 void set_is_enforcement_enabled(bool val) { is_enforcement_enabled_ = val; }
32 void set_model_version(int val) { model_version_ = val; }
33 void set_should_offer_translation(bool val) {
34 should_offer_translation_ = val;
35 }
36
37 // TranslateRanker...
38 bool IsLoggingEnabled() override;
39 bool IsQueryEnabled() override;
40 bool IsEnforcementEnabled() override;
41 int GetModelVersion() const override;
42 bool ShouldOfferTranslation(const TranslatePrefs& translate_prefs,
43 const std::string& src_lang,
44 const std::string& dst_lang) override;
45 void AddTranslateEvent(
46 const metrics::TranslateEventProto& translate_event) override;
47 void FlushTranslateEvents(
48 std::vector<metrics::TranslateEventProto>* events) override;
49
50 private:
51 std::vector<metrics::TranslateEventProto> event_cache_;
52
53 bool is_logging_enabled_ = false;
54 bool is_query_enabled_ = false;
55 bool is_enforcement_enabled_ = false;
56 bool model_version_ = 0;
57 bool should_offer_translation_ = true;
58
59 DISALLOW_COPY_AND_ASSIGN(MockTranslateRanker);
60 };
61
62 } // namespace testing
63 } // namespace translate
64
65 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_MOCK_TRANSLATE_RANKER_H_
OLDNEW
« no previous file with comments | « components/translate/core/browser/BUILD.gn ('k') | components/translate/core/browser/mock_translate_ranker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698