Chromium Code Reviews| 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 WebCore { | 51 namespace WebCore { |
| 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 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); | 57 ASSERT_TRUE(m_bitmap.allocN32Pixels(10, 10)); |
|
reed1
2014/03/17 17:36:51
I presume ASSERT_TRUE executes its argument in deb
| |
| 58 m_bitmap.allocPixels(); | |
| 59 m_bitmap.eraseColor(0xFFFFFFFF); | 58 m_bitmap.eraseColor(0xFFFFFFFF); |
| 60 | 59 |
| 61 m_bitmap2.setConfig(SkBitmap::kARGB_8888_Config, 5, 5); | 60 ASSERT_TRUE(m_bitmap2.allocN32Pixels(5, 5)); |
| 62 m_bitmap2.allocPixels(); | |
| 63 m_bitmap2.eraseColor(0xAAAAAAAA); | 61 m_bitmap2.eraseColor(0xAAAAAAAA); |
| 64 | 62 |
| 65 // Save the global memory cache to restore it upon teardown. | 63 // Save the global memory cache to restore it upon teardown. |
| 66 m_globalMemoryCache = adoptPtr(memoryCache()); | 64 m_globalMemoryCache = adoptPtr(memoryCache()); |
| 67 // Create the test memory cache instance and hook it in. | 65 // Create the test memory cache instance and hook it in. |
| 68 m_testingMemoryCache = adoptPtr(new MemoryCache()); | 66 m_testingMemoryCache = adoptPtr(new MemoryCache()); |
| 69 setMemoryCacheForTesting(m_testingMemoryCache.leakPtr()); | 67 setMemoryCacheForTesting(m_testingMemoryCache.leakPtr()); |
| 70 } | 68 } |
| 71 virtual void TearDown() | 69 virtual void TearDown() |
| 72 { | 70 { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 { | 214 { |
| 217 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapFromCanvas = ImageBitmap::cre ate(canvasElement.get(), IntRect(0, 0, canvasElement->width(), canvasElement->he ight())); | 215 RefPtrWillBeRawPtr<ImageBitmap> imageBitmapFromCanvas = ImageBitmap::cre ate(canvasElement.get(), IntRect(0, 0, canvasElement->width(), canvasElement->he ight())); |
| 218 imageBitmapDerived = ImageBitmap::create(imageBitmapFromCanvas.get(), In tRect(0, 0, 20, 20)); | 216 imageBitmapDerived = ImageBitmap::create(imageBitmapFromCanvas.get(), In tRect(0, 0, 20, 20)); |
| 219 } | 217 } |
| 220 CanvasRenderingContext* context = canvasElement->getContext("2d"); | 218 CanvasRenderingContext* context = canvasElement->getContext("2d"); |
| 221 TrackExceptionState exceptionState; | 219 TrackExceptionState exceptionState; |
| 222 toCanvasRenderingContext2D(context)->drawImage(imageBitmapDerived.get(), 0, 0, exceptionState); | 220 toCanvasRenderingContext2D(context)->drawImage(imageBitmapDerived.get(), 0, 0, exceptionState); |
| 223 } | 221 } |
| 224 | 222 |
| 225 } // namespace | 223 } // namespace |
| OLD | NEW |