Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Unified Diff: gpu/command_buffer/service/mailbox_manager_unittest.cc

Issue 2315313003: Add a base class of Texture for interfacing with the mailbox manager. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/mailbox_manager_unittest.cc
diff --git a/gpu/command_buffer/service/mailbox_manager_unittest.cc b/gpu/command_buffer/service/mailbox_manager_unittest.cc
index 0c2a1e0f1e54dad240c81c09fe0857582738bf71..9d7772b9a80fd5c277d426a9b6c0d44c04407eb0 100644
--- a/gpu/command_buffer/service/mailbox_manager_unittest.cc
+++ b/gpu/command_buffer/service/mailbox_manager_unittest.cc
@@ -80,7 +80,7 @@ class MailboxManagerTest : public GpuServiceTest {
return texture->SetParameteri(feature_info_.get(), pname, param);
}
- void DestroyTexture(Texture* texture) {
+ void DestroyTexture(TextureBase* texture) {
delete texture;
}
@@ -331,8 +331,10 @@ TEST_F(MailboxManagerSyncTest, ProduceConsumeResize) {
.WillOnce(SetArgPointee<1>(kNewTextureId));
SetupUpdateTexParamExpectations(
kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT);
- Texture* new_texture = manager2_->ConsumeTexture(name);
- EXPECT_FALSE(new_texture == NULL);
+ TextureBase* new_texture_base = manager2_->ConsumeTexture(name);
+ EXPECT_NE(nullptr, new_texture_base);
+ Texture* new_texture = new_texture_base->AsTexture();
+ EXPECT_NE(nullptr, new_texture);
EXPECT_NE(texture, new_texture);
EXPECT_EQ(kNewTextureId, new_texture->service_id());
@@ -388,8 +390,8 @@ TEST_F(MailboxManagerSyncTest, ProduceConsumeBidirectional) {
Mailbox name1 = Mailbox::Generate();
Texture* texture2 = DefineTexture();
Mailbox name2 = Mailbox::Generate();
- Texture* new_texture1 = NULL;
- Texture* new_texture2 = NULL;
+ TextureBase* new_texture1 = NULL;
+ TextureBase* new_texture2 = NULL;
manager_->ProduceTexture(name1, texture1);
manager2_->ProduceTexture(name2, texture2);
@@ -471,8 +473,10 @@ TEST_F(MailboxManagerSyncTest, ProduceAndClobber) {
.WillOnce(SetArgPointee<1>(kNewTextureId));
SetupUpdateTexParamExpectations(
kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT);
- Texture* new_texture = manager2_->ConsumeTexture(name);
- EXPECT_FALSE(new_texture == NULL);
+ TextureBase* new_texture_base = manager2_->ConsumeTexture(name);
+ EXPECT_NE(nullptr, new_texture_base);
+ Texture* new_texture = new_texture_base->AsTexture();
+ EXPECT_NE(nullptr, new_texture);
EXPECT_NE(texture, new_texture);
EXPECT_EQ(kNewTextureId, new_texture->service_id());
@@ -505,7 +509,7 @@ TEST_F(MailboxManagerSyncTest, ProduceAndClobber) {
.WillOnce(SetArgPointee<1>(kNewTextureId));
SetupUpdateTexParamExpectations(
kNewTextureId, GL_NEAREST, GL_LINEAR, GL_REPEAT, GL_REPEAT);
- Texture* tmp_texture = manager2_->ConsumeTexture(name);
+ TextureBase* tmp_texture = manager2_->ConsumeTexture(name);
EXPECT_NE(new_texture, tmp_texture);
DestroyTexture(tmp_texture);
@@ -536,8 +540,10 @@ TEST_F(MailboxManagerSyncTest, ClearedStateSynced) {
.WillOnce(SetArgPointee<1>(kNewTextureId));
SetupUpdateTexParamExpectations(
kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT);
- Texture* new_texture = manager2_->ConsumeTexture(name);
- EXPECT_FALSE(new_texture == NULL);
+ TextureBase* new_texture_base = manager2_->ConsumeTexture(name);
+ EXPECT_NE(nullptr, new_texture_base);
+ Texture* new_texture = new_texture_base->AsTexture();
+ EXPECT_NE(nullptr, new_texture);
EXPECT_NE(texture, new_texture);
EXPECT_EQ(kNewTextureId, new_texture->service_id());
EXPECT_TRUE(texture->SafeToRenderFrom());
@@ -584,8 +590,10 @@ TEST_F(MailboxManagerSyncTest, SyncIncompleteTexture) {
SetupUpdateTexParamExpectations(kNewTextureId, texture->min_filter(),
texture->mag_filter(), texture->wrap_s(),
texture->wrap_t());
- Texture* new_texture = manager2_->ConsumeTexture(name);
- ASSERT_TRUE(new_texture);
+ TextureBase* new_texture_base = manager2_->ConsumeTexture(name);
+ EXPECT_NE(nullptr, new_texture_base);
+ Texture* new_texture = new_texture_base->AsTexture();
+ EXPECT_NE(nullptr, new_texture);
EXPECT_NE(texture, new_texture);
EXPECT_EQ(kNewTextureId, new_texture->service_id());
EXPECT_FALSE(new_texture->IsDefined());
@@ -632,7 +640,7 @@ TEST_F(MailboxManagerSyncTest, SharedThroughMultipleMailboxes) {
manager2_->PullTextureUpdates(g_sync_token);
SetupUpdateTexParamExpectations(
kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT);
- Texture* new_texture = manager2_->ConsumeTexture(name1);
+ TextureBase* new_texture = manager2_->ConsumeTexture(name1);
EXPECT_EQ(kNewTextureId, new_texture->service_id());
manager_->ProduceTexture(name2, texture);
@@ -670,7 +678,7 @@ TEST_F(MailboxManagerSyncTest, ProduceBothWays) {
.WillOnce(SetArgPointee<1>(kNewTextureId));
SetupUpdateTexParamExpectations(
kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT);
- Texture* new_texture = manager2_->ConsumeTexture(name);
+ TextureBase* new_texture = manager2_->ConsumeTexture(name);
EXPECT_EQ(kNewTextureId, new_texture->service_id());
// Clobber

Powered by Google App Engine
This is Rietveld 408576698