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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 m_image2 = surface2->makeImageSnapshot(); | 61 m_image2 = surface2->makeImageSnapshot(); |
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. |
71 ThreadHeap::collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWi
thSweep, BlinkGC::ForcedGC); | 71 ThreadState::current()->collectGarbage(BlinkGC::NoHeapPointersOnStack, B
linkGC::GCWithSweep, BlinkGC::ForcedGC); |
72 | 72 |
73 replaceMemoryCacheForTesting(m_globalMemoryCache.release()); | 73 replaceMemoryCacheForTesting(m_globalMemoryCache.release()); |
74 } | 74 } |
75 | 75 |
76 sk_sp<SkImage> m_image, m_image2; | 76 sk_sp<SkImage> m_image, m_image2; |
77 Persistent<MemoryCache> m_globalMemoryCache; | 77 Persistent<MemoryCache> m_globalMemoryCache; |
78 }; | 78 }; |
79 | 79 |
80 TEST_F(ImageBitmapTest, ImageResourceConsistency) | 80 TEST_F(ImageBitmapTest, ImageResourceConsistency) |
81 { | 81 { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 ASSERT_NE(imageBitmap->bitmapImage()->imageForCurrentFrame(), newImageRe
source->getImage()->imageForCurrentFrame()); | 137 ASSERT_NE(imageBitmap->bitmapImage()->imageForCurrentFrame(), newImageRe
source->getImage()->imageForCurrentFrame()); |
138 SkImage* image1 = imageBitmap->bitmapImage()->imageForCurrentFrame().get
(); | 138 SkImage* image1 = imageBitmap->bitmapImage()->imageForCurrentFrame().get
(); |
139 ASSERT_NE(image1, nullptr); | 139 ASSERT_NE(image1, nullptr); |
140 SkImage* image2 = newImageResource->getImage()->imageForCurrentFrame().g
et(); | 140 SkImage* image2 = newImageResource->getImage()->imageForCurrentFrame().g
et(); |
141 ASSERT_NE(image2, nullptr); | 141 ASSERT_NE(image2, nullptr); |
142 ASSERT_NE(image1, image2); | 142 ASSERT_NE(image1, image2); |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 } // namespace blink | 146 } // namespace blink |
OLD | NEW |