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

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

Issue 2874433002: Fix/Disable ffmpeg Media Tests on Android (Closed)
Patch Set: Created 3 years, 7 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 #include "media/base/test_helpers.h" 5 #include "media/base/test_helpers.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/pickle.h" 12 #include "base/pickle.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/test/test_timeouts.h" 14 #include "base/test/test_timeouts.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "base/timer/timer.h" 16 #include "base/timer/timer.h"
17 #include "media/base/audio_buffer.h" 17 #include "media/base/audio_buffer.h"
18 #include "media/base/bind_to_current_loop.h" 18 #include "media/base/bind_to_current_loop.h"
19 #include "media/base/decoder_buffer.h" 19 #include "media/base/decoder_buffer.h"
20 #include "media/base/media_util.h" 20 #include "media/base/media_util.h"
21 #include "ui/gfx/geometry/rect.h" 21 #include "ui/gfx/geometry/rect.h"
22 22
23 using ::testing::_; 23 using ::testing::_;
24 using ::testing::StrictMock; 24 using ::testing::StrictMock;
25 25
26 namespace media { 26 namespace media {
27 27
28 namespace {
29 #if defined(OS_ANDROID)
30 VideoCodec kDefaultCodec = kCodecH264;
31 #else
32 VideoCodec kDefaultCodec = kCodecVP8;
33 #endif
34 } // anonymous namespace
35
28 // Utility mock for testing methods expecting Closures and PipelineStatusCBs. 36 // Utility mock for testing methods expecting Closures and PipelineStatusCBs.
29 class MockCallback : public base::RefCountedThreadSafe<MockCallback> { 37 class MockCallback : public base::RefCountedThreadSafe<MockCallback> {
30 public: 38 public:
31 MockCallback(); 39 MockCallback();
32 MOCK_METHOD0(Run, void()); 40 MOCK_METHOD0(Run, void());
33 MOCK_METHOD1(RunWithBool, void(bool)); 41 MOCK_METHOD1(RunWithBool, void(bool));
34 MOCK_METHOD1(RunWithStatus, void(PipelineStatus)); 42 MOCK_METHOD1(RunWithStatus, void(PipelineStatus));
35 43
36 protected: 44 protected:
37 friend class base::RefCountedThreadSafe<MockCallback>; 45 friend class base::RefCountedThreadSafe<MockCallback>;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 148
141 static const gfx::Size kNormalSize(320, 240); 149 static const gfx::Size kNormalSize(320, 240);
142 static const gfx::Size kLargeSize(640, 480); 150 static const gfx::Size kLargeSize(640, 480);
143 151
144 // static 152 // static
145 VideoDecoderConfig TestVideoConfig::Invalid() { 153 VideoDecoderConfig TestVideoConfig::Invalid() {
146 return GetTestConfig(kUnknownVideoCodec, kNormalSize, false); 154 return GetTestConfig(kUnknownVideoCodec, kNormalSize, false);
147 } 155 }
148 156
149 // static 157 // static
150 VideoDecoderConfig TestVideoConfig::Normal() { 158 VideoDecoderConfig TestVideoConfig::Normal() {
watk 2017/05/09 22:08:23 Instead of this kDefaultCodec, I think it would be
151 return GetTestConfig(kCodecVP8, kNormalSize, false); 159 return GetTestConfig(kDefaultCodec, kNormalSize, false);
152 } 160 }
153 161
154 // static 162 // static
155 VideoDecoderConfig TestVideoConfig::NormalH264() { 163 VideoDecoderConfig TestVideoConfig::NormalH264() {
156 return GetTestConfig(kCodecH264, kNormalSize, false); 164 return GetTestConfig(kCodecH264, kNormalSize, false);
157 } 165 }
158 166
159 // static 167 // static
160 VideoDecoderConfig TestVideoConfig::NormalEncrypted() { 168 VideoDecoderConfig TestVideoConfig::NormalEncrypted() {
161 return GetTestConfig(kCodecVP8, kNormalSize, true); 169 return GetTestConfig(kDefaultCodec, kNormalSize, true);
162 } 170 }
163 171
164 // static 172 // static
165 VideoDecoderConfig TestVideoConfig::Large() { 173 VideoDecoderConfig TestVideoConfig::Large() {
166 return GetTestConfig(kCodecVP8, kLargeSize, false); 174 return GetTestConfig(kDefaultCodec, kLargeSize, false);
167 } 175 }
168 176
169 // static 177 // static
170 VideoDecoderConfig TestVideoConfig::LargeEncrypted() { 178 VideoDecoderConfig TestVideoConfig::LargeEncrypted() {
171 return GetTestConfig(kCodecVP8, kLargeSize, true); 179 return GetTestConfig(kDefaultCodec, kLargeSize, true);
172 } 180 }
173 181
174 // static 182 // static
175 gfx::Size TestVideoConfig::NormalCodedSize() { 183 gfx::Size TestVideoConfig::NormalCodedSize() {
176 return kNormalSize; 184 return kNormalSize;
177 } 185 }
178 186
179 // static 187 // static
180 gfx::Size TestVideoConfig::LargeCodedSize() { 188 gfx::Size TestVideoConfig::LargeCodedSize() {
181 return kLargeSize; 189 return kLargeSize;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 int width = 0; 285 int width = 0;
278 int height = 0; 286 int height = 0;
279 bool success = pickle.ReadString(&header) && pickle.ReadInt(&width) && 287 bool success = pickle.ReadString(&header) && pickle.ReadInt(&width) &&
280 pickle.ReadInt(&height); 288 pickle.ReadInt(&height);
281 return (success && header == kFakeVideoBufferHeader && 289 return (success && header == kFakeVideoBufferHeader &&
282 width == config.coded_size().width() && 290 width == config.coded_size().width() &&
283 height == config.coded_size().height()); 291 height == config.coded_size().height());
284 } 292 }
285 293
286 } // namespace media 294 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | media/filters/ffmpeg_video_decoder_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698