| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 m_image2 = adoptRef(surface2->newImageSnapshot()); | 62 m_image2 = adoptRef(surface2->newImageSnapshot()); |
| 63 | 63 |
| 64 // Save the global memory cache to restore it upon teardown. | 64 // Save the global memory cache to restore it upon teardown. |
| 65 m_globalMemoryCache = replaceMemoryCacheForTesting(MemoryCache::create()
); | 65 m_globalMemoryCache = replaceMemoryCacheForTesting(MemoryCache::create()
); |
| 66 } | 66 } |
| 67 virtual void TearDown() | 67 virtual void TearDown() |
| 68 { | 68 { |
| 69 // Garbage collection is required prior to switching out the | 69 // Garbage collection is required prior to switching out the |
| 70 // test's memory cache; image resources are released, evicting | 70 // test's memory cache; image resources are released, evicting |
| 71 // them from the cache. | 71 // them from the cache. |
| 72 ThreadHeap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWi
thSweep, BlinkGC::ForcedGC); | 72 Heap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSwee
p, BlinkGC::ForcedGC); |
| 73 | 73 |
| 74 replaceMemoryCacheForTesting(m_globalMemoryCache.release()); | 74 replaceMemoryCacheForTesting(m_globalMemoryCache.release()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 RefPtr<SkImage> m_image, m_image2; | 77 RefPtr<SkImage> m_image, m_image2; |
| 78 Persistent<MemoryCache> m_globalMemoryCache; | 78 Persistent<MemoryCache> m_globalMemoryCache; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 TEST_F(ImageBitmapTest, ImageResourceConsistency) | 81 TEST_F(ImageBitmapTest, ImageResourceConsistency) |
| 82 { | 82 { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 ASSERT_NE(imageBitmap->bitmapImage()->imageForCurrentFrame(), newImageRe
source->getImage()->imageForCurrentFrame()); | 138 ASSERT_NE(imageBitmap->bitmapImage()->imageForCurrentFrame(), newImageRe
source->getImage()->imageForCurrentFrame()); |
| 139 SkImage* image1 = imageBitmap->bitmapImage()->imageForCurrentFrame().get
(); | 139 SkImage* image1 = imageBitmap->bitmapImage()->imageForCurrentFrame().get
(); |
| 140 ASSERT_NE(image1, nullptr); | 140 ASSERT_NE(image1, nullptr); |
| 141 SkImage* image2 = newImageResource->getImage()->imageForCurrentFrame().g
et(); | 141 SkImage* image2 = newImageResource->getImage()->imageForCurrentFrame().g
et(); |
| 142 ASSERT_NE(image2, nullptr); | 142 ASSERT_NE(image2, nullptr); |
| 143 ASSERT_NE(image1, image2); | 143 ASSERT_NE(image1, image2); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace blink | 147 } // namespace blink |
| OLD | NEW |