| OLD | NEW |
| 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" | |
| 10 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | |
| 12 #include "chrome/browser/extensions/extension_system.h" | |
| 13 #include "chrome/browser/speech/extension_api/tts_extension_api.h" | 10 #include "chrome/browser/speech/extension_api/tts_extension_api.h" |
| 14 #include "chrome/browser/speech/tts_controller.h" | 11 #include "chrome/browser/speech/tts_controller.h" |
| 15 #include "chrome/browser/speech/tts_platform.h" | 12 #include "chrome/browser/speech/tts_platform.h" |
| 16 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 17 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 16 |
| 20 // Needed for CreateFunctor. | 17 // Needed for CreateFunctor. |
| 21 #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING | 18 #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 22 #include "testing/gmock_mutant.h" | 19 #include "testing/gmock_mutant.h" |
| 23 | 20 |
| 24 using ::testing::AnyNumber; | 21 using ::testing::AnyNumber; |
| 25 using ::testing::CreateFunctor; | 22 using ::testing::CreateFunctor; |
| 26 using ::testing::DoAll; | 23 using ::testing::DoAll; |
| 27 using ::testing::InSequence; | 24 using ::testing::InSequence; |
| 28 using ::testing::InvokeWithoutArgs; | 25 using ::testing::InvokeWithoutArgs; |
| 29 using ::testing::Return; | 26 using ::testing::Return; |
| 30 using ::testing::SaveArg; | 27 using ::testing::SaveArg; |
| 31 using ::testing::StrictMock; | 28 using ::testing::StrictMock; |
| 32 using ::testing::_; | 29 using ::testing::_; |
| 33 | 30 |
| 34 namespace { | 31 namespace { |
| 35 int g_saved_utterance_id; | 32 int g_saved_utterance_id; |
| 36 } | 33 } |
| 37 | 34 |
| 38 namespace extensions { | |
| 39 | |
| 40 class MockTtsPlatformImpl : public TtsPlatformImpl { | 35 class MockTtsPlatformImpl : public TtsPlatformImpl { |
| 41 public: | 36 public: |
| 42 MockTtsPlatformImpl() | 37 MockTtsPlatformImpl() |
| 43 : ptr_factory_(this) {} | 38 : ptr_factory_(this) {} |
| 44 | 39 |
| 45 virtual bool PlatformImplAvailable() { | 40 virtual bool PlatformImplAvailable() { |
| 46 return true; | 41 return true; |
| 47 } | 42 } |
| 48 | 43 |
| 49 MOCK_METHOD5(Speak, | 44 MOCK_METHOD5(Speak, |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 } | 368 } |
| 374 | 369 |
| 375 IN_PROC_BROWSER_TEST_F(TtsApiTest, LangMatching) { | 370 IN_PROC_BROWSER_TEST_F(TtsApiTest, LangMatching) { |
| 376 EXPECT_CALL(mock_platform_impl_, IsSpeaking()); | 371 EXPECT_CALL(mock_platform_impl_, IsSpeaking()); |
| 377 EXPECT_CALL(mock_platform_impl_, StopSpeaking()) | 372 EXPECT_CALL(mock_platform_impl_, StopSpeaking()) |
| 378 .WillRepeatedly(Return(true)); | 373 .WillRepeatedly(Return(true)); |
| 379 | 374 |
| 380 ASSERT_TRUE(RunExtensionTest("tts_engine/lang_matching")) << message_; | 375 ASSERT_TRUE(RunExtensionTest("tts_engine/lang_matching")) << message_; |
| 381 } | 376 } |
| 382 | 377 |
| 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 | |
| 390 // http://crbug.com/122474 | 378 // http://crbug.com/122474 |
| 391 IN_PROC_BROWSER_TEST_F(TtsApiTest, EngineApi) { | 379 IN_PROC_BROWSER_TEST_F(TtsApiTest, EngineApi) { |
| 392 ASSERT_TRUE(RunExtensionTest("tts_engine/engine_api")) << message_; | 380 ASSERT_TRUE(RunExtensionTest("tts_engine/engine_api")) << message_; |
| 393 } | 381 } |
| 394 | |
| 395 } // namespace extensions | |
| OLD | NEW |