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

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

Issue 27034009: Implement Google network speech synthesis (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert change to register_engine for now, rebase for relanding Created 7 years, 1 month 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 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/memory/weak_ptr.h" 7 #include "base/memory/weak_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "chrome/browser/extensions/component_loader.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/speech/extension_api/tts_extension_api.h" 13 #include "chrome/browser/speech/extension_api/tts_extension_api.h"
11 #include "chrome/browser/speech/tts_controller.h" 14 #include "chrome/browser/speech/tts_controller.h"
12 #include "chrome/browser/speech/tts_platform.h" 15 #include "chrome/browser/speech/tts_platform.h"
13 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
14 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
16 19
17 // Needed for CreateFunctor. 20 // Needed for CreateFunctor.
18 #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING 21 #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
19 #include "testing/gmock_mutant.h" 22 #include "testing/gmock_mutant.h"
20 23
21 using ::testing::AnyNumber; 24 using ::testing::AnyNumber;
22 using ::testing::CreateFunctor; 25 using ::testing::CreateFunctor;
23 using ::testing::DoAll; 26 using ::testing::DoAll;
24 using ::testing::InSequence; 27 using ::testing::InSequence;
25 using ::testing::InvokeWithoutArgs; 28 using ::testing::InvokeWithoutArgs;
26 using ::testing::Return; 29 using ::testing::Return;
27 using ::testing::SaveArg; 30 using ::testing::SaveArg;
28 using ::testing::StrictMock; 31 using ::testing::StrictMock;
29 using ::testing::_; 32 using ::testing::_;
30 33
31 namespace { 34 namespace {
32 int g_saved_utterance_id; 35 int g_saved_utterance_id;
33 } 36 }
34 37
38 namespace extensions {
39
35 class MockTtsPlatformImpl : public TtsPlatformImpl { 40 class MockTtsPlatformImpl : public TtsPlatformImpl {
36 public: 41 public:
37 MockTtsPlatformImpl() 42 MockTtsPlatformImpl()
38 : ptr_factory_(this) {} 43 : ptr_factory_(this) {}
39 44
40 virtual bool PlatformImplAvailable() { 45 virtual bool PlatformImplAvailable() {
41 return true; 46 return true;
42 } 47 }
43 48
44 MOCK_METHOD5(Speak, 49 MOCK_METHOD5(Speak,
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } 373 }
369 374
370 IN_PROC_BROWSER_TEST_F(TtsApiTest, LangMatching) { 375 IN_PROC_BROWSER_TEST_F(TtsApiTest, LangMatching) {
371 EXPECT_CALL(mock_platform_impl_, IsSpeaking()); 376 EXPECT_CALL(mock_platform_impl_, IsSpeaking());
372 EXPECT_CALL(mock_platform_impl_, StopSpeaking()) 377 EXPECT_CALL(mock_platform_impl_, StopSpeaking())
373 .WillRepeatedly(Return(true)); 378 .WillRepeatedly(Return(true));
374 379
375 ASSERT_TRUE(RunExtensionTest("tts_engine/lang_matching")) << message_; 380 ASSERT_TRUE(RunExtensionTest("tts_engine/lang_matching")) << message_;
376 } 381 }
377 382
383 IN_PROC_BROWSER_TEST_F(TtsApiTest, NetworkSpeechEngine) {
384 ExtensionService* service = extensions::ExtensionSystem::Get(
385 profile())->extension_service();
386 service->component_loader()->AddNetworkSpeechSynthesisExtension();
387 ASSERT_TRUE(RunExtensionTest("tts_engine/network_speech_engine")) << message_;
388 }
389
378 // http://crbug.com/122474 390 // http://crbug.com/122474
379 IN_PROC_BROWSER_TEST_F(TtsApiTest, EngineApi) { 391 IN_PROC_BROWSER_TEST_F(TtsApiTest, EngineApi) {
380 ASSERT_TRUE(RunExtensionTest("tts_engine/engine_api")) << message_; 392 ASSERT_TRUE(RunExtensionTest("tts_engine/engine_api")) << message_;
381 } 393 }
394
395 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/speech/extension_api/tts_extension_api_constants.cc ('k') | chrome/browser/speech/tts_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698