| OLD | NEW |
| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "media/base/channel_layout.h" | 10 #include "media/base/channel_layout.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // | 46 // |
| 47 // Fails the test if the timeout is reached. | 47 // Fails the test if the timeout is reached. |
| 48 void RunAndWait(); | 48 void RunAndWait(); |
| 49 | 49 |
| 50 // Runs the current message loop until |this| has been signaled and asserts | 50 // Runs the current message loop until |this| has been signaled and asserts |
| 51 // that the |expected| status was received. | 51 // that the |expected| status was received. |
| 52 // | 52 // |
| 53 // Fails the test if the timeout is reached. | 53 // Fails the test if the timeout is reached. |
| 54 void RunAndWaitForStatus(PipelineStatus expected); | 54 void RunAndWaitForStatus(PipelineStatus expected); |
| 55 | 55 |
| 56 bool is_signaled() const { return signaled_; } |
| 57 |
| 56 private: | 58 private: |
| 57 void OnCallback(PipelineStatus status); | 59 void OnCallback(PipelineStatus status); |
| 58 void OnTimeout(); | 60 void OnTimeout(); |
| 59 | 61 |
| 60 base::MessageLoop* message_loop_; | 62 base::MessageLoop* message_loop_; |
| 61 bool signaled_; | 63 bool signaled_; |
| 62 PipelineStatus status_; | 64 PipelineStatus status_; |
| 63 | 65 |
| 64 DISALLOW_COPY_AND_ASSIGN(WaitableMessageLoopEvent); | 66 DISALLOW_COPY_AND_ASSIGN(WaitableMessageLoopEvent); |
| 65 }; | 67 }; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 }; | 142 }; |
| 141 | 143 |
| 142 // Test implementation of a media log LogCB that sends media log messages to | 144 // Test implementation of a media log LogCB that sends media log messages to |
| 143 // DVLOG(1). | 145 // DVLOG(1). |
| 144 void AddLogEntryForTest(MediaLog::MediaLogLevel level, | 146 void AddLogEntryForTest(MediaLog::MediaLogLevel level, |
| 145 const std::string& message); | 147 const std::string& message); |
| 146 | 148 |
| 147 } // namespace media | 149 } // namespace media |
| 148 | 150 |
| 149 #endif // MEDIA_BASE_TEST_HELPERS_H_ | 151 #endif // MEDIA_BASE_TEST_HELPERS_H_ |
| OLD | NEW |