| 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 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/environment.h" | 6 #include "base/environment.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
| 10 #include "media/audio/audio_io.h" | 10 #include "media/audio/audio_io.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 double volume) OVERRIDE { | 32 double volume) OVERRIDE { |
| 33 ++callback_count_; | 33 ++callback_count_; |
| 34 // Read the first byte to make sure memory is good. | 34 // Read the first byte to make sure memory is good. |
| 35 if (size) { | 35 if (size) { |
| 36 ASSERT_LE(static_cast<int>(size), max_data_bytes_); | 36 ASSERT_LE(static_cast<int>(size), max_data_bytes_); |
| 37 int value = data[0]; | 37 int value = data[0]; |
| 38 EXPECT_GE(value, 0); | 38 EXPECT_GE(value, 0); |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 virtual void OnClose(AudioInputStream* stream) OVERRIDE {} | 41 virtual void OnClose(AudioInputStream* stream) OVERRIDE {} |
| 42 virtual void OnError(AudioInputStream* stream, int code) OVERRIDE { | 42 virtual void OnError(AudioInputStream* stream) OVERRIDE { |
| 43 ++had_error_; | 43 ++had_error_; |
| 44 } | 44 } |
| 45 // Returns how many times OnData() has been called. | 45 // Returns how many times OnData() has been called. |
| 46 int callback_count() const { | 46 int callback_count() const { |
| 47 return callback_count_; | 47 return callback_count_; |
| 48 } | 48 } |
| 49 // Returns how many times the OnError callback was called. | 49 // Returns how many times the OnError callback was called. |
| 50 int had_error() const { | 50 int had_error() const { |
| 51 return had_error_; | 51 return had_error_; |
| 52 } | 52 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 base::TimeDelta::FromMilliseconds(690)); | 180 base::TimeDelta::FromMilliseconds(690)); |
| 181 message_loop.Run(); | 181 message_loop.Run(); |
| 182 EXPECT_GE(test_callback.callback_count(), 1); | 182 EXPECT_GE(test_callback.callback_count(), 1); |
| 183 EXPECT_FALSE(test_callback.had_error()); | 183 EXPECT_FALSE(test_callback.had_error()); |
| 184 | 184 |
| 185 ais->Stop(); | 185 ais->Stop(); |
| 186 ais->Close(); | 186 ais->Close(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace media | 189 } // namespace media |
| OLD | NEW |