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

Side by Side Diff: media/audio/android/audio_android_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/android/build_info.h" 9 #include "base/android/build_info.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 } 570 }
571 571
572 void StopAndClose() { 572 void StopAndClose() {
573 DCHECK(audio_manager()->GetTaskRunner()->BelongsToCurrentThread()); 573 DCHECK(audio_manager()->GetTaskRunner()->BelongsToCurrentThread());
574 audio_output_stream_->Stop(); 574 audio_output_stream_->Stop();
575 audio_output_stream_->Close(); 575 audio_output_stream_->Close();
576 audio_output_stream_ = NULL; 576 audio_output_stream_ = NULL;
577 } 577 }
578 578
579 std::unique_ptr<base::MessageLoopForUI> loop_; 579 std::unique_ptr<base::MessageLoopForUI> loop_;
580 ScopedAudioManagerPtr audio_manager_; 580 std::unique_ptr<AudioManager> audio_manager_;
581 AudioParameters audio_output_parameters_; 581 AudioParameters audio_output_parameters_;
582 AudioOutputStream* audio_output_stream_; 582 AudioOutputStream* audio_output_stream_;
583 base::TimeTicks start_time_; 583 base::TimeTicks start_time_;
584 base::TimeTicks end_time_; 584 base::TimeTicks end_time_;
585 585
586 private: 586 private:
587 DISALLOW_COPY_AND_ASSIGN(AudioAndroidOutputTest); 587 DISALLOW_COPY_AND_ASSIGN(AudioAndroidOutputTest);
588 }; 588 };
589 589
590 // Test fixture class for tests which exercise the input path, or both input and 590 // Test fixture class for tests which exercise the input path, or both input and
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 printf("\n"); 963 printf("\n");
964 StopAndCloseAudioOutputStreamOnAudioThread(); 964 StopAndCloseAudioOutputStreamOnAudioThread();
965 StopAndCloseAudioInputStreamOnAudioThread(); 965 StopAndCloseAudioInputStreamOnAudioThread();
966 } 966 }
967 967
968 INSTANTIATE_TEST_CASE_P(AudioAndroidInputTest, 968 INSTANTIATE_TEST_CASE_P(AudioAndroidInputTest,
969 AudioAndroidInputTest, 969 AudioAndroidInputTest,
970 testing::Bool()); 970 testing::Bool());
971 971
972 } // namespace media 972 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698