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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DAPITest.cpp

Issue 1414553002: Fix out-of-memory crashes related to ArrayBuffer allocation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase+more tweaks Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "modules/canvas2d/CanvasRenderingContext2D.h" 6 #include "modules/canvas2d/CanvasRenderingContext2D.h"
7 7
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/html/HTMLCanvasElement.h" 10 #include "core/html/HTMLCanvasElement.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 EXPECT_EQ(50, imageData->height()); 210 EXPECT_EQ(50, imageData->height());
211 211
212 for (unsigned i = 0; i < imageData->data()->length(); ++i) 212 for (unsigned i = 0; i < imageData->data()->length(); ++i)
213 imageData->data()->data()[i] = 255; 213 imageData->data()->data()[i] = 255;
214 214
215 EXPECT_EQ(255, imageData->data()->data()[32]); 215 EXPECT_EQ(255, imageData->data()->data()[32]);
216 216
217 // createImageData(imageData) should create a new ImageData of the same size as 'imageData' 217 // createImageData(imageData) should create a new ImageData of the same size as 'imageData'
218 // but filled with transparent black 218 // but filled with transparent black
219 219
220 ImageData* sameSizeImageData = context2d()->createImageData(imageData); 220 ImageData* sameSizeImageData = context2d()->createImageData(imageData, excep tionState);
221 EXPECT_FALSE(exceptionState.hadException());
221 EXPECT_EQ(100, sameSizeImageData->width()); 222 EXPECT_EQ(100, sameSizeImageData->width());
222 EXPECT_EQ(50, sameSizeImageData->height()); 223 EXPECT_EQ(50, sameSizeImageData->height());
223 EXPECT_EQ(0, sameSizeImageData->data()->data()[32]); 224 EXPECT_EQ(0, sameSizeImageData->data()->data()[32]);
224 225
225 // createImageData(width, height) takes the absolute magnitude of the size a rguments 226 // createImageData(width, height) takes the absolute magnitude of the size a rguments
226 227
227 ImageData* imgdata1 = context2d()->createImageData(10, 20, exceptionState); 228 ImageData* imgdata1 = context2d()->createImageData(10, 20, exceptionState);
228 EXPECT_FALSE(exceptionState.hadException()); 229 EXPECT_FALSE(exceptionState.hadException());
229 ImageData* imgdata2 = context2d()->createImageData(-10, 20, exceptionState); 230 ImageData* imgdata2 = context2d()->createImageData(-10, 20, exceptionState);
230 EXPECT_FALSE(exceptionState.hadException()); 231 EXPECT_FALSE(exceptionState.hadException());
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 AXObjectCacheImpl* axObjectCache = toAXObjectCacheImpl(document().existingAX ObjectCache()); 299 AXObjectCacheImpl* axObjectCache = toAXObjectCacheImpl(document().existingAX ObjectCache());
299 AXObject* axObject = axObjectCache->getOrCreate(buttonElement); 300 AXObject* axObject = axObjectCache->getOrCreate(buttonElement);
300 301
301 EXPECT_EQ(25, axObject->elementRect().x().toInt()); 302 EXPECT_EQ(25, axObject->elementRect().x().toInt());
302 EXPECT_EQ(25, axObject->elementRect().y().toInt()); 303 EXPECT_EQ(25, axObject->elementRect().y().toInt());
303 EXPECT_EQ(40, axObject->elementRect().width().toInt()); 304 EXPECT_EQ(40, axObject->elementRect().width().toInt());
304 EXPECT_EQ(40, axObject->elementRect().height().toInt()); 305 EXPECT_EQ(40, axObject->elementRect().height().toInt());
305 } 306 }
306 307
307 } // namespace blink 308 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698