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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 { | 198 { |
199 if (m_live) | 199 if (m_live) |
200 *m_live = false; | 200 *m_live = false; |
201 } | 201 } |
202 | 202 |
203 bool* m_live; | 203 bool* m_live; |
204 }; | 204 }; |
205 | 205 |
206 class DrawingBufferTest : public Test { | 206 class DrawingBufferTest : public Test { |
207 protected: | 207 protected: |
208 virtual void SetUp() | 208 void SetUp() override |
209 { | 209 { |
210 RefPtr<FakeContextEvictionManager> contextEvictionManager = adoptRef(new
FakeContextEvictionManager()); | 210 RefPtr<FakeContextEvictionManager> contextEvictionManager = adoptRef(new
FakeContextEvictionManager()); |
211 OwnPtr<WebGraphicsContext3DForTests> context = adoptPtr(new WebGraphicsC
ontext3DForTests); | 211 OwnPtr<WebGraphicsContext3DForTests> context = adoptPtr(new WebGraphicsC
ontext3DForTests); |
212 m_context = context.get(); | 212 m_context = context.get(); |
213 m_drawingBuffer = DrawingBufferForTests::create(context.release(), | 213 m_drawingBuffer = DrawingBufferForTests::create(context.release(), |
214 IntSize(initialWidth, initialHeight), DrawingBuffer::Preserve, conte
xtEvictionManager.release()); | 214 IntSize(initialWidth, initialHeight), DrawingBuffer::Preserve, conte
xtEvictionManager.release()); |
215 } | 215 } |
216 | 216 |
217 WebGraphicsContext3DForTests* webContext() | 217 WebGraphicsContext3DForTests* webContext() |
218 { | 218 { |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 m_drawingBuffer->beginDestruction(); | 436 m_drawingBuffer->beginDestruction(); |
437 waitSyncPoint = webContext()->insertSyncPoint(); | 437 waitSyncPoint = webContext()->insertSyncPoint(); |
438 mailbox.syncPoint = waitSyncPoint; | 438 mailbox.syncPoint = waitSyncPoint; |
439 m_drawingBuffer->mailboxReleased(mailbox, false); | 439 m_drawingBuffer->mailboxReleased(mailbox, false); |
440 // m_drawingBuffer waits for the sync point because the destruction is in pr
ogress. | 440 // m_drawingBuffer waits for the sync point because the destruction is in pr
ogress. |
441 EXPECT_EQ(waitSyncPoint, webContext()->mostRecentlyWaitedSyncPoint()); | 441 EXPECT_EQ(waitSyncPoint, webContext()->mostRecentlyWaitedSyncPoint()); |
442 } | 442 } |
443 | 443 |
444 class DrawingBufferImageChromiumTest : public DrawingBufferTest { | 444 class DrawingBufferImageChromiumTest : public DrawingBufferTest { |
445 protected: | 445 protected: |
446 virtual void SetUp() | 446 void SetUp() override |
447 { | 447 { |
448 RefPtr<FakeContextEvictionManager> contextEvictionManager = adoptRef(new
FakeContextEvictionManager()); | 448 RefPtr<FakeContextEvictionManager> contextEvictionManager = adoptRef(new
FakeContextEvictionManager()); |
449 OwnPtr<WebGraphicsContext3DForTests> context = adoptPtr(new WebGraphicsC
ontext3DForTests); | 449 OwnPtr<WebGraphicsContext3DForTests> context = adoptPtr(new WebGraphicsC
ontext3DForTests); |
450 m_context = context.get(); | 450 m_context = context.get(); |
451 RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(true); | 451 RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(true); |
452 m_imageId0 = webContext()->nextImageIdToBeCreated(); | 452 m_imageId0 = webContext()->nextImageIdToBeCreated(); |
453 EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId0)).Times(1); | 453 EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId0)).Times(1); |
454 m_drawingBuffer = DrawingBufferForTests::create(context.release(), | 454 m_drawingBuffer = DrawingBufferForTests::create(context.release(), |
455 IntSize(initialWidth, initialHeight), DrawingBuffer::Preserve, conte
xtEvictionManager.release()); | 455 IntSize(initialWidth, initialHeight), DrawingBuffer::Preserve, conte
xtEvictionManager.release()); |
456 testing::Mock::VerifyAndClearExpectations(webContext()); | 456 testing::Mock::VerifyAndClearExpectations(webContext()); |
457 } | 457 } |
458 | 458 |
459 virtual void TearDown() | 459 void TearDown() override |
460 { | 460 { |
461 RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(false); | 461 RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(false); |
462 } | 462 } |
463 WGC3Duint m_imageId0; | 463 WGC3Duint m_imageId0; |
464 }; | 464 }; |
465 | 465 |
466 TEST_F(DrawingBufferImageChromiumTest, verifyResizingReallocatesImages) | 466 TEST_F(DrawingBufferImageChromiumTest, verifyResizingReallocatesImages) |
467 { | 467 { |
468 WebExternalTextureMailbox mailbox; | 468 WebExternalTextureMailbox mailbox; |
469 | 469 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 mailbox.syncPoint = waitSyncPoint; | 670 mailbox.syncPoint = waitSyncPoint; |
671 m_drawingBuffer->setIsHidden(true); | 671 m_drawingBuffer->setIsHidden(true); |
672 m_drawingBuffer->mailboxReleased(mailbox); | 672 m_drawingBuffer->mailboxReleased(mailbox); |
673 // m_drawingBuffer deletes mailbox immediately when hidden. | 673 // m_drawingBuffer deletes mailbox immediately when hidden. |
674 EXPECT_EQ(waitSyncPoint, webContext()->mostRecentlyWaitedSyncPoint()); | 674 EXPECT_EQ(waitSyncPoint, webContext()->mostRecentlyWaitedSyncPoint()); |
675 | 675 |
676 m_drawingBuffer->beginDestruction(); | 676 m_drawingBuffer->beginDestruction(); |
677 } | 677 } |
678 | 678 |
679 } // namespace | 679 } // namespace |
OLD | NEW |