| 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 namespace testing { |
| 21 |
| 22 extern const char* preferred_languages_prefs; |
| 23 extern const char* accept_languages_prefs; |
| 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(delegate.get())); |
| 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 |