Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "core/html/ImageData.h" | |
| 6 | |
| 7 #include "platform/geometry/IntSize.h" | |
| 8 #include "testing/gtest/include/gtest/gtest.h" | |
| 9 | |
| 10 namespace blink { | |
| 11 namespace { | |
| 12 | |
| 13 class ImageDataTest : public ::testing::Test { | |
| 14 protected: | |
| 15 ImageDataTest(){}; | |
| 16 void TearDown(){}; | |
| 17 }; | |
| 18 | |
| 19 TEST_F(ImageDataTest, NegativeAndZeroIntSizeTest) { | |
| 20 ImageData* imageData; | |
| 21 | |
| 22 imageData = ImageData::create(IntSize(0, 10)); | |
| 23 EXPECT_EQ(imageData, nullptr); | |
| 24 | |
| 25 imageData = ImageData::create(IntSize(10, 0)); | |
| 26 EXPECT_EQ(imageData, nullptr); | |
| 27 | |
| 28 imageData = ImageData::create(IntSize(0, 0)); | |
| 29 EXPECT_EQ(imageData, nullptr); | |
| 30 | |
| 31 imageData = ImageData::create(IntSize(-1, 10)); | |
| 32 EXPECT_EQ(imageData, nullptr); | |
| 33 | |
| 34 imageData = ImageData::create(IntSize(10, -1)); | |
| 35 EXPECT_EQ(imageData, nullptr); | |
| 36 | |
| 37 imageData = ImageData::create(IntSize(-1, -1)); | |
|
Justin Novosad
2017/03/20 18:03:33
You forgot to cover large values that overflow int
zakerinasab
2017/03/20 20:50:33
Thanks for the hint. New test added.
| |
| 38 EXPECT_EQ(imageData, nullptr); | |
| 39 } | |
| 40 | |
| 41 } // namspace | |
| 42 } // namespace blink | |
| OLD | NEW |