| 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 "media/base/test_helpers.h" | 5 #include "media/base/test_helpers.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/test/test_timeouts.h" | 12 #include "base/test/test_timeouts.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
| 15 #include "media/base/audio_buffer.h" | 15 #include "media/base/audio_buffer.h" |
| 16 #include "media/base/bind_to_current_loop.h" | 16 #include "media/base/bind_to_current_loop.h" |
| 17 #include "media/base/decoder_buffer.h" | 17 #include "media/base/decoder_buffer.h" |
| 18 #include "media/base/encryption_scheme.h" |
| 18 #include "media/base/media_util.h" | 19 #include "media/base/media_util.h" |
| 19 #include "ui/gfx/geometry/rect.h" | 20 #include "ui/gfx/geometry/rect.h" |
| 20 | 21 |
| 21 using ::testing::_; | 22 using ::testing::_; |
| 22 using ::testing::StrictMock; | 23 using ::testing::StrictMock; |
| 23 | 24 |
| 24 namespace media { | 25 namespace media { |
| 25 | 26 |
| 26 // Utility mock for testing methods expecting Closures and PipelineStatusCBs. | 27 // Utility mock for testing methods expecting Closures and PipelineStatusCBs. |
| 27 class MockCallback : public base::RefCountedThreadSafe<MockCallback> { | 28 class MockCallback : public base::RefCountedThreadSafe<MockCallback> { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 123 |
| 123 static VideoDecoderConfig GetTestConfig(VideoCodec codec, | 124 static VideoDecoderConfig GetTestConfig(VideoCodec codec, |
| 124 gfx::Size coded_size, | 125 gfx::Size coded_size, |
| 125 bool is_encrypted) { | 126 bool is_encrypted) { |
| 126 gfx::Rect visible_rect(coded_size.width(), coded_size.height()); | 127 gfx::Rect visible_rect(coded_size.width(), coded_size.height()); |
| 127 gfx::Size natural_size = coded_size; | 128 gfx::Size natural_size = coded_size; |
| 128 | 129 |
| 129 return VideoDecoderConfig(codec, VIDEO_CODEC_PROFILE_UNKNOWN, | 130 return VideoDecoderConfig(codec, VIDEO_CODEC_PROFILE_UNKNOWN, |
| 130 PIXEL_FORMAT_YV12, COLOR_SPACE_UNSPECIFIED, | 131 PIXEL_FORMAT_YV12, COLOR_SPACE_UNSPECIFIED, |
| 131 coded_size, visible_rect, natural_size, | 132 coded_size, visible_rect, natural_size, |
| 132 EmptyExtraData(), is_encrypted); | 133 EmptyExtraData(), EncryptionScheme(is_encrypted)); |
| 133 } | 134 } |
| 134 | 135 |
| 135 static const gfx::Size kNormalSize(320, 240); | 136 static const gfx::Size kNormalSize(320, 240); |
| 136 static const gfx::Size kLargeSize(640, 480); | 137 static const gfx::Size kLargeSize(640, 480); |
| 137 | 138 |
| 138 VideoDecoderConfig TestVideoConfig::Invalid() { | 139 VideoDecoderConfig TestVideoConfig::Invalid() { |
| 139 return GetTestConfig(kUnknownVideoCodec, kNormalSize, false); | 140 return GetTestConfig(kUnknownVideoCodec, kNormalSize, false); |
| 140 } | 141 } |
| 141 | 142 |
| 142 VideoDecoderConfig TestVideoConfig::Normal() { | 143 VideoDecoderConfig TestVideoConfig::Normal() { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 EXPECT_FALSE(expecting_b_); | 270 EXPECT_FALSE(expecting_b_); |
| 270 expecting_b_ = true; | 271 expecting_b_ = true; |
| 271 } | 272 } |
| 272 | 273 |
| 273 void CallbackPairChecker::RecordBCalled() { | 274 void CallbackPairChecker::RecordBCalled() { |
| 274 EXPECT_TRUE(expecting_b_); | 275 EXPECT_TRUE(expecting_b_); |
| 275 expecting_b_ = false; | 276 expecting_b_ = false; |
| 276 } | 277 } |
| 277 | 278 |
| 278 } // namespace media | 279 } // namespace media |
| OLD | NEW |