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

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

Issue 1490613005: media config: expand is_encrypted to a struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mojo changes; Message->base::Pickle Created 4 years, 9 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/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/pickle.h" 13 #include "base/pickle.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/test/test_timeouts.h" 15 #include "base/test/test_timeouts.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "base/timer/timer.h" 17 #include "base/timer/timer.h"
18 #include "media/base/audio_buffer.h" 18 #include "media/base/audio_buffer.h"
19 #include "media/base/bind_to_current_loop.h" 19 #include "media/base/bind_to_current_loop.h"
20 #include "media/base/decoder_buffer.h" 20 #include "media/base/decoder_buffer.h"
21 #include "media/base/encryption_scheme.h"
21 #include "media/base/media_util.h" 22 #include "media/base/media_util.h"
22 #include "ui/gfx/geometry/rect.h" 23 #include "ui/gfx/geometry/rect.h"
23 24
24 using ::testing::_; 25 using ::testing::_;
25 using ::testing::StrictMock; 26 using ::testing::StrictMock;
26 27
27 namespace media { 28 namespace media {
28 29
29 // Utility mock for testing methods expecting Closures and PipelineStatusCBs. 30 // Utility mock for testing methods expecting Closures and PipelineStatusCBs.
30 class MockCallback : public base::RefCountedThreadSafe<MockCallback> { 31 class MockCallback : public base::RefCountedThreadSafe<MockCallback> {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 126
126 static VideoDecoderConfig GetTestConfig(VideoCodec codec, 127 static VideoDecoderConfig GetTestConfig(VideoCodec codec,
127 gfx::Size coded_size, 128 gfx::Size coded_size,
128 bool is_encrypted) { 129 bool is_encrypted) {
129 gfx::Rect visible_rect(coded_size.width(), coded_size.height()); 130 gfx::Rect visible_rect(coded_size.width(), coded_size.height());
130 gfx::Size natural_size = coded_size; 131 gfx::Size natural_size = coded_size;
131 132
132 return VideoDecoderConfig(codec, VIDEO_CODEC_PROFILE_UNKNOWN, 133 return VideoDecoderConfig(codec, VIDEO_CODEC_PROFILE_UNKNOWN,
133 PIXEL_FORMAT_YV12, COLOR_SPACE_UNSPECIFIED, 134 PIXEL_FORMAT_YV12, COLOR_SPACE_UNSPECIFIED,
134 coded_size, visible_rect, natural_size, 135 coded_size, visible_rect, natural_size,
135 EmptyExtraData(), is_encrypted); 136 EmptyExtraData(), EncryptionScheme(is_encrypted));
136 } 137 }
137 138
138 static const gfx::Size kNormalSize(320, 240); 139 static const gfx::Size kNormalSize(320, 240);
139 static const gfx::Size kLargeSize(640, 480); 140 static const gfx::Size kLargeSize(640, 480);
140 141
141 VideoDecoderConfig TestVideoConfig::Invalid() { 142 VideoDecoderConfig TestVideoConfig::Invalid() {
142 return GetTestConfig(kUnknownVideoCodec, kNormalSize, false); 143 return GetTestConfig(kUnknownVideoCodec, kNormalSize, false);
143 } 144 }
144 145
145 VideoDecoderConfig TestVideoConfig::Normal() { 146 VideoDecoderConfig TestVideoConfig::Normal() {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 int width = 0; 257 int width = 0;
257 int height = 0; 258 int height = 0;
258 bool success = pickle.ReadString(&header) && pickle.ReadInt(&width) && 259 bool success = pickle.ReadString(&header) && pickle.ReadInt(&width) &&
259 pickle.ReadInt(&height); 260 pickle.ReadInt(&height);
260 return (success && header == kFakeVideoBufferHeader && 261 return (success && header == kFakeVideoBufferHeader &&
261 width == config.coded_size().width() && 262 width == config.coded_size().width() &&
262 height == config.coded_size().height()); 263 height == config.coded_size().height());
263 } 264 }
264 265
265 } // namespace media 266 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698