1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #include "gtest/gtest.h"
7 #include "BlankDecoderModule.h"
8 
9 using namespace mozilla;
10 
TEST(BlankVideoDataCreator,ShouldNotOverflow)11 TEST(BlankVideoDataCreator, ShouldNotOverflow)
12 {
13   RefPtr<MediaRawData> mrd = new MediaRawData();
14   const uint32_t width = 1;
15   const uint32_t height = 1;
16   BlankVideoDataCreator creater(width, height, nullptr);
17   RefPtr<MediaData> data = creater.Create(mrd);
18   EXPECT_NE(data.get(), nullptr);
19 }
20 
TEST(BlankVideoDataCreator,ShouldOverflow)21 TEST(BlankVideoDataCreator, ShouldOverflow)
22 {
23   RefPtr<MediaRawData> mrd = new MediaRawData();
24   const uint32_t width = UINT_MAX;
25   const uint32_t height = UINT_MAX;
26   BlankVideoDataCreator creater(width, height, nullptr);
27   RefPtr<MediaData> data = creater.Create(mrd);
28   EXPECT_EQ(data.get(), nullptr);
29 }
30