Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: third_party/WebKit/Source/core/html/ImageDataTest.cpp

Issue 2767163006: Fix ImageDataTest.CreateImageDataTooBig failing on asan-clang-phone (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/html/ImageData.h" 5 #include "core/html/ImageData.h"
6 6
7 #include "core/dom/ExceptionCode.h" 7 #include "core/dom/ExceptionCode.h"
8 #include "platform/geometry/IntSize.h" 8 #include "platform/geometry/IntSize.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 21 matching lines...) Expand all
32 imageData = ImageData::create(IntSize(-1, 10)); 32 imageData = ImageData::create(IntSize(-1, 10));
33 EXPECT_EQ(imageData, nullptr); 33 EXPECT_EQ(imageData, nullptr);
34 34
35 imageData = ImageData::create(IntSize(10, -1)); 35 imageData = ImageData::create(IntSize(10, -1));
36 EXPECT_EQ(imageData, nullptr); 36 EXPECT_EQ(imageData, nullptr);
37 37
38 imageData = ImageData::create(IntSize(-1, -1)); 38 imageData = ImageData::create(IntSize(-1, -1));
39 EXPECT_EQ(imageData, nullptr); 39 EXPECT_EQ(imageData, nullptr);
40 } 40 }
41 41
42 // Under asan_clang_phone, the test crashes after the memory allocation
43 // is not successful. It is probably related to the value of
44 // allocator_may_return_null on trybots, which in this case causes ASAN
45 // to terminate the process instead of returning null.
46 // crbug.com/704948
47 #if defined(ADDRESS_SANITIZER)
48 #define MAYBE_CreateImageDataTooBig DISABLED_CreateImageDataTooBig
49 #else
50 #define MAYBE_CreateImageDataTooBig CreateImageDataTooBig
51 #endif
52
42 // This test passes if it does not crash. If the required memory is not 53 // This test passes if it does not crash. If the required memory is not
43 // allocated to the ImageData, then an exception must raise. 54 // allocated to the ImageData, then an exception must raise.
44 TEST_F(ImageDataTest, CreateImageDataTooBig) { 55 TEST_F(ImageDataTest, MAYBE_CreateImageDataTooBig) {
45 DummyExceptionStateForTesting exceptionState; 56 DummyExceptionStateForTesting exceptionState;
46 ImageData* tooBigImageData = ImageData::create(32767, 32767, exceptionState); 57 ImageData* tooBigImageData = ImageData::create(32767, 32767, exceptionState);
47 if (!tooBigImageData) { 58 if (!tooBigImageData) {
48 EXPECT_TRUE(exceptionState.hadException()); 59 EXPECT_TRUE(exceptionState.hadException());
49 EXPECT_EQ(exceptionState.code(), V8RangeError); 60 EXPECT_EQ(exceptionState.code(), V8RangeError);
50 } 61 }
51 } 62 }
52 63
53 } // namspace 64 } // namspace
54 } // namespace blink 65 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698