test_audio_thread.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef MEDIA_AUDIO_TEST_AUDIO_THREAD_H_
  5. #define MEDIA_AUDIO_TEST_AUDIO_THREAD_H_
  6. #include <memory>
  7. #include "base/memory/ref_counted.h"
  8. #include "base/threading/thread.h"
  9. #include "base/threading/thread_checker.h"
  10. #include "media/audio/audio_thread.h"
  11. namespace media {
  12. class TestAudioThread final : public AudioThread {
  13. public:
  14. TestAudioThread();
  15. explicit TestAudioThread(bool use_real_thread);
  16. TestAudioThread(const TestAudioThread&) = delete;
  17. TestAudioThread& operator=(const TestAudioThread&) = delete;
  18. ~TestAudioThread() final;
  19. // AudioThread implementation.
  20. void Stop() final;
  21. bool IsHung() const final;
  22. base::SingleThreadTaskRunner* GetTaskRunner() final;
  23. base::SingleThreadTaskRunner* GetWorkerTaskRunner() final;
  24. private:
  25. std::unique_ptr<base::Thread> thread_;
  26. scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
  27. THREAD_CHECKER(thread_checker_);
  28. };
  29. } // namespace media
  30. #endif // MEDIA_AUDIO_TEST_AUDIO_THREAD_H_