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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 using testing::Test; | 47 using testing::Test; |
48 using testing::_; | 48 using testing::_; |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
51 | 51 |
52 class DrawingBufferTest : public Test { | 52 class DrawingBufferTest : public Test { |
53 protected: | 53 protected: |
54 void SetUp() override { | 54 void SetUp() override { |
55 IntSize initialSize(InitialWidth, InitialHeight); | 55 IntSize initialSize(InitialWidth, InitialHeight); |
56 std::unique_ptr<GLES2InterfaceForTests> gl = | 56 std::unique_ptr<GLES2InterfaceForTests> gl = |
57 wrapUnique(new GLES2InterfaceForTests); | 57 WTF::wrapUnique(new GLES2InterfaceForTests); |
58 m_gl = gl.get(); | 58 m_gl = gl.get(); |
59 SetAndSaveRestoreState(false); | 59 SetAndSaveRestoreState(false); |
60 std::unique_ptr<WebGraphicsContext3DProviderForTests> provider = | 60 std::unique_ptr<WebGraphicsContext3DProviderForTests> provider = |
61 wrapUnique(new WebGraphicsContext3DProviderForTests(std::move(gl))); | 61 WTF::wrapUnique( |
| 62 new WebGraphicsContext3DProviderForTests(std::move(gl))); |
62 m_drawingBuffer = DrawingBufferForTests::create( | 63 m_drawingBuffer = DrawingBufferForTests::create( |
63 std::move(provider), m_gl, initialSize, DrawingBuffer::Preserve); | 64 std::move(provider), m_gl, initialSize, DrawingBuffer::Preserve); |
64 CHECK(m_drawingBuffer); | 65 CHECK(m_drawingBuffer); |
65 } | 66 } |
66 | 67 |
67 // Initialize GL state with unusual values, to verify that they are restored. | 68 // Initialize GL state with unusual values, to verify that they are restored. |
68 // The |invert| parameter will reverse all boolean parameters, so that all | 69 // The |invert| parameter will reverse all boolean parameters, so that all |
69 // values are tested. | 70 // values are tested. |
70 void SetAndSaveRestoreState(bool invert) { | 71 void SetAndSaveRestoreState(bool invert) { |
71 GLboolean scissorEnabled = !invert; | 72 GLboolean scissorEnabled = !invert; |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 // m_drawingBuffer waits for the sync point because the destruction is in | 341 // m_drawingBuffer waits for the sync point because the destruction is in |
341 // progress. | 342 // progress. |
342 EXPECT_EQ(waitSyncToken, m_gl->mostRecentlyWaitedSyncToken()); | 343 EXPECT_EQ(waitSyncToken, m_gl->mostRecentlyWaitedSyncToken()); |
343 } | 344 } |
344 | 345 |
345 class DrawingBufferImageChromiumTest : public DrawingBufferTest { | 346 class DrawingBufferImageChromiumTest : public DrawingBufferTest { |
346 protected: | 347 protected: |
347 void SetUp() override { | 348 void SetUp() override { |
348 IntSize initialSize(InitialWidth, InitialHeight); | 349 IntSize initialSize(InitialWidth, InitialHeight); |
349 std::unique_ptr<GLES2InterfaceForTests> gl = | 350 std::unique_ptr<GLES2InterfaceForTests> gl = |
350 wrapUnique(new GLES2InterfaceForTests); | 351 WTF::wrapUnique(new GLES2InterfaceForTests); |
351 m_gl = gl.get(); | 352 m_gl = gl.get(); |
352 SetAndSaveRestoreState(true); | 353 SetAndSaveRestoreState(true); |
353 std::unique_ptr<WebGraphicsContext3DProviderForTests> provider = | 354 std::unique_ptr<WebGraphicsContext3DProviderForTests> provider = |
354 wrapUnique(new WebGraphicsContext3DProviderForTests(std::move(gl))); | 355 WTF::wrapUnique( |
| 356 new WebGraphicsContext3DProviderForTests(std::move(gl))); |
355 RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(true); | 357 RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(true); |
356 m_imageId0 = m_gl->nextImageIdToBeCreated(); | 358 m_imageId0 = m_gl->nextImageIdToBeCreated(); |
357 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId0)).Times(1); | 359 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId0)).Times(1); |
358 m_drawingBuffer = DrawingBufferForTests::create( | 360 m_drawingBuffer = DrawingBufferForTests::create( |
359 std::move(provider), m_gl, initialSize, DrawingBuffer::Preserve); | 361 std::move(provider), m_gl, initialSize, DrawingBuffer::Preserve); |
360 CHECK(m_drawingBuffer); | 362 CHECK(m_drawingBuffer); |
361 testing::Mock::VerifyAndClearExpectations(m_gl); | 363 testing::Mock::VerifyAndClearExpectations(m_gl); |
362 } | 364 } |
363 | 365 |
364 void TearDown() override { | 366 void TearDown() override { |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 DepthStencilTestCase cases[] = { | 586 DepthStencilTestCase cases[] = { |
585 DepthStencilTestCase(false, false, 0, "neither"), | 587 DepthStencilTestCase(false, false, 0, "neither"), |
586 DepthStencilTestCase(true, false, 1, "stencil only"), | 588 DepthStencilTestCase(true, false, 1, "stencil only"), |
587 DepthStencilTestCase(false, true, 1, "depth only"), | 589 DepthStencilTestCase(false, true, 1, "depth only"), |
588 DepthStencilTestCase(true, true, 1, "both"), | 590 DepthStencilTestCase(true, true, 1, "both"), |
589 }; | 591 }; |
590 | 592 |
591 for (size_t i = 0; i < WTF_ARRAY_LENGTH(cases); i++) { | 593 for (size_t i = 0; i < WTF_ARRAY_LENGTH(cases); i++) { |
592 SCOPED_TRACE(cases[i].testCaseName); | 594 SCOPED_TRACE(cases[i].testCaseName); |
593 std::unique_ptr<DepthStencilTrackingGLES2Interface> gl = | 595 std::unique_ptr<DepthStencilTrackingGLES2Interface> gl = |
594 wrapUnique(new DepthStencilTrackingGLES2Interface); | 596 WTF::wrapUnique(new DepthStencilTrackingGLES2Interface); |
595 DepthStencilTrackingGLES2Interface* trackingGL = gl.get(); | 597 DepthStencilTrackingGLES2Interface* trackingGL = gl.get(); |
596 std::unique_ptr<WebGraphicsContext3DProviderForTests> provider = | 598 std::unique_ptr<WebGraphicsContext3DProviderForTests> provider = |
597 wrapUnique(new WebGraphicsContext3DProviderForTests(std::move(gl))); | 599 WTF::wrapUnique( |
| 600 new WebGraphicsContext3DProviderForTests(std::move(gl))); |
598 DrawingBuffer::PreserveDrawingBuffer preserve = DrawingBuffer::Preserve; | 601 DrawingBuffer::PreserveDrawingBuffer preserve = DrawingBuffer::Preserve; |
599 | 602 |
600 bool premultipliedAlpha = false; | 603 bool premultipliedAlpha = false; |
601 bool wantAlphaChannel = true; | 604 bool wantAlphaChannel = true; |
602 bool wantDepthBuffer = cases[i].requestDepth; | 605 bool wantDepthBuffer = cases[i].requestDepth; |
603 bool wantStencilBuffer = cases[i].requestStencil; | 606 bool wantStencilBuffer = cases[i].requestStencil; |
604 bool wantAntialiasing = false; | 607 bool wantAntialiasing = false; |
605 RefPtr<DrawingBuffer> drawingBuffer = DrawingBuffer::create( | 608 RefPtr<DrawingBuffer> drawingBuffer = DrawingBuffer::create( |
606 std::move(provider), nullptr, IntSize(10, 10), premultipliedAlpha, | 609 std::move(provider), nullptr, IntSize(10, 10), premultipliedAlpha, |
607 wantAlphaChannel, wantDepthBuffer, wantStencilBuffer, wantAntialiasing, | 610 wantAlphaChannel, wantDepthBuffer, wantStencilBuffer, wantAntialiasing, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 m_drawingBuffer->setIsHidden(true); | 663 m_drawingBuffer->setIsHidden(true); |
661 releaseCallback->Run(waitSyncToken, false /* lostResource */); | 664 releaseCallback->Run(waitSyncToken, false /* lostResource */); |
662 // m_drawingBuffer deletes mailbox immediately when hidden. | 665 // m_drawingBuffer deletes mailbox immediately when hidden. |
663 | 666 |
664 EXPECT_EQ(waitSyncToken, m_gl->mostRecentlyWaitedSyncToken()); | 667 EXPECT_EQ(waitSyncToken, m_gl->mostRecentlyWaitedSyncToken()); |
665 | 668 |
666 m_drawingBuffer->beginDestruction(); | 669 m_drawingBuffer->beginDestruction(); |
667 } | 670 } |
668 | 671 |
669 } // namespace blink | 672 } // namespace blink |
OLD | NEW |