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

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: Address piman's comments 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
« no previous file with comments | « gpu/command_buffer/service/mailbox_manager_sync.cc ('k') | gpu/command_buffer/service/texture_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a19358832d6d7dff08564dc5439aa0f876f7757a 100644
--- a/gpu/command_buffer/service/mailbox_manager_unittest.cc
+++ b/gpu/command_buffer/service/mailbox_manager_unittest.cc
@@ -80,9 +80,7 @@ class MailboxManagerTest : public GpuServiceTest {
return texture->SetParameteri(feature_info_.get(), pname, param);
}
- void DestroyTexture(Texture* texture) {
- delete texture;
- }
+ void DestroyTexture(TextureBase* texture) { delete texture; }
scoped_refptr<MailboxManager> manager_;
@@ -331,8 +329,8 @@ 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);
+ Texture* new_texture = static_cast<Texture*>(manager2_->ConsumeTexture(name));
+ EXPECT_NE(nullptr, new_texture);
EXPECT_NE(texture, new_texture);
EXPECT_EQ(kNewTextureId, new_texture->service_id());
@@ -388,8 +386,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 +469,8 @@ 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);
+ Texture* new_texture = static_cast<Texture*>(manager2_->ConsumeTexture(name));
+ EXPECT_NE(nullptr, new_texture);
EXPECT_NE(texture, new_texture);
EXPECT_EQ(kNewTextureId, new_texture->service_id());
@@ -505,7 +503,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 +534,8 @@ 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);
+ Texture* new_texture = static_cast<Texture*>(manager2_->ConsumeTexture(name));
+ EXPECT_NE(nullptr, new_texture);
EXPECT_NE(texture, new_texture);
EXPECT_EQ(kNewTextureId, new_texture->service_id());
EXPECT_TRUE(texture->SafeToRenderFrom());
@@ -584,8 +582,8 @@ 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);
+ Texture* new_texture = static_cast<Texture*>(manager2_->ConsumeTexture(name));
+ EXPECT_NE(nullptr, new_texture);
EXPECT_NE(texture, new_texture);
EXPECT_EQ(kNewTextureId, new_texture->service_id());
EXPECT_FALSE(new_texture->IsDefined());
@@ -632,7 +630,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 +668,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
« no previous file with comments | « gpu/command_buffer/service/mailbox_manager_sync.cc ('k') | gpu/command_buffer/service/texture_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698