#include "gpu/command_buffer/service/mailbox_synchronizer.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gl/gl_context_stub.h"
#include "ui/gl/gl_mock.h"
+#include "ui/gl/gl_surface_stub.h"
namespace gpu {
namespace gles2 {
manager2_ = new MailboxManager;
gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>());
::gfx::MockGLInterface::SetGLInterface(gl_.get());
+ context_ = new gfx::GLContextStub();
+ surface_ = new gfx::GLSurfaceStub();
+ context_->MakeCurrent(surface_);
}
Texture* DefineTexture() {
virtual void TearDown() {
MailboxManagerTest::TearDown();
MailboxSynchronizer::Terminate();
+ context_->ReleaseCurrent(NULL);
::gfx::MockGLInterface::SetGLInterface(NULL);
gl_.reset();
}
scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_;
scoped_refptr<MailboxManager> manager2_;
+ scoped_refptr<gfx::GLContext> context_;
+ scoped_refptr<gfx::GLSurface> surface_;
private:
DISALLOW_COPY_AND_ASSIGN(MailboxManagerSyncTest);
EXPECT_EQ(texture, manager_->ConsumeTexture(GL_TEXTURE_2D, name));
// Synchronize
- EXPECT_CALL(*gl_, Flush()).Times(1);
manager_->PushTextureUpdates();
manager2_->PullTextureUpdates();
EXPECT_EQ(texture, manager_->ConsumeTexture(GL_TEXTURE_2D, name));
// Synchronize
- EXPECT_CALL(*gl_, Flush()).Times(1);
manager_->PushTextureUpdates();
manager2_->PullTextureUpdates();
EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
// Synchronize again
- EXPECT_CALL(*gl_, Flush()).Times(1);
manager_->PushTextureUpdates();
SetupUpdateTexParamExpectations(
kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT);
manager2_->ProduceTexture(GL_TEXTURE_2D, name2, texture2);
// Make visible.
- EXPECT_CALL(*gl_, Flush()).Times(2);
manager_->PushTextureUpdates();
manager2_->PushTextureUpdates();
Mock::VerifyAndClearExpectations(gl_.get());
// Synchronize in both directions
- EXPECT_CALL(*gl_, Flush()).Times(2);
manager_->PushTextureUpdates();
manager2_->PushTextureUpdates();
// manager1 should see the change to texture2 mag_filter being applied.