tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

TestBlankVideoDataCreator.cpp (1037B)


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