コード例 #1
0
TEST_F(DrawingBufferTest, verifyResizingProperlyAffectsMailboxes) {
  VerifyStateWasRestored();
  cc::TextureMailbox textureMailbox;
  std::unique_ptr<cc::SingleReleaseCallback> releaseCallback;

  IntSize initialSize(InitialWidth, InitialHeight);
  IntSize alternateSize(InitialWidth, AlternateHeight);

  // Produce one mailbox at size 100x100.
  m_drawingBuffer->markContentsChanged();
  EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox,
                                                     &releaseCallback));
  VerifyStateWasRestored();
  EXPECT_EQ(initialSize, m_gl->mostRecentlyProducedSize());

  // Resize to 100x50.
  m_drawingBuffer->resize(alternateSize);
  VerifyStateWasRestored();
  releaseCallback->Run(gpu::SyncToken(), false /* lostResource */);
  VerifyStateWasRestored();

  // Produce a mailbox at this size.
  m_drawingBuffer->markContentsChanged();
  EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox,
                                                     &releaseCallback));
  EXPECT_EQ(alternateSize, m_gl->mostRecentlyProducedSize());
  VerifyStateWasRestored();

  // Reset to initial size.
  m_drawingBuffer->resize(initialSize);
  VerifyStateWasRestored();
  SetAndSaveRestoreState(true);
  releaseCallback->Run(gpu::SyncToken(), false /* lostResource */);
  VerifyStateWasRestored();

  // Prepare another mailbox and verify that it's the correct size.
  m_drawingBuffer->markContentsChanged();
  EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox,
                                                     &releaseCallback));
  EXPECT_EQ(initialSize, m_gl->mostRecentlyProducedSize());
  VerifyStateWasRestored();

  // Prepare one final mailbox and verify that it's the correct size.
  releaseCallback->Run(gpu::SyncToken(), false /* lostResource */);
  m_drawingBuffer->markContentsChanged();
  EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox,
                                                     &releaseCallback));
  VerifyStateWasRestored();
  EXPECT_EQ(initialSize, m_gl->mostRecentlyProducedSize());
  releaseCallback->Run(gpu::SyncToken(), false /* lostResource */);
  m_drawingBuffer->beginDestruction();
}
コード例 #2
0
 void SetUp() override {
   IntSize initialSize(InitialWidth, InitialHeight);
   std::unique_ptr<GLES2InterfaceForTests> gl =
       WTF::wrapUnique(new GLES2InterfaceForTests);
   m_gl = gl.get();
   SetAndSaveRestoreState(false);
   std::unique_ptr<WebGraphicsContext3DProviderForTests> provider =
       WTF::wrapUnique(
           new WebGraphicsContext3DProviderForTests(std::move(gl)));
   m_drawingBuffer = DrawingBufferForTests::create(
       std::move(provider), m_gl, initialSize, DrawingBuffer::Preserve);
   CHECK(m_drawingBuffer);
 }
コード例 #3
0
TEST_F(DrawingBufferImageChromiumTest, allocationFailure) {
  cc::TextureMailbox textureMailbox1;
  std::unique_ptr<cc::SingleReleaseCallback> releaseCallback1;
  cc::TextureMailbox textureMailbox2;
  std::unique_ptr<cc::SingleReleaseCallback> releaseCallback2;
  cc::TextureMailbox textureMailbox3;
  std::unique_ptr<cc::SingleReleaseCallback> releaseCallback3;

  // Request a mailbox. An image should already be created. Everything works
  // as expected.
  EXPECT_CALL(*m_gl, BindTexImage2DMock(_)).Times(1);
  IntSize initialSize(InitialWidth, InitialHeight);
  m_drawingBuffer->markContentsChanged();
  EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox1,
                                                     &releaseCallback1));
  EXPECT_TRUE(textureMailbox1.is_overlay_candidate());
  testing::Mock::VerifyAndClearExpectations(m_gl);
  VerifyStateWasRestored();

  // Force image CHROMIUM creation failure. Request another mailbox. It should
  // still be provided, but this time with allowOverlay = false.
  m_gl->setCreateImageChromiumFail(true);
  m_drawingBuffer->markContentsChanged();
  EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox2,
                                                     &releaseCallback2));
  EXPECT_FALSE(textureMailbox2.is_overlay_candidate());
  VerifyStateWasRestored();

  // Check that if image CHROMIUM starts working again, mailboxes are
  // correctly created with allowOverlay = true.
  EXPECT_CALL(*m_gl, BindTexImage2DMock(_)).Times(1);
  m_gl->setCreateImageChromiumFail(false);
  m_drawingBuffer->markContentsChanged();
  EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox3,
                                                     &releaseCallback3));
  EXPECT_TRUE(textureMailbox3.is_overlay_candidate());
  testing::Mock::VerifyAndClearExpectations(m_gl);
  VerifyStateWasRestored();

  releaseCallback1->Run(gpu::SyncToken(), false /* lostResource */);
  releaseCallback2->Run(gpu::SyncToken(), false /* lostResource */);
  releaseCallback3->Run(gpu::SyncToken(), false /* lostResource */);

  EXPECT_CALL(*m_gl, DestroyImageMock(_)).Times(3);
  EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(_)).Times(3);
  m_drawingBuffer->beginDestruction();
  testing::Mock::VerifyAndClearExpectations(m_gl);
}
コード例 #4
0
TEST_F(DrawingBufferTest, verifyDestructionCompleteAfterAllMailboxesReleased) {
  bool live = true;
  m_drawingBuffer->m_live = &live;

  cc::TextureMailbox textureMailbox1;
  std::unique_ptr<cc::SingleReleaseCallback> releaseCallback1;
  cc::TextureMailbox textureMailbox2;
  std::unique_ptr<cc::SingleReleaseCallback> releaseCallback2;
  cc::TextureMailbox textureMailbox3;
  std::unique_ptr<cc::SingleReleaseCallback> releaseCallback3;

  IntSize initialSize(InitialWidth, InitialHeight);

  // Produce mailboxes.
  m_drawingBuffer->markContentsChanged();
  m_drawingBuffer->clearFramebuffers(GL_STENCIL_BUFFER_BIT);
  VerifyStateWasRestored();
  EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox1,
                                                     &releaseCallback1));
  m_drawingBuffer->markContentsChanged();
  m_drawingBuffer->clearFramebuffers(GL_DEPTH_BUFFER_BIT);
  VerifyStateWasRestored();
  EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox2,
                                                     &releaseCallback2));
  m_drawingBuffer->markContentsChanged();
  m_drawingBuffer->clearFramebuffers(GL_COLOR_BUFFER_BIT);
  VerifyStateWasRestored();
  EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox3,
                                                     &releaseCallback3));

  m_drawingBuffer->markContentsChanged();
  releaseCallback1->Run(gpu::SyncToken(), false /* lostResource */);

  m_drawingBuffer->beginDestruction();
  ASSERT_EQ(live, true);

  DrawingBufferForTests* rawPointer = m_drawingBuffer.get();
  m_drawingBuffer.clear();
  ASSERT_EQ(live, true);

  rawPointer->markContentsChanged();
  releaseCallback2->Run(gpu::SyncToken(), false /* lostResource */);
  ASSERT_EQ(live, true);

  rawPointer->markContentsChanged();
  releaseCallback3->Run(gpu::SyncToken(), false /* lostResource */);
  ASSERT_EQ(live, false);
}
コード例 #5
0
void StatesEditorWidget::reloadQmlSource()
{
    QString statesListQmlFilePath = qmlSourcesPath() + QStringLiteral("/StatesList.qml");
    QTC_ASSERT(QFileInfo::exists(statesListQmlFilePath), return);
    engine()->clearComponentCache();
    setSource(QUrl::fromLocalFile(statesListQmlFilePath));

    QTC_ASSERT(rootObject(), return);
    connect(rootObject(), SIGNAL(currentStateInternalIdChanged()), m_statesEditorView.data(), SLOT(synchonizeCurrentStateFromWidget()));
    connect(rootObject(), SIGNAL(createNewState()), m_statesEditorView.data(), SLOT(createNewState()));
    connect(rootObject(), SIGNAL(deleteState(int)), m_statesEditorView.data(), SLOT(removeState(int)));
    m_statesEditorView.data()->synchonizeCurrentStateFromWidget();
    setFixedHeight(initialSize().height());

    connect(rootObject(), SIGNAL(expandedChanged()), this, SLOT(changeHeight()));
}
コード例 #6
0
 void SetUp() override {
   IntSize initialSize(InitialWidth, InitialHeight);
   std::unique_ptr<GLES2InterfaceForTests> gl =
       WTF::wrapUnique(new GLES2InterfaceForTests);
   m_gl = gl.get();
   SetAndSaveRestoreState(true);
   std::unique_ptr<WebGraphicsContext3DProviderForTests> provider =
       WTF::wrapUnique(
           new WebGraphicsContext3DProviderForTests(std::move(gl)));
   RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(true);
   m_imageId0 = m_gl->nextImageIdToBeCreated();
   EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId0)).Times(1);
   m_drawingBuffer = DrawingBufferForTests::create(
       std::move(provider), m_gl, initialSize, DrawingBuffer::Preserve);
   CHECK(m_drawingBuffer);
   testing::Mock::VerifyAndClearExpectations(m_gl);
 }
コード例 #7
0
int ExtentManager::followupSize(int len, int lastExtentLen) const {
    invariant(len < maxSize());
    int x = initialSize(len);
    // changed from 1.20 to 1.35 in v2.1.x to get to larger extent size faster
    int y = (int)(lastExtentLen < 4000000 ? lastExtentLen * 4.0 : lastExtentLen * 1.35);
    int sz = y > x ? y : x;

    if (sz < lastExtentLen) {
        // this means there was an int overflow
        // so we should turn it into maxSize
        return maxSize();
    } else if (sz > maxSize()) {
        return maxSize();
    }

    sz = quantizeExtentSize(sz);
    verify(sz >= len);

    return sz;
}
コード例 #8
0
TEST_F(DrawingBufferTest, verifyResizingProperlyAffectsMailboxes)
{
    WebExternalTextureMailbox mailbox;

    IntSize initialSize(initialWidth, initialHeight);
    IntSize alternateSize(initialWidth, alternateHeight);

    // Produce one mailbox at size 100x100.
    m_drawingBuffer->markContentsChanged();
    EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
    EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize());

    // Resize to 100x50.
    m_drawingBuffer->reset(IntSize(initialWidth, alternateHeight));
    m_drawingBuffer->mailboxReleased(mailbox, false);

    // Produce a mailbox at this size.
    m_drawingBuffer->markContentsChanged();
    EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
    EXPECT_EQ(alternateSize, webContext()->mostRecentlyProducedSize());

    // Reset to initial size.
    m_drawingBuffer->reset(IntSize(initialWidth, initialHeight));
    m_drawingBuffer->mailboxReleased(mailbox, false);

    // Prepare another mailbox and verify that it's the correct size.
    m_drawingBuffer->markContentsChanged();
    EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
    EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize());

    // Prepare one final mailbox and verify that it's the correct size.
    m_drawingBuffer->mailboxReleased(mailbox, false);
    m_drawingBuffer->markContentsChanged();
    EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
    EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize());
    m_drawingBuffer->mailboxReleased(mailbox, false);
    m_drawingBuffer->beginDestruction();
}
コード例 #9
0
TEST_F(DrawingBufferTest, verifyDestructionCompleteAfterAllMailboxesReleased)
{
    bool live = true;
    m_drawingBuffer->m_live = &live;

    WebExternalTextureMailbox mailbox1;
    WebExternalTextureMailbox mailbox2;
    WebExternalTextureMailbox mailbox3;

    IntSize initialSize(initialWidth, initialHeight);

    // Produce mailboxes.
    m_drawingBuffer->markContentsChanged();
    EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox1, 0));
    m_drawingBuffer->markContentsChanged();
    EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox2, 0));
    m_drawingBuffer->markContentsChanged();
    EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox3, 0));

    m_drawingBuffer->markContentsChanged();
    m_drawingBuffer->mailboxReleased(mailbox1, false);

    m_drawingBuffer->beginDestruction();
    EXPECT_EQ(live, true);

    DrawingBufferForTests* weakPointer = m_drawingBuffer.get();
    m_drawingBuffer.clear();
    EXPECT_EQ(live, true);

    weakPointer->markContentsChanged();
    weakPointer->mailboxReleased(mailbox2, false);
    EXPECT_EQ(live, true);

    weakPointer->markContentsChanged();
    weakPointer->mailboxReleased(mailbox3, false);
    EXPECT_EQ(live, false);
}
コード例 #10
0
    Status MmapV1ExtentManager::init(OperationContext* txn) {
        invariant(_files.empty());

        for (int n = 0; n < DiskLoc::MaxFiles; n++) {
            const boost::filesystem::path fullName = _fileName(n);
            if (!boost::filesystem::exists(fullName)) {
                break;
            }

            const std::string fullNameString = fullName.string();

            {
                // If the file is uninitialized we exit the loop because it is just prealloced. We
                // do this on a bare File object rather than using the DataFile because closing a
                // DataFile triggers dur::closingFileNotification() which is fatal if there are any
                // pending writes. Therefore we must only open files that we know we want to keep.
                File preview;
                preview.open(fullNameString.c_str(), /*readOnly*/ true);
                invariant(preview.is_open());

                // File can't be initialized if too small.
                if (preview.len() < sizeof(DataFileHeader)) {
                    break;
                }

                // This is the equivalent of DataFileHeader::uninitialized().
                int version;
                preview.read(0, reinterpret_cast<char*>(&version), sizeof(version));
                invariant(!preview.bad());
                if (version == 0) {
                    break;
                }
            }

            unique_ptr<DataFile> df(new DataFile(n));

            Status s = df->openExisting(fullNameString.c_str());
            if (!s.isOK()) {
                return s;
            }

            invariant(!df->getHeader()->uninitialized());

            // We only checkUpgrade on files that we are keeping, not preallocs.
            df->getHeader()->checkUpgrade(txn);

            _files.push_back( df.release() );
        }

        // If this is a new database being created, instantiate the first file and one extent so
        // we can have a coherent database.
        if (_files.empty()) {
            WriteUnitOfWork wuow(txn);
            _createExtent(txn, initialSize(128), false);
            wuow.commit();

            // Commit the journal and all changes to disk so that even if exceptions occur during
            // subsequent initialization, we won't have uncommited changes during file close.
            getDur().commitNow(txn);
        }

        return Status::OK();
    }
コード例 #11
0
TEST_F(DrawingBufferImageChromiumTest, verifyResizingReallocatesImages) {
  cc::TextureMailbox textureMailbox;
  std::unique_ptr<cc::SingleReleaseCallback> releaseCallback;

  IntSize initialSize(InitialWidth, InitialHeight);
  IntSize alternateSize(InitialWidth, AlternateHeight);

  GLuint m_imageId1 = m_gl->nextImageIdToBeCreated();
  EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId1)).Times(1);
  // Produce one mailbox at size 100x100.
  m_drawingBuffer->markContentsChanged();
  EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox,
                                                     &releaseCallback));
  EXPECT_EQ(initialSize, m_gl->mostRecentlyProducedSize());
  EXPECT_TRUE(textureMailbox.is_overlay_candidate());
  testing::Mock::VerifyAndClearExpectations(m_gl);
  VerifyStateWasRestored();

  GLuint m_imageId2 = m_gl->nextImageIdToBeCreated();
  EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId2)).Times(1);
  EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId0)).Times(1);
  EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId0)).Times(1);
  EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId1)).Times(1);
  EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId1)).Times(1);
  // Resize to 100x50.
  m_drawingBuffer->resize(alternateSize);
  VerifyStateWasRestored();
  releaseCallback->Run(gpu::SyncToken(), false /* lostResource */);
  VerifyStateWasRestored();
  testing::Mock::VerifyAndClearExpectations(m_gl);

  GLuint m_imageId3 = m_gl->nextImageIdToBeCreated();
  EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId3)).Times(1);
  // Produce a mailbox at this size.
  m_drawingBuffer->markContentsChanged();
  EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox,
                                                     &releaseCallback));
  EXPECT_EQ(alternateSize, m_gl->mostRecentlyProducedSize());
  EXPECT_TRUE(textureMailbox.is_overlay_candidate());
  testing::Mock::VerifyAndClearExpectations(m_gl);

  GLuint m_imageId4 = m_gl->nextImageIdToBeCreated();
  EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId4)).Times(1);
  EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId2)).Times(1);
  EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId2)).Times(1);
  EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId3)).Times(1);
  EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId3)).Times(1);
  // Reset to initial size.
  m_drawingBuffer->resize(initialSize);
  VerifyStateWasRestored();
  releaseCallback->Run(gpu::SyncToken(), false /* lostResource */);
  VerifyStateWasRestored();
  testing::Mock::VerifyAndClearExpectations(m_gl);

  GLuint m_imageId5 = m_gl->nextImageIdToBeCreated();
  EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId5)).Times(1);
  // Prepare another mailbox and verify that it's the correct size.
  m_drawingBuffer->markContentsChanged();
  EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox,
                                                     &releaseCallback));
  EXPECT_EQ(initialSize, m_gl->mostRecentlyProducedSize());
  EXPECT_TRUE(textureMailbox.is_overlay_candidate());
  testing::Mock::VerifyAndClearExpectations(m_gl);

  // Prepare one final mailbox and verify that it's the correct size.
  releaseCallback->Run(gpu::SyncToken(), false /* lostResource */);
  m_drawingBuffer->markContentsChanged();
  EXPECT_TRUE(m_drawingBuffer->PrepareTextureMailbox(&textureMailbox,
                                                     &releaseCallback));
  EXPECT_EQ(initialSize, m_gl->mostRecentlyProducedSize());
  EXPECT_TRUE(textureMailbox.is_overlay_candidate());
  releaseCallback->Run(gpu::SyncToken(), false /* lostResource */);

  EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId5)).Times(1);
  EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId5)).Times(1);
  EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId4)).Times(1);
  EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId4)).Times(1);
  m_drawingBuffer->beginDestruction();
  testing::Mock::VerifyAndClearExpectations(m_gl);
}
コード例 #12
0
ファイル: config.hpp プロジェクト: ill-look-later/qvr
 /*! \brief Returns the initial geometry of this window on the screen, composed from initialPosition() and initialSize(). */
 QRect initialGeometry() const { return QRect(initialPosition(), initialSize()); }
コード例 #13
0
TEST_F(DrawingBufferImageChromiumTest, verifyResizingReallocatesImages)
{
    WebExternalTextureMailbox mailbox;

    IntSize initialSize(initialWidth, initialHeight);
    IntSize alternateSize(initialWidth, alternateHeight);

    WGC3Duint m_imageId1 = webContext()->nextImageIdToBeCreated();
    EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId1)).Times(1);
    // Produce one mailbox at size 100x100.
    m_drawingBuffer->markContentsChanged();
    EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
    EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize());
    EXPECT_TRUE(mailbox.allowOverlay);
    testing::Mock::VerifyAndClearExpectations(webContext());

    WGC3Duint m_imageId2 = webContext()->nextImageIdToBeCreated();
    EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId2)).Times(1);
    EXPECT_CALL(*webContext(), destroyImageMock(m_imageId0)).Times(1);
    EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId0)).Times(1);
    // Resize to 100x50.
    m_drawingBuffer->reset(IntSize(initialWidth, alternateHeight));
    m_drawingBuffer->mailboxReleased(mailbox, false);
    testing::Mock::VerifyAndClearExpectations(webContext());

    WGC3Duint m_imageId3 = webContext()->nextImageIdToBeCreated();
    EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId3)).Times(1);
    EXPECT_CALL(*webContext(), destroyImageMock(m_imageId1)).Times(1);
    EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId1)).Times(1);
    // Produce a mailbox at this size.
    m_drawingBuffer->markContentsChanged();
    EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
    EXPECT_EQ(alternateSize, webContext()->mostRecentlyProducedSize());
    EXPECT_TRUE(mailbox.allowOverlay);
    testing::Mock::VerifyAndClearExpectations(webContext());

    WGC3Duint m_imageId4 = webContext()->nextImageIdToBeCreated();
    EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId4)).Times(1);
    EXPECT_CALL(*webContext(), destroyImageMock(m_imageId2)).Times(1);
    EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId2)).Times(1);
    // Reset to initial size.
    m_drawingBuffer->reset(IntSize(initialWidth, initialHeight));
    m_drawingBuffer->mailboxReleased(mailbox, false);
    testing::Mock::VerifyAndClearExpectations(webContext());

    WGC3Duint m_imageId5 = webContext()->nextImageIdToBeCreated();
    EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId5)).Times(1);
    EXPECT_CALL(*webContext(), destroyImageMock(m_imageId3)).Times(1);
    EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId3)).Times(1);
    // Prepare another mailbox and verify that it's the correct size.
    m_drawingBuffer->markContentsChanged();
    EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
    EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize());
    EXPECT_TRUE(mailbox.allowOverlay);
    testing::Mock::VerifyAndClearExpectations(webContext());

    // Prepare one final mailbox and verify that it's the correct size.
    m_drawingBuffer->mailboxReleased(mailbox, false);
    m_drawingBuffer->markContentsChanged();
    EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0));
    EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize());
    EXPECT_TRUE(mailbox.allowOverlay);
    m_drawingBuffer->mailboxReleased(mailbox, false);

    EXPECT_CALL(*webContext(), destroyImageMock(m_imageId5)).Times(1);
    EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId5)).Times(1);
    EXPECT_CALL(*webContext(), destroyImageMock(m_imageId4)).Times(1);
    EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId4)).Times(1);
    m_drawingBuffer->beginDestruction();
    testing::Mock::VerifyAndClearExpectations(webContext());
}