Home | History | Annotate | Download | only in desktopui_SpeechSynthesisSemiAuto
      1 # Copyright (c) 2010 The Chromium OS 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 import utils, dbus
      6 from autotest_lib.client.bin import test
      7 from autotest_lib.client.common_lib import error
      8 
      9 class desktopui_SpeechSynthesisSemiAuto(test.test):
     10   version = 1
     11 
     12   def run_once(self):
     13     # Start the speech_synthesizer DBus service
     14     utils.system('sudo /usr/sbin/speech_synthesizer &')
     15     # Test if the TTS service works by using the DBus API
     16     # If successful, the synthesized audio should be heard
     17     bus = dbus.SystemBus()
     18     proxy = bus.get_object("org.chromium.SpeechSynthesizer",
     19                            "/org/chromium/SpeechSynthesizer")
     20     speech = dbus.Interface(proxy, "org.chromium.SpeechSynthesizerInterface")
     21     res = speech.Speak("Welcome to Chromium O S")
     22     if res == False:
     23       raise error.TestFail('Speak call failed.')
     24