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

Unified Diff: components/translate/core/browser/mock_translate_client.h

Issue 2906233004: Add translate client mock. (Closed)
Patch Set: fix comments Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: components/translate/core/browser/mock_translate_client.h
diff --git a/components/translate/core/browser/mock_translate_client.h b/components/translate/core/browser/mock_translate_client.h
new file mode 100644
index 0000000000000000000000000000000000000000..bf972ebbe9a25bd854fb1aadf8d11248e56f6f86
--- /dev/null
+++ b/components/translate/core/browser/mock_translate_client.h
@@ -0,0 +1,67 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_MOCK_TRANSLATE_CLIENT_H_
+#define COMPONENTS_TRANSLATE_CORE_BROWSER_MOCK_TRANSLATE_CLIENT_H_
+
+#include <memory>
+#include <string>
+
+#include "base/memory/ptr_util.h"
+#include "components/infobars/core/infobar.h"
+#include "components/translate/core/browser/translate_client.h"
+#include "components/translate/core/browser/translate_driver.h"
+#include "components/translate/core/browser/translate_prefs.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+namespace translate {
+
+namespace testing {
+
+extern const char* preferred_languages_prefs;
+extern const char* accept_languages_prefs;
+
+class MockTranslateClient : public TranslateClient {
+ public:
+ MockTranslateClient(TranslateDriver* driver, PrefService* prefs);
+
+ ~MockTranslateClient() override;
+
+ TranslateDriver* GetTranslateDriver() override;
+
+ PrefService* GetPrefs() override;
+
+ std::unique_ptr<TranslatePrefs> GetTranslatePrefs() override;
+
+ MOCK_METHOD0(GetTranslateAcceptLanguages, TranslateAcceptLanguages*());
+ MOCK_CONST_METHOD0(GetInfobarIconID, int());
+
+#if !defined(USE_AURA)
+ MOCK_CONST_METHOD1(CreateInfoBarMock,
+ infobars::InfoBar*(TranslateInfoBarDelegate*));
+ std::unique_ptr<infobars::InfoBar> CreateInfoBar(
+ std::unique_ptr<TranslateInfoBarDelegate> delegate) const {
+ return base::WrapUnique(CreateInfoBarMock(delegate.get()));
+ }
+#endif
+
+ MOCK_METHOD5(ShowTranslateUI,
+ void(translate::TranslateStep,
+ const std::string&,
+ const std::string&,
+ TranslateErrors::Type,
+ bool));
+ MOCK_METHOD1(IsTranslatableURL, bool(const GURL&));
+ MOCK_METHOD1(ShowReportLanguageDetectionErrorUI, void(const GURL&));
+
+ private:
+ TranslateDriver* driver_;
+ PrefService* prefs_;
+};
+
+} // namespace testing
+
+} // namespace translate
+
+#endif // COMPONENTS_TRANSLATE_CORE_BROWSER_MOCK_TRANSLATE_CLIENT_H_
« no previous file with comments | « components/translate/core/browser/BUILD.gn ('k') | components/translate/core/browser/mock_translate_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698