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

Side by Side Diff: chrome/browser/speech/extension_api/tts_extension_api_controller_unittest.cc

Issue 9967021: Uses a system-wide notion of isSpeaking in the Mac extension TTS api. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revised description for IsSpeaking based on comment. Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Unit tests for the TTS API Controller. 5 // Unit tests for the TTS API Controller.
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/speech/extension_api/tts_extension_api_controller.h" 10 #include "chrome/browser/speech/extension_api/tts_extension_api_controller.h"
11 #include "chrome/browser/speech/extension_api/tts_extension_api_platform.h" 11 #include "chrome/browser/speech/extension_api/tts_extension_api_platform.h"
12 12
13 class ExtensionTtsApiControllerTest : public testing::Test { 13 class ExtensionTtsApiControllerTest : public testing::Test {
14 }; 14 };
15 15
16 // Platform Tts implementation that does nothing. 16 // Platform Tts implementation that does nothing.
17 class DummyExtensionTtsPlatformImpl : public ExtensionTtsPlatformImpl { 17 class DummyExtensionTtsPlatformImpl : public ExtensionTtsPlatformImpl {
18 public: 18 public:
19 DummyExtensionTtsPlatformImpl() {} 19 DummyExtensionTtsPlatformImpl() {}
20 virtual ~DummyExtensionTtsPlatformImpl() {} 20 virtual ~DummyExtensionTtsPlatformImpl() {}
21 virtual bool PlatformImplAvailable() { return true; } 21 virtual bool PlatformImplAvailable() { return true; }
22 virtual bool Speak( 22 virtual bool Speak(
23 int utterance_id, 23 int utterance_id,
24 const std::string& utterance, 24 const std::string& utterance,
25 const std::string& lang, 25 const std::string& lang,
26 const UtteranceContinuousParameters& params) { 26 const UtteranceContinuousParameters& params) {
27 return true; 27 return true;
28 } 28 }
29 virtual bool IsSpeaking() { return false; }
29 virtual bool StopSpeaking() { return true; } 30 virtual bool StopSpeaking() { return true; }
30 virtual bool SendsEvent(TtsEventType event_type) { return false; } 31 virtual bool SendsEvent(TtsEventType event_type) { return false; }
31 virtual std::string gender() { return std::string(); } 32 virtual std::string gender() { return std::string(); }
32 virtual std::string error() { return std::string(); } 33 virtual std::string error() { return std::string(); }
33 virtual void clear_error() {} 34 virtual void clear_error() {}
34 virtual void set_error(const std::string& error) {} 35 virtual void set_error(const std::string& error) {}
35 }; 36 };
36 37
37 // Subclass of ExtensionTtsController with a public ctor and dtor. 38 // Subclass of ExtensionTtsController with a public ctor and dtor.
38 class TestableExtensionTtsController : public ExtensionTtsController { 39 class TestableExtensionTtsController : public ExtensionTtsController {
(...skipping 15 matching lines...) Expand all
54 55
55 Utterance* utterance2 = new Utterance(NULL); 56 Utterance* utterance2 = new Utterance(NULL);
56 utterance2->set_can_enqueue(true); 57 utterance2->set_can_enqueue(true);
57 utterance2->set_src_id(2); 58 utterance2->set_src_id(2);
58 controller->SpeakOrEnqueue(utterance2); 59 controller->SpeakOrEnqueue(utterance2);
59 60
60 // Make sure that deleting the controller when there are pending 61 // Make sure that deleting the controller when there are pending
61 // utterances doesn't cause a crash. 62 // utterances doesn't cause a crash.
62 delete controller; 63 delete controller;
63 } 64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698