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 "content/browser/browser_thread_impl.h" | 7 #include "content/browser/browser_thread_impl.h" |
8 #include "content/browser/speech/speech_recognizer_impl.h" | 8 #include "content/browser/speech/speech_recognizer_impl.h" |
9 #include "content/public/browser/speech_recognizer_delegate.h" | 9 #include "content/public/browser/speech_recognizer_delegate.h" |
10 #include "content/test/test_url_fetcher_factory.h" | 10 #include "content/test/test_url_fetcher_factory.h" |
11 #include "media/audio/audio_manager.h" | 11 #include "media/audio/audio_manager.h" |
12 #include "media/audio/test_audio_input_controller_factory.h" | 12 #include "media/audio/test_audio_input_controller_factory.h" |
13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
14 #include "net/url_request/url_request_status.h" | 14 #include "net/url_request/url_request_status.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 using content::BrowserThread; | 17 using content::BrowserThread; |
18 using content::BrowserThreadImpl; | 18 using content::BrowserThreadImpl; |
19 using media::AudioInputController; | 19 using media::AudioInputController; |
20 using media::TestAudioInputController; | 20 using media::TestAudioInputController; |
21 using media::TestAudioInputControllerFactory; | 21 using media::TestAudioInputControllerFactory; |
22 | 22 |
23 namespace speech_input { | 23 namespace speech { |
24 | 24 |
25 class SpeechRecognizerTest : public content::SpeechRecognizerDelegate, | 25 class SpeechRecognizerTest : public content::SpeechRecognizerDelegate, |
26 public testing::Test { | 26 public testing::Test { |
27 public: | 27 public: |
28 SpeechRecognizerTest() | 28 SpeechRecognizerTest() |
29 : io_thread_(BrowserThread::IO, &message_loop_), | 29 : io_thread_(BrowserThread::IO, &message_loop_), |
30 audio_manager_(AudioManager::Create()), | 30 audio_manager_(AudioManager::Create()), |
31 recording_complete_(false), | 31 recording_complete_(false), |
32 recognition_complete_(false), | 32 recognition_complete_(false), |
33 result_received_(false), | 33 result_received_(false), |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 MessageLoop::current()->RunAllPending(); | 414 MessageLoop::current()->RunAllPending(); |
415 EXPECT_FLOAT_EQ(0.89926866f, volume_); | 415 EXPECT_FLOAT_EQ(0.89926866f, volume_); |
416 EXPECT_FLOAT_EQ(0.75071919f, noise_volume_); | 416 EXPECT_FLOAT_EQ(0.75071919f, noise_volume_); |
417 | 417 |
418 EXPECT_EQ(content::SPEECH_INPUT_ERROR_NONE, error_); | 418 EXPECT_EQ(content::SPEECH_INPUT_ERROR_NONE, error_); |
419 EXPECT_FALSE(recording_complete_); | 419 EXPECT_FALSE(recording_complete_); |
420 EXPECT_FALSE(recognition_complete_); | 420 EXPECT_FALSE(recognition_complete_); |
421 recognizer_->CancelRecognition(); | 421 recognizer_->CancelRecognition(); |
422 } | 422 } |
423 | 423 |
424 } // namespace speech_input | 424 } // namespace speech |
OLD | NEW |