Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_MOCK_TRANSLATE_CLIENT_H_ | |
| 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_MOCK_TRANSLATE_CLIENT_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/memory/ptr_util.h" | |
| 12 #include "components/infobars/core/infobar.h" | |
| 13 #include "components/translate/core/browser/translate_client.h" | |
| 14 #include "components/translate/core/browser/translate_driver.h" | |
| 15 #include "components/translate/core/browser/translate_prefs.h" | |
| 16 #include "testing/gmock/include/gmock/gmock.h" | |
| 17 | |
| 18 namespace translate { | |
| 19 | |
| 20 extern const char* preferred_languages_prefs; | |
|
groby-ooo-7-16
2017/05/31 00:41:15
We really shouldn't expose global constants from a
napper
2017/05/31 01:16:37
Yes this isn't very nice. Can you put the constant
Leo
2017/05/31 01:38:26
Thanks for the concern and tips. I moved these to
| |
| 21 extern const char* accept_languages_prefs; | |
| 22 | |
| 23 namespace testing { | |
| 24 | |
| 25 class MockTranslateClient : public TranslateClient { | |
| 26 public: | |
| 27 MockTranslateClient(TranslateDriver* driver, PrefService* prefs); | |
| 28 | |
| 29 ~MockTranslateClient() override; | |
| 30 | |
| 31 TranslateDriver* GetTranslateDriver() override; | |
| 32 | |
| 33 PrefService* GetPrefs() override; | |
| 34 | |
| 35 std::unique_ptr<TranslatePrefs> GetTranslatePrefs() override; | |
| 36 | |
| 37 MOCK_METHOD0(GetTranslateAcceptLanguages, TranslateAcceptLanguages*()); | |
| 38 MOCK_CONST_METHOD0(GetInfobarIconID, int()); | |
| 39 | |
| 40 #if !defined(USE_AURA) | |
| 41 MOCK_CONST_METHOD1(CreateInfoBarMock, | |
| 42 infobars::InfoBar*(TranslateInfoBarDelegate*)); | |
| 43 std::unique_ptr<infobars::InfoBar> CreateInfoBar( | |
| 44 std::unique_ptr<TranslateInfoBarDelegate> delegate) const { | |
| 45 return base::WrapUnique(CreateInfoBarMock(std::move(delegate).get())); | |
|
napper
2017/05/30 06:24:36
This doesn't make sense to me:
std::move(delegate
groby-ooo-7-16
2017/05/31 00:41:15
I've done digging through history, and it seems th
Leo
2017/05/31 01:38:26
Great to know the details.
Removed std::move()
| |
| 46 } | |
| 47 #endif | |
| 48 | |
| 49 MOCK_METHOD5(ShowTranslateUI, | |
| 50 void(translate::TranslateStep, | |
| 51 const std::string&, | |
| 52 const std::string&, | |
| 53 TranslateErrors::Type, | |
| 54 bool)); | |
| 55 MOCK_METHOD1(IsTranslatableURL, bool(const GURL&)); | |
| 56 MOCK_METHOD1(ShowReportLanguageDetectionErrorUI, void(const GURL&)); | |
| 57 | |
| 58 private: | |
| 59 TranslateDriver* driver_; | |
| 60 PrefService* prefs_; | |
| 61 }; | |
| 62 | |
| 63 } // namespace testing | |
| 64 | |
| 65 } // namespace translate | |
| 66 | |
| 67 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_MOCK_TRANSLATE_CLIENT_H_ | |
| OLD | NEW |