| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |