1 // Copyright 2019 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 CONTENT_WEB_TEST_BROWSER_WEB_TEST_TTS_PLATFORM_H_ 6 #define CONTENT_WEB_TEST_BROWSER_WEB_TEST_TTS_PLATFORM_H_ 7 8 #include "base/memory/singleton.h" 9 #include "content/public/browser/tts_platform.h" 10 11 // Dummy implementation of TtsPlatform for web tests. 12 // Currently does nothing interesting but could be extended to enable more 13 // detailed testing. 14 class WebTestTtsPlatform : public content::TtsPlatform { 15 public: 16 static WebTestTtsPlatform* GetInstance(); 17 18 // content::TtsControllerDelegate overrides. 19 bool PlatformImplSupported() override; 20 bool PlatformImplInitialized() override; 21 bool LoadBuiltInTtsEngine(content::BrowserContext* browser_context) override; 22 void Speak(int utterance_id, 23 const std::string& utterance, 24 const std::string& lang, 25 const content::VoiceData& voice, 26 const content::UtteranceContinuousParameters& params, 27 base::OnceCallback<void(bool)> on_speak_finished) override; 28 bool StopSpeaking() override; 29 bool IsSpeaking() override; 30 void GetVoices(std::vector<content::VoiceData>* out_voices) override; 31 void Pause() override; 32 void Resume() override; 33 void WillSpeakUtteranceWithVoice( 34 content::TtsUtterance* utterance, 35 const content::VoiceData& voice_data) override; 36 std::string GetError() override; 37 void ClearError() override; 38 void SetError(const std::string& error) override; 39 void Shutdown() override; 40 41 private: 42 WebTestTtsPlatform(); 43 virtual ~WebTestTtsPlatform(); 44 45 friend struct base::DefaultSingletonTraits<WebTestTtsPlatform>; 46 47 DISALLOW_COPY_AND_ASSIGN(WebTestTtsPlatform); 48 }; 49 50 #endif // CONTENT_WEB_TEST_BROWSER_WEB_TEST_TTS_PLATFORM_H_ 51