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

Side by Side Diff: content/browser/speech/speech_recognizer_impl_unittest.cc

Issue 2763383002: Switching AudioInputDeviceManager from using AudioManager interface to AudioSystem one. (Closed)
Patch Set: rebase Created 3 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 const int channels = 85 const int channels =
86 ChannelLayoutToChannelCount(SpeechRecognizerImpl::kChannelLayout); 86 ChannelLayoutToChannelCount(SpeechRecognizerImpl::kChannelLayout);
87 bytes_per_sample_ = SpeechRecognizerImpl::kNumBitsPerAudioSample / 8; 87 bytes_per_sample_ = SpeechRecognizerImpl::kNumBitsPerAudioSample / 8;
88 const int frames = audio_packet_length_bytes / channels / bytes_per_sample_; 88 const int frames = audio_packet_length_bytes / channels / bytes_per_sample_;
89 audio_bus_ = media::AudioBus::Create(channels, frames); 89 audio_bus_ = media::AudioBus::Create(channels, frames);
90 audio_bus_->Zero(); 90 audio_bus_->Zero();
91 } 91 }
92 92
93 ~SpeechRecognizerImplTest() override { 93 ~SpeechRecognizerImplTest() override {
94 // Deleting |audio_manager_| on audio thread. 94 // Deleting |audio_manager_| on audio thread.
95 audio_system_.reset();
95 audio_manager_.reset(); 96 audio_manager_.reset();
96 audio_thread_.Stop(); 97 audio_thread_.Stop();
97 } 98 }
98 99
99 void CheckEventsConsistency() { 100 void CheckEventsConsistency() {
100 // Note: "!x || y" == "x implies y". 101 // Note: "!x || y" == "x implies y".
101 EXPECT_TRUE(!recognition_ended_ || recognition_started_); 102 EXPECT_TRUE(!recognition_ended_ || recognition_started_);
102 EXPECT_TRUE(!audio_ended_ || audio_started_); 103 EXPECT_TRUE(!audio_ended_ || audio_started_);
103 EXPECT_TRUE(!sound_ended_ || sound_started_); 104 EXPECT_TRUE(!sound_ended_ || sound_started_);
104 EXPECT_TRUE(!audio_started_ || recognition_started_); 105 EXPECT_TRUE(!audio_started_ || recognition_started_);
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 650
650 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NONE, error_); 651 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NONE, error_);
651 EXPECT_FALSE(audio_ended_); 652 EXPECT_FALSE(audio_ended_);
652 EXPECT_FALSE(recognition_ended_); 653 EXPECT_FALSE(recognition_ended_);
653 recognizer_->AbortRecognition(); 654 recognizer_->AbortRecognition();
654 base::RunLoop().RunUntilIdle(); 655 base::RunLoop().RunUntilIdle();
655 CheckFinalEventsConsistency(); 656 CheckFinalEventsConsistency();
656 } 657 }
657 658
658 } // namespace content 659 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/media_stream_manager.cc ('k') | media/audio/audio_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698