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

Side by Side Diff: Source/core/frame/ImageBitmapTest.cpp

Issue 540033002: use tryAllocPixels to check the result, allocPixels to require success (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 | Source/platform/DragImage.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "wtf/OwnPtr.h" 47 #include "wtf/OwnPtr.h"
48 48
49 #include <gtest/gtest.h> 49 #include <gtest/gtest.h>
50 50
51 namespace blink { 51 namespace blink {
52 52
53 class ImageBitmapTest : public ::testing::Test { 53 class ImageBitmapTest : public ::testing::Test {
54 protected: 54 protected:
55 virtual void SetUp() 55 virtual void SetUp()
56 { 56 {
57 ASSERT_TRUE(m_bitmap.allocN32Pixels(10, 10)); 57 m_bitmap.allocN32Pixels(10, 10);
58 m_bitmap.eraseColor(0xFFFFFFFF); 58 m_bitmap.eraseColor(0xFFFFFFFF);
59 59
60 ASSERT_TRUE(m_bitmap2.allocN32Pixels(5, 5)); 60 m_bitmap2.allocN32Pixels(5, 5);
61 m_bitmap2.eraseColor(0xAAAAAAAA); 61 m_bitmap2.eraseColor(0xAAAAAAAA);
62 62
63 // Save the global memory cache to restore it upon teardown. 63 // Save the global memory cache to restore it upon teardown.
64 m_globalMemoryCache = replaceMemoryCacheForTesting(MemoryCache::create() ); 64 m_globalMemoryCache = replaceMemoryCacheForTesting(MemoryCache::create() );
65 } 65 }
66 virtual void TearDown() 66 virtual void TearDown()
67 { 67 {
68 // Garbage collection is required prior to switching out the 68 // Garbage collection is required prior to switching out the
69 // test's memory cache; image resources are released, evicting 69 // test's memory cache; image resources are released, evicting
70 // them from the cache. 70 // them from the cache.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 { 204 {
205 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapFromCanvas = ImageBitmap::cre ate(canvasElement.get(), IntRect(0, 0, canvasElement->width(), canvasElement->he ight())); 205 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapFromCanvas = ImageBitmap::cre ate(canvasElement.get(), IntRect(0, 0, canvasElement->width(), canvasElement->he ight()));
206 imageBitmapDerived = ImageBitmap::create(imageBitmapFromCanvas.get(), In tRect(0, 0, 20, 20)); 206 imageBitmapDerived = ImageBitmap::create(imageBitmapFromCanvas.get(), In tRect(0, 0, 20, 20));
207 } 207 }
208 CanvasRenderingContext* context = canvasElement->getContext("2d"); 208 CanvasRenderingContext* context = canvasElement->getContext("2d");
209 TrackExceptionState exceptionState; 209 TrackExceptionState exceptionState;
210 toCanvasRenderingContext2D(context)->drawImage(imageBitmapDerived.get(), 0, 0, exceptionState); 210 toCanvasRenderingContext2D(context)->drawImage(imageBitmapDerived.get(), 0, 0, exceptionState);
211 } 211 }
212 212
213 } // namespace 213 } // namespace
OLDNEW
« no previous file with comments | « no previous file | Source/platform/DragImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698