| 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 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 | 32 |
| 33 #include "core/platform/graphics/gpu/DrawingBuffer.h" | 33 #include "core/platform/graphics/gpu/DrawingBuffer.h" |
| 34 | 34 |
| 35 #include "FakeWebGraphicsContext3D.h" | 35 #include "FakeWebGraphicsContext3D.h" |
| 36 #include "core/platform/chromium/support/GraphicsContext3DPrivate.h" | 36 #include "core/platform/graphics/GraphicsContext3D.h" |
| 37 #include <public/Platform.h> | 37 #include <public/Platform.h> |
| 38 | 38 |
| 39 #include <gmock/gmock.h> | 39 #include <gmock/gmock.h> |
| 40 #include <gtest/gtest.h> | 40 #include <gtest/gtest.h> |
| 41 #include <wtf/RefPtr.h> | 41 #include <wtf/RefPtr.h> |
| 42 | 42 |
| 43 using namespace WebCore; | 43 using namespace WebCore; |
| 44 using namespace WebKit; | 44 using namespace WebKit; |
| 45 using testing::Test; | 45 using testing::Test; |
| 46 using testing::_; | 46 using testing::_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 58 IntSize oldestContextSize() { return IntSize(); } | 58 IntSize oldestContextSize() { return IntSize(); } |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace | 61 } // namespace |
| 62 | 62 |
| 63 class DrawingBufferTest : public Test { | 63 class DrawingBufferTest : public Test { |
| 64 protected: | 64 protected: |
| 65 virtual void SetUp() | 65 virtual void SetUp() |
| 66 { | 66 { |
| 67 RefPtr<FakeContextEvictionManager> contextEvictionManager = adoptRef(new
FakeContextEvictionManager()); | 67 RefPtr<FakeContextEvictionManager> contextEvictionManager = adoptRef(new
FakeContextEvictionManager()); |
| 68 RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGrap
hicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3D)); | 68 RefPtr<GraphicsContext3D> context = GraphicsContext3D::createGraphicsCon
textFromWebContext(adoptPtr(new FakeWebGraphicsContext3D)); |
| 69 const IntSize size(100, 100); | 69 const IntSize size(100, 100); |
| 70 m_drawingBuffer = DrawingBuffer::create(context.get(), size, DrawingBuff
er::Discard, contextEvictionManager.release()); | 70 m_drawingBuffer = DrawingBuffer::create(context.get(), size, DrawingBuff
er::Discard, contextEvictionManager.release()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 RefPtr<DrawingBuffer> m_drawingBuffer; | 73 RefPtr<DrawingBuffer> m_drawingBuffer; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 namespace { | 76 namespace { |
| 77 | 77 |
| 78 TEST_F(DrawingBufferTest, verifyNoNewBuffersAfterContextLostWithTextures) | 78 TEST_F(DrawingBufferTest, verifyNoNewBuffersAfterContextLostWithTextures) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 92 { | 92 { |
| 93 // Tell the buffer its contents changed and context was lost. | 93 // Tell the buffer its contents changed and context was lost. |
| 94 m_drawingBuffer->markContentsChanged(); | 94 m_drawingBuffer->markContentsChanged(); |
| 95 m_drawingBuffer->releaseResources(); | 95 m_drawingBuffer->releaseResources(); |
| 96 | 96 |
| 97 WebKit::WebExternalTextureMailbox mailbox; | 97 WebKit::WebExternalTextureMailbox mailbox; |
| 98 EXPECT_FALSE(m_drawingBuffer->prepareMailbox(&mailbox)); | 98 EXPECT_FALSE(m_drawingBuffer->prepareMailbox(&mailbox)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace | 101 } // namespace |
| OLD | NEW |