| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 namespace { | 39 namespace { |
| 40 int g_saved_utterance_id; | 40 int g_saved_utterance_id; |
| 41 } | 41 } |
| 42 | 42 |
| 43 namespace extensions { | 43 namespace extensions { |
| 44 | 44 |
| 45 class MockTtsPlatformImpl : public TtsPlatformImpl { | 45 class MockTtsPlatformImpl : public TtsPlatformImpl { |
| 46 public: | 46 public: |
| 47 MockTtsPlatformImpl() | 47 MockTtsPlatformImpl() |
| 48 : ptr_factory_(this), | 48 : should_fake_get_voices_(false), |
| 49 should_fake_get_voices_(false) {} | 49 ptr_factory_(this) {} |
| 50 | 50 |
| 51 virtual bool PlatformImplAvailable() { | 51 virtual bool PlatformImplAvailable() { |
| 52 return true; | 52 return true; |
| 53 } | 53 } |
| 54 | 54 |
| 55 MOCK_METHOD5(Speak, | 55 MOCK_METHOD5(Speak, |
| 56 bool(int utterance_id, | 56 bool(int utterance_id, |
| 57 const std::string& utterance, | 57 const std::string& utterance, |
| 58 const std::string& lang, | 58 const std::string& lang, |
| 59 const VoiceData& voice, | 59 const VoiceData& voice, |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 ptr_factory_.GetWeakPtr(), | 155 ptr_factory_.GetWeakPtr(), |
| 156 true, utterance_id, event_type, char_index, message), | 156 true, utterance_id, event_type, char_index, message), |
| 157 base::TimeDelta::FromMilliseconds(100)); | 157 base::TimeDelta::FromMilliseconds(100)); |
| 158 return; | 158 return; |
| 159 } | 159 } |
| 160 | 160 |
| 161 controller->OnTtsEvent(utterance_id, event_type, char_index, message); | 161 controller->OnTtsEvent(utterance_id, event_type, char_index, message); |
| 162 } | 162 } |
| 163 | 163 |
| 164 private: | 164 private: |
| 165 bool should_fake_get_voices_; |
| 165 base::WeakPtrFactory<MockTtsPlatformImpl> ptr_factory_; | 166 base::WeakPtrFactory<MockTtsPlatformImpl> ptr_factory_; |
| 166 bool should_fake_get_voices_; | |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 class FakeNetworkOnlineStateForTest : public net::NetworkChangeNotifier { | 169 class FakeNetworkOnlineStateForTest : public net::NetworkChangeNotifier { |
| 170 public: | 170 public: |
| 171 explicit FakeNetworkOnlineStateForTest(bool online) : online_(online) {} | 171 explicit FakeNetworkOnlineStateForTest(bool online) : online_(online) {} |
| 172 ~FakeNetworkOnlineStateForTest() override {} | 172 ~FakeNetworkOnlineStateForTest() override {} |
| 173 | 173 |
| 174 ConnectionType GetCurrentConnectionType() const override { | 174 ConnectionType GetCurrentConnectionType() const override { |
| 175 return online_ ? | 175 return online_ ? |
| 176 net::NetworkChangeNotifier::CONNECTION_ETHERNET : | 176 net::NetworkChangeNotifier::CONNECTION_ETHERNET : |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 // Test should fail when offline. | 439 // Test should fail when offline. |
| 440 ASSERT_FALSE(RunExtensionTest("tts_engine/network_speech_engine")); | 440 ASSERT_FALSE(RunExtensionTest("tts_engine/network_speech_engine")); |
| 441 } | 441 } |
| 442 | 442 |
| 443 // http://crbug.com/122474 | 443 // http://crbug.com/122474 |
| 444 IN_PROC_BROWSER_TEST_F(TtsApiTest, EngineApi) { | 444 IN_PROC_BROWSER_TEST_F(TtsApiTest, EngineApi) { |
| 445 ASSERT_TRUE(RunExtensionTest("tts_engine/engine_api")) << message_; | 445 ASSERT_TRUE(RunExtensionTest("tts_engine/engine_api")) << message_; |
| 446 } | 446 } |
| 447 | 447 |
| 448 } // namespace extensions | 448 } // namespace extensions |
| OLD | NEW |