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

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: more xhwang comments 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 ADD_FAILURE() << "Timed out waiting for message loop to quit"; 123 ADD_FAILURE() << "Timed out waiting for message loop to quit";
123 run_loop_->Quit(); 124 run_loop_->Quit();
124 } 125 }
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
133 EncryptionScheme encryption_scheme(
134 is_encrypted ? EncryptionScheme::CIPHER_MODE_AES_CTR
135 : EncryptionScheme::CIPHER_MODE_UNENCRYPTED);
136
132 return VideoDecoderConfig(codec, VIDEO_CODEC_PROFILE_UNKNOWN, 137 return VideoDecoderConfig(codec, VIDEO_CODEC_PROFILE_UNKNOWN,
133 PIXEL_FORMAT_YV12, COLOR_SPACE_UNSPECIFIED, 138 PIXEL_FORMAT_YV12, COLOR_SPACE_UNSPECIFIED,
134 coded_size, visible_rect, natural_size, 139 coded_size, visible_rect, natural_size,
135 EmptyExtraData(), is_encrypted); 140 EmptyExtraData(), encryption_scheme);
xhwang 2016/03/07 18:39:52 ditto
dougsteed 2016/03/07 21:12:40 Done.
136 } 141 }
137 142
138 static const gfx::Size kNormalSize(320, 240); 143 static const gfx::Size kNormalSize(320, 240);
139 static const gfx::Size kLargeSize(640, 480); 144 static const gfx::Size kLargeSize(640, 480);
140 145
141 VideoDecoderConfig TestVideoConfig::Invalid() { 146 VideoDecoderConfig TestVideoConfig::Invalid() {
142 return GetTestConfig(kUnknownVideoCodec, kNormalSize, false); 147 return GetTestConfig(kUnknownVideoCodec, kNormalSize, false);
143 } 148 }
144 149
145 VideoDecoderConfig TestVideoConfig::Normal() { 150 VideoDecoderConfig TestVideoConfig::Normal() {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 int width = 0; 261 int width = 0;
257 int height = 0; 262 int height = 0;
258 bool success = pickle.ReadString(&header) && pickle.ReadInt(&width) && 263 bool success = pickle.ReadString(&header) && pickle.ReadInt(&width) &&
259 pickle.ReadInt(&height); 264 pickle.ReadInt(&height);
260 return (success && header == kFakeVideoBufferHeader && 265 return (success && header == kFakeVideoBufferHeader &&
261 width == config.coded_size().width() && 266 width == config.coded_size().width() &&
262 height == config.coded_size().height()); 267 height == config.coded_size().height());
263 } 268 }
264 269
265 } // namespace media 270 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698