OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "components/translate/core/common/translation_logging_helper.h" | 5 #include "components/translate/core/common/translation_logging_helper.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "components/metrics/proto/translate_event.pb.h" | 10 #include "components/metrics/proto/translate_event.pb.h" |
11 #include "components/sync/protocol/user_event_specifics.pb.h" | 11 #include "components/sync/protocol/user_event_specifics.pb.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 using metrics::TranslateEventProto; | 14 using metrics::TranslateEventProto; |
15 using sync_pb::Translation; | 15 using Translation = sync_pb::UserEventSpecifics::Translation; |
16 | 16 |
17 void EqualTranslationProto(const Translation& first, | 17 void EqualTranslationProto(const Translation& first, |
18 const Translation& second) { | 18 const Translation& second) { |
19 EXPECT_EQ(first.from_language_code(), second.from_language_code()); | 19 EXPECT_EQ(first.from_language_code(), second.from_language_code()); |
20 EXPECT_EQ(first.to_language_code(), second.to_language_code()); | 20 EXPECT_EQ(first.to_language_code(), second.to_language_code()); |
21 EXPECT_EQ(first.interaction(), second.interaction()); | 21 EXPECT_EQ(first.interaction(), second.interaction()); |
22 } | 22 } |
23 | 23 |
24 namespace translate { | 24 namespace translate { |
25 | 25 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 translation_event.set_event_type(TranslateEventProto::DISABLED_BY_RANKER); | 80 translation_event.set_event_type(TranslateEventProto::DISABLED_BY_RANKER); |
81 // The user event. | 81 // The user event. |
82 sync_pb::UserEventSpecifics user_specifics; | 82 sync_pb::UserEventSpecifics user_specifics; |
83 const bool needs_logging = | 83 const bool needs_logging = |
84 ConstructTranslateEvent(100, translation_event, &user_specifics); | 84 ConstructTranslateEvent(100, translation_event, &user_specifics); |
85 // We don't expect the event to be logged. | 85 // We don't expect the event to be logged. |
86 EXPECT_FALSE(needs_logging); | 86 EXPECT_FALSE(needs_logging); |
87 } | 87 } |
88 | 88 |
89 } // namespace translate | 89 } // namespace translate |
OLD | NEW |