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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 static const int initialHeight = 100; | 105 static const int initialHeight = 100; |
106 static const int alternateHeight = 50; | 106 static const int alternateHeight = 50; |
107 | 107 |
108 } // namespace | 108 } // namespace |
109 | 109 |
110 class DrawingBufferTest : public Test { | 110 class DrawingBufferTest : public Test { |
111 protected: | 111 protected: |
112 virtual void SetUp() | 112 virtual void SetUp() |
113 { | 113 { |
114 RefPtr<FakeContextEvictionManager> contextEvictionManager = adoptRef(new
FakeContextEvictionManager()); | 114 RefPtr<FakeContextEvictionManager> contextEvictionManager = adoptRef(new
FakeContextEvictionManager()); |
115 m_context = adoptPtr(new WebGraphicsContext3DForTests); | 115 OwnPtr<WebGraphicsContext3DForTests> context = adoptPtr(new WebGraphicsC
ontext3DForTests); |
116 m_drawingBuffer = DrawingBuffer::create(m_context.get(), IntSize(initial
Width, initialHeight), DrawingBuffer::Preserve, contextEvictionManager.release()
); | 116 m_context = context.get(); |
| 117 m_drawingBuffer = DrawingBuffer::create(context.release(), IntSize(initi
alWidth, initialHeight), DrawingBuffer::Preserve, contextEvictionManager.release
()); |
117 } | 118 } |
118 | 119 |
119 WebGraphicsContext3DForTests* webContext() | 120 WebGraphicsContext3DForTests* webContext() |
120 { | 121 { |
121 return m_context.get(); | 122 return m_context; |
122 } | 123 } |
123 | 124 |
124 OwnPtr<WebGraphicsContext3DForTests> m_context; | 125 WebGraphicsContext3DForTests* m_context; |
125 RefPtr<DrawingBuffer> m_drawingBuffer; | 126 RefPtr<DrawingBuffer> m_drawingBuffer; |
126 }; | 127 }; |
127 | 128 |
128 namespace { | 129 namespace { |
129 | 130 |
130 TEST_F(DrawingBufferTest, testPaintRenderingResultsToCanvas) | 131 TEST_F(DrawingBufferTest, testPaintRenderingResultsToCanvas) |
131 { | 132 { |
132 OwnPtr<ImageBufferSurface> imageBufferSurface = adoptPtr(new UnacceleratedIm
ageBufferSurface(IntSize(initialWidth, initialHeight))); | 133 OwnPtr<ImageBufferSurface> imageBufferSurface = adoptPtr(new UnacceleratedIm
ageBufferSurface(IntSize(initialWidth, initialHeight))); |
133 EXPECT_FALSE(!imageBufferSurface); | 134 EXPECT_FALSE(!imageBufferSurface); |
134 EXPECT_TRUE(imageBufferSurface->isValid()); | 135 EXPECT_TRUE(imageBufferSurface->isValid()); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&recycledMailbox, 0)); | 229 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&recycledMailbox, 0)); |
229 EXPECT_EQ(TextureMailboxWrapper(mailbox3), TextureMailboxWrapper(recycledMai
lbox)); | 230 EXPECT_EQ(TextureMailboxWrapper(mailbox3), TextureMailboxWrapper(recycledMai
lbox)); |
230 | 231 |
231 // The third recycled mailbox must be 1. | 232 // The third recycled mailbox must be 1. |
232 m_drawingBuffer->markContentsChanged(); | 233 m_drawingBuffer->markContentsChanged(); |
233 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&recycledMailbox, 0)); | 234 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&recycledMailbox, 0)); |
234 EXPECT_EQ(TextureMailboxWrapper(mailbox1), TextureMailboxWrapper(recycledMai
lbox)); | 235 EXPECT_EQ(TextureMailboxWrapper(mailbox1), TextureMailboxWrapper(recycledMai
lbox)); |
235 } | 236 } |
236 | 237 |
237 } // namespace | 238 } // namespace |
OLD | NEW |