gecko-dev/dom/media/gtest/TestBlankVideoDataCreator.cpp
James Cheng ba6513e929 Bug 1349129 - Fix CID 1403176 and CID 1403178 for memory leak. r=jwwang
MozReview-Commit-ID: ClAcLgztPZ4

--HG--
extra : rebase_source : 3f00022cf2ca8dfec78cc1e8cc8f48fcbb220feb
2017-03-21 16:25:29 +08:00

30 lines
974 B
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gtest/gtest.h"
#include "BlankDecoderModule.h"
using namespace mozilla;
TEST(BlankVideoDataCreator, ShouldNotOverflow)
{
RefPtr<MediaRawData> mrd = new MediaRawData();
const uint32_t width = 1;
const uint32_t height = 1;
BlankVideoDataCreator creater(width, height, nullptr);
RefPtr<MediaData> data = creater.Create(mrd);
EXPECT_NE(data.get(), nullptr);
}
TEST(BlankVideoDataCreator, ShouldOverflow)
{
RefPtr<MediaRawData> mrd = new MediaRawData();
const uint32_t width = UINT_MAX;
const uint32_t height = UINT_MAX;
BlankVideoDataCreator creater(width, height, nullptr);
RefPtr<MediaData> data = creater.Create(mrd);
EXPECT_EQ(data.get(), nullptr);
}