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

Side by Side Diff: media/base/test_helpers.h

Issue 2076423004: Remove calls to MessageLoop::current() in media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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) 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 #ifndef MEDIA_BASE_TEST_HELPERS_H_ 5 #ifndef MEDIA_BASE_TEST_HELPERS_H_
6 #define MEDIA_BASE_TEST_HELPERS_H_ 6 #define MEDIA_BASE_TEST_HELPERS_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/single_thread_task_runner.h"
13 #include "media/base/audio_parameters.h" 15 #include "media/base/audio_parameters.h"
14 #include "media/base/channel_layout.h" 16 #include "media/base/channel_layout.h"
15 #include "media/base/media_log.h" 17 #include "media/base/media_log.h"
16 #include "media/base/pipeline_status.h" 18 #include "media/base/pipeline_status.h"
17 #include "media/base/sample_format.h" 19 #include "media/base/sample_format.h"
18 #include "media/base/video_decoder_config.h" 20 #include "media/base/video_decoder_config.h"
19 #include "testing/gmock/include/gmock/gmock.h" 21 #include "testing/gmock/include/gmock/gmock.h"
20 #include "ui/gfx/geometry/size.h" 22 #include "ui/gfx/geometry/size.h"
21 23
22 namespace base { 24 namespace base {
23 class MessageLoop;
24 class RunLoop; 25 class RunLoop;
25 class TimeDelta; 26 class TimeDelta;
26 } 27 }
27 28
28 namespace media { 29 namespace media {
29 30
30 class AudioBuffer; 31 class AudioBuffer;
31 class DecoderBuffer; 32 class DecoderBuffer;
32 33
33 // Return a callback that expects to be run once. 34 // Return a callback that expects to be run once.
(...skipping 25 matching lines...) Expand all
59 // 60 //
60 // Fails the test if the timeout is reached. 61 // Fails the test if the timeout is reached.
61 void RunAndWaitForStatus(PipelineStatus expected); 62 void RunAndWaitForStatus(PipelineStatus expected);
62 63
63 bool is_signaled() const { return signaled_; } 64 bool is_signaled() const { return signaled_; }
64 65
65 private: 66 private:
66 void OnCallback(PipelineStatus status); 67 void OnCallback(PipelineStatus status);
67 void OnTimeout(); 68 void OnTimeout();
68 69
69 base::MessageLoop* message_loop_; 70 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
70 bool signaled_; 71 bool signaled_;
71 PipelineStatus status_; 72 PipelineStatus status_;
72 std::unique_ptr<base::RunLoop> run_loop_; 73 std::unique_ptr<base::RunLoop> run_loop_;
73 const base::TimeDelta timeout_; 74 const base::TimeDelta timeout_;
74 75
75 DISALLOW_COPY_AND_ASSIGN(WaitableMessageLoopEvent); 76 DISALLOW_COPY_AND_ASSIGN(WaitableMessageLoopEvent);
76 }; 77 };
77 78
78 // Provides pre-canned VideoDecoderConfig. These types are used for tests that 79 // Provides pre-canned VideoDecoderConfig. These types are used for tests that
79 // don't care about detailed parameters of the config. 80 // don't care about detailed parameters of the config.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 base::TimeDelta timestamp, 143 base::TimeDelta timestamp,
143 base::TimeDelta duration); 144 base::TimeDelta duration);
144 145
145 // Verify if a fake video DecoderBuffer is valid. 146 // Verify if a fake video DecoderBuffer is valid.
146 bool VerifyFakeVideoBufferForTest(const scoped_refptr<DecoderBuffer>& buffer, 147 bool VerifyFakeVideoBufferForTest(const scoped_refptr<DecoderBuffer>& buffer,
147 const VideoDecoderConfig& config); 148 const VideoDecoderConfig& config);
148 149
149 } // namespace media 150 } // namespace media
150 151
151 #endif // MEDIA_BASE_TEST_HELPERS_H_ 152 #endif // MEDIA_BASE_TEST_HELPERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698