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

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

Issue 2021273002: Extending timeout for AudioRendererSinkCacheTest.SmokeTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adding forgotten const 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
(...skipping 24 matching lines...) Expand all
35 base::Callback<void(bool)> NewExpectedBoolCB(bool success); 35 base::Callback<void(bool)> NewExpectedBoolCB(bool success);
36 PipelineStatusCB NewExpectedStatusCB(PipelineStatus status); 36 PipelineStatusCB NewExpectedStatusCB(PipelineStatus status);
37 37
38 // Helper class for running a message loop until a callback has run. Useful for 38 // Helper class for running a message loop until a callback has run. Useful for
39 // testing classes that run on more than a single thread. 39 // testing classes that run on more than a single thread.
40 // 40 //
41 // Events are intended for single use and cannot be reset. 41 // Events are intended for single use and cannot be reset.
42 class WaitableMessageLoopEvent { 42 class WaitableMessageLoopEvent {
43 public: 43 public:
44 WaitableMessageLoopEvent(); 44 WaitableMessageLoopEvent();
45 explicit WaitableMessageLoopEvent(base::TimeDelta timeout);
45 ~WaitableMessageLoopEvent(); 46 ~WaitableMessageLoopEvent();
46 47
47 // Returns a thread-safe closure that will signal |this| when executed. 48 // Returns a thread-safe closure that will signal |this| when executed.
48 base::Closure GetClosure(); 49 base::Closure GetClosure();
49 PipelineStatusCB GetPipelineStatusCB(); 50 PipelineStatusCB GetPipelineStatusCB();
50 51
51 // Runs the current message loop until |this| has been signaled. 52 // Runs the current message loop until |this| has been signaled.
52 // 53 //
53 // Fails the test if the timeout is reached. 54 // Fails the test if the timeout is reached.
54 void RunAndWait(); 55 void RunAndWait();
55 56
56 // Runs the current message loop until |this| has been signaled and asserts 57 // Runs the current message loop until |this| has been signaled and asserts
57 // that the |expected| status was received. 58 // that the |expected| status was received.
58 // 59 //
59 // Fails the test if the timeout is reached. 60 // Fails the test if the timeout is reached.
60 void RunAndWaitForStatus(PipelineStatus expected); 61 void RunAndWaitForStatus(PipelineStatus expected);
61 62
62 bool is_signaled() const { return signaled_; } 63 bool is_signaled() const { return signaled_; }
63 64
64 private: 65 private:
65 void OnCallback(PipelineStatus status); 66 void OnCallback(PipelineStatus status);
66 void OnTimeout(); 67 void OnTimeout();
67 68
68 base::MessageLoop* message_loop_; 69 base::MessageLoop* message_loop_;
69 bool signaled_; 70 bool signaled_;
70 PipelineStatus status_; 71 PipelineStatus status_;
71 std::unique_ptr<base::RunLoop> run_loop_; 72 std::unique_ptr<base::RunLoop> run_loop_;
73 const base::TimeDelta timeout_;
72 74
73 DISALLOW_COPY_AND_ASSIGN(WaitableMessageLoopEvent); 75 DISALLOW_COPY_AND_ASSIGN(WaitableMessageLoopEvent);
74 }; 76 };
75 77
76 // Provides pre-canned VideoDecoderConfig. These types are used for tests that 78 // Provides pre-canned VideoDecoderConfig. These types are used for tests that
77 // don't care about detailed parameters of the config. 79 // don't care about detailed parameters of the config.
78 class TestVideoConfig { 80 class TestVideoConfig {
79 public: 81 public:
80 // Returns a configuration that is invalid. 82 // Returns a configuration that is invalid.
81 static VideoDecoderConfig Invalid(); 83 static VideoDecoderConfig Invalid();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 base::TimeDelta timestamp, 142 base::TimeDelta timestamp,
141 base::TimeDelta duration); 143 base::TimeDelta duration);
142 144
143 // Verify if a fake video DecoderBuffer is valid. 145 // Verify if a fake video DecoderBuffer is valid.
144 bool VerifyFakeVideoBufferForTest(const scoped_refptr<DecoderBuffer>& buffer, 146 bool VerifyFakeVideoBufferForTest(const scoped_refptr<DecoderBuffer>& buffer,
145 const VideoDecoderConfig& config); 147 const VideoDecoderConfig& config);
146 148
147 } // namespace media 149 } // namespace media
148 150
149 #endif // MEDIA_BASE_TEST_HELPERS_H_ 151 #endif // MEDIA_BASE_TEST_HELPERS_H_
OLDNEW
« no previous file with comments | « content/renderer/media/audio_renderer_sink_cache_unittest.cc ('k') | media/base/test_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698