summaryrefslogtreecommitdiff
path: root/chromium/media/mojo/clients/mojo_decryptor_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/media/mojo/clients/mojo_decryptor_unittest.cc')
-rw-r--r--chromium/media/mojo/clients/mojo_decryptor_unittest.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/chromium/media/mojo/clients/mojo_decryptor_unittest.cc b/chromium/media/mojo/clients/mojo_decryptor_unittest.cc
index 04383ed8694..a223a40c00e 100644
--- a/chromium/media/mojo/clients/mojo_decryptor_unittest.cc
+++ b/chromium/media/mojo/clients/mojo_decryptor_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,7 +16,6 @@
#include "media/base/timestamp_constants.h"
#include "media/base/video_frame.h"
#include "media/mojo/clients/mojo_decryptor.h"
-#include "media/mojo/common/mojo_shared_buffer_video_frame.h"
#include "media/mojo/mojom/decryptor.mojom.h"
#include "media/mojo/services/mojo_decryptor_service.h"
#include "mojo/public/cpp/bindings/receiver.h"
@@ -72,16 +71,22 @@ class MojoDecryptorTest : public ::testing::Test {
void ReturnSharedBufferVideoFrame(scoped_refptr<DecoderBuffer> encrypted,
Decryptor::VideoDecodeCB video_decode_cb) {
- // We don't care about the encrypted data, just create a simple VideoFrame.
- scoped_refptr<VideoFrame> frame(
- MojoSharedBufferVideoFrame::CreateDefaultForTesting(
- PIXEL_FORMAT_I420, gfx::Size(100, 100), base::Seconds(100)));
+ // We don't care about the encrypted data, just create a simple SHMEM
+ // VideoFrame.
+ auto region = base::ReadOnlySharedMemoryRegion::Create(15000);
+ CHECK(region.IsValid());
+ uint8_t* data = const_cast<uint8_t*>(region.mapping.GetMemoryAs<uint8_t>());
+ scoped_refptr<VideoFrame> frame = VideoFrame::WrapExternalYuvData(
+ PIXEL_FORMAT_I420, gfx::Size(100, 100), gfx::Rect(100, 100),
+ gfx::Size(100, 100), 100, 50, 50, data, data + 100 * 100,
+ data + (100 * 100 * 5 / 4), base::Seconds(100));
+ auto read_only_mapping = region.region.Map();
+ CHECK(read_only_mapping.IsValid());
+ frame->BackWithOwnedSharedMemory(std::move(region.region),
+ std::move(read_only_mapping));
frame->AddDestructionObserver(base::BindOnce(
&MojoDecryptorTest::OnFrameDestroyed, base::Unretained(this)));
- // Currently freeing buffers only works for MojoSharedMemory, so make
- // sure |frame| is of that type.
- EXPECT_EQ(VideoFrame::STORAGE_MOJO_SHARED_BUFFER, frame->storage_type());
std::move(video_decode_cb).Run(Decryptor::kSuccess, std::move(frame));
}