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

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

Issue 2913593002: Implementation of translation event logging. (Closed)
Patch Set: fix Created 3 years, 6 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
« no previous file with comments | « components/translate/DEPS ('k') | components/translate/core/browser/translate_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_MOCK_TRANSLATE_CLIENT_H_ 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_MOCK_TRANSLATE_CLIENT_H_
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_MOCK_TRANSLATE_CLIENT_H_ 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_MOCK_TRANSLATE_CLIENT_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "components/infobars/core/infobar.h" 12 #include "components/infobars/core/infobar.h"
13 #include "components/metrics/proto/translate_event.pb.h"
13 #include "components/translate/core/browser/translate_client.h" 14 #include "components/translate/core/browser/translate_client.h"
14 #include "components/translate/core/browser/translate_driver.h" 15 #include "components/translate/core/browser/translate_driver.h"
15 #include "components/translate/core/browser/translate_prefs.h" 16 #include "components/translate/core/browser/translate_prefs.h"
16 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
17 18
18 namespace translate { 19 namespace translate {
19 20
20 namespace testing { 21 namespace testing {
21 22
22 extern const char* preferred_languages_prefs; 23 extern const char* preferred_languages_prefs;
23 extern const char* accept_languages_prefs; 24 extern const char* accept_languages_prefs;
24 25
25 class MockTranslateClient : public TranslateClient { 26 class MockTranslateClient : public TranslateClient {
26 public: 27 public:
27 MockTranslateClient(TranslateDriver* driver, PrefService* prefs); 28 MockTranslateClient(TranslateDriver* driver, PrefService* prefs);
28 29
29 ~MockTranslateClient() override; 30 ~MockTranslateClient() override;
30 31
31 TranslateDriver* GetTranslateDriver() override; 32 TranslateDriver* GetTranslateDriver() override;
32 33
33 PrefService* GetPrefs() override; 34 PrefService* GetPrefs() override;
34 35
35 std::unique_ptr<TranslatePrefs> GetTranslatePrefs() override; 36 std::unique_ptr<TranslatePrefs> GetTranslatePrefs() override;
36 37
37 MOCK_METHOD0(GetTranslateAcceptLanguages, TranslateAcceptLanguages*()); 38 MOCK_METHOD0(GetTranslateAcceptLanguages, TranslateAcceptLanguages*());
38 MOCK_CONST_METHOD0(GetInfobarIconID, int()); 39 MOCK_CONST_METHOD0(GetInfobarIconID, int());
40 MOCK_METHOD1(RecordTranslateEvent, void(const metrics::TranslateEventProto&));
39 41
40 #if !defined(USE_AURA) 42 #if !defined(USE_AURA)
41 MOCK_CONST_METHOD1(CreateInfoBarMock, 43 MOCK_CONST_METHOD1(CreateInfoBarMock,
42 infobars::InfoBar*(TranslateInfoBarDelegate*)); 44 infobars::InfoBar*(TranslateInfoBarDelegate*));
43 std::unique_ptr<infobars::InfoBar> CreateInfoBar( 45 std::unique_ptr<infobars::InfoBar> CreateInfoBar(
44 std::unique_ptr<TranslateInfoBarDelegate> delegate) const { 46 std::unique_ptr<TranslateInfoBarDelegate> delegate) const {
45 return base::WrapUnique(CreateInfoBarMock(delegate.get())); 47 return base::WrapUnique(CreateInfoBarMock(delegate.get()));
46 } 48 }
47 #endif 49 #endif
48 50
49 MOCK_METHOD5(ShowTranslateUI, 51 MOCK_METHOD5(ShowTranslateUI,
50 void(translate::TranslateStep, 52 void(translate::TranslateStep,
51 const std::string&, 53 const std::string&,
52 const std::string&, 54 const std::string&,
53 TranslateErrors::Type, 55 TranslateErrors::Type,
54 bool)); 56 bool));
55 MOCK_METHOD1(IsTranslatableURL, bool(const GURL&)); 57 MOCK_METHOD1(IsTranslatableURL, bool(const GURL&));
56 MOCK_METHOD1(ShowReportLanguageDetectionErrorUI, void(const GURL&)); 58 MOCK_METHOD1(ShowReportLanguageDetectionErrorUI, void(const GURL&));
57 59
58 private: 60 private:
59 TranslateDriver* driver_; 61 TranslateDriver* driver_;
60 PrefService* prefs_; 62 PrefService* prefs_;
61 }; 63 };
62 64
63 } // namespace testing 65 } // namespace testing
64 66
65 } // namespace translate 67 } // namespace translate
66 68
67 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_MOCK_TRANSLATE_CLIENT_H_ 69 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_MOCK_TRANSLATE_CLIENT_H_
OLDNEW
« no previous file with comments | « components/translate/DEPS ('k') | components/translate/core/browser/translate_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698