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

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

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: fixes content_browsertests and content_unittests 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // Runs the loop and waits for the |audio_thread_| to call event's closure, 211 // Runs the loop and waits for the |audio_thread_| to call event's closure,
212 // which means AudioSystem reply containing device parameters is already 212 // which means AudioSystem reply containing device parameters is already
213 // queued on the main thread. 213 // queued on the main thread.
214 event.RunAndWait(); 214 event.RunAndWait();
215 } 215 }
216 216
217 protected: 217 protected:
218 TestBrowserThreadBundle thread_bundle_; 218 TestBrowserThreadBundle thread_bundle_;
219 scoped_refptr<SpeechRecognizerImpl> recognizer_; 219 scoped_refptr<SpeechRecognizerImpl> recognizer_;
220 base::Thread audio_thread_; 220 base::Thread audio_thread_;
221 media::MockAudioManager::UniquePtr audio_manager_; 221 std::unique_ptr<media::MockAudioManager> audio_manager_;
222 std::unique_ptr<media::AudioSystem> audio_system_; 222 std::unique_ptr<media::AudioSystem> audio_system_;
223 bool recognition_started_; 223 bool recognition_started_;
224 bool recognition_ended_; 224 bool recognition_ended_;
225 bool result_received_; 225 bool result_received_;
226 bool audio_started_; 226 bool audio_started_;
227 bool audio_ended_; 227 bool audio_ended_;
228 bool sound_started_; 228 bool sound_started_;
229 bool sound_ended_; 229 bool sound_ended_;
230 SpeechRecognitionErrorCode error_; 230 SpeechRecognitionErrorCode error_;
231 net::TestURLFetcherFactory url_fetcher_factory_; 231 net::TestURLFetcherFactory url_fetcher_factory_;
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 648
649 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NONE, error_); 649 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NONE, error_);
650 EXPECT_FALSE(audio_ended_); 650 EXPECT_FALSE(audio_ended_);
651 EXPECT_FALSE(recognition_ended_); 651 EXPECT_FALSE(recognition_ended_);
652 recognizer_->AbortRecognition(); 652 recognizer_->AbortRecognition();
653 base::RunLoop().RunUntilIdle(); 653 base::RunLoop().RunUntilIdle();
654 CheckFinalEventsConsistency(); 654 CheckFinalEventsConsistency();
655 } 655 }
656 656
657 } // namespace content 657 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698