| Index: trunk/src/cc/resources/resource_provider_unittest.cc
|
| ===================================================================
|
| --- trunk/src/cc/resources/resource_provider_unittest.cc (revision 191412)
|
| +++ trunk/src/cc/resources/resource_provider_unittest.cc (working copy)
|
| @@ -139,7 +139,7 @@
|
| }
|
|
|
| virtual void bindTexture(WGC3Denum target, WebGLId texture) OVERRIDE {
|
| - ASSERT_EQ(static_cast<unsigned>(GL_TEXTURE_2D), target);
|
| + ASSERT_EQ(target, GL_TEXTURE_2D);
|
| ASSERT_TRUE(!texture || textures_.find(texture) != textures_.end());
|
| current_texture_ = texture;
|
| }
|
| @@ -164,8 +164,8 @@
|
| WGC3Dint width,
|
| WGC3Dint height) OVERRIDE {
|
| ASSERT_TRUE(current_texture_);
|
| - ASSERT_EQ(static_cast<unsigned>(GL_TEXTURE_2D), target);
|
| - ASSERT_EQ(1, levels);
|
| + ASSERT_EQ(target, GL_TEXTURE_2D);
|
| + ASSERT_EQ(levels, 1);
|
| WGC3Denum format = GL_RGBA;
|
| switch (internalformat) {
|
| case GL_RGBA8_OES:
|
| @@ -189,11 +189,11 @@
|
| WGC3Denum type,
|
| const void* pixels) OVERRIDE {
|
| ASSERT_TRUE(current_texture_);
|
| - ASSERT_EQ(static_cast<unsigned>(GL_TEXTURE_2D), target);
|
| + ASSERT_EQ(target, GL_TEXTURE_2D);
|
| ASSERT_FALSE(level);
|
| ASSERT_EQ(internalformat, format);
|
| ASSERT_FALSE(border);
|
| - ASSERT_EQ(static_cast<unsigned>(GL_UNSIGNED_BYTE), type);
|
| + ASSERT_EQ(type, GL_UNSIGNED_BYTE);
|
| AllocateTexture(gfx::Size(width, height), format);
|
| if (pixels)
|
| SetPixels(0, 0, width, height, pixels);
|
| @@ -209,11 +209,11 @@
|
| WGC3Denum type,
|
| const void* pixels) OVERRIDE {
|
| ASSERT_TRUE(current_texture_);
|
| - ASSERT_EQ(static_cast<unsigned>(GL_TEXTURE_2D), target);
|
| + ASSERT_EQ(target, GL_TEXTURE_2D);
|
| ASSERT_FALSE(level);
|
| ASSERT_TRUE(textures_.get(current_texture_));
|
| ASSERT_EQ(textures_.get(current_texture_)->format, format);
|
| - ASSERT_EQ(static_cast<unsigned>(GL_UNSIGNED_BYTE), type);
|
| + ASSERT_EQ(type, GL_UNSIGNED_BYTE);
|
| ASSERT_TRUE(pixels);
|
| SetPixels(xoffset, yoffset, width, height, pixels);
|
| }
|
| @@ -221,7 +221,7 @@
|
| virtual void texParameteri(WGC3Denum target, WGC3Denum param, WGC3Dint value)
|
| OVERRIDE {
|
| ASSERT_TRUE(current_texture_);
|
| - ASSERT_EQ(static_cast<unsigned>(GL_TEXTURE_2D), target);
|
| + ASSERT_EQ(target, GL_TEXTURE_2D);
|
| Texture* texture = textures_.get(current_texture_);
|
| ASSERT_TRUE(texture);
|
| if (param != GL_TEXTURE_MIN_FILTER)
|
| @@ -236,7 +236,7 @@
|
| virtual void produceTextureCHROMIUM(WGC3Denum target,
|
| const WGC3Dbyte* mailbox) OVERRIDE {
|
| ASSERT_TRUE(current_texture_);
|
| - ASSERT_EQ(static_cast<unsigned>(GL_TEXTURE_2D), target);
|
| + ASSERT_EQ(target, GL_TEXTURE_2D);
|
|
|
| // Delay moving the texture into the mailbox until the next
|
| // InsertSyncPoint, so that it is not visible to other contexts that
|
| @@ -251,7 +251,7 @@
|
| virtual void consumeTextureCHROMIUM(WGC3Denum target,
|
| const WGC3Dbyte* mailbox) OVERRIDE {
|
| ASSERT_TRUE(current_texture_);
|
| - ASSERT_EQ(static_cast<unsigned>(GL_TEXTURE_2D), target);
|
| + ASSERT_EQ(target, GL_TEXTURE_2D);
|
| textures_.set(
|
| current_texture_,
|
| shared_data_->ConsumeTexture(mailbox, last_waited_sync_point_));
|
| @@ -679,11 +679,9 @@
|
| uint8_t data[4] = { 1, 2, 3, 4 };
|
| gfx::Rect rect(size);
|
| child_resource_provider->SetPixels(id, data, rect, rect, gfx::Vector2d());
|
| - EXPECT_EQ(static_cast<unsigned>(GL_LINEAR),
|
| - GetResourceFilter(child_resource_provider.get(), id));
|
| + EXPECT_EQ(GL_LINEAR, GetResourceFilter(child_resource_provider.get(), id));
|
| SetResourceFilter(child_resource_provider.get(), id, GL_NEAREST);
|
| - EXPECT_EQ(static_cast<unsigned>(GL_NEAREST),
|
| - GetResourceFilter(child_resource_provider.get(), id));
|
| + EXPECT_EQ(GL_NEAREST, GetResourceFilter(child_resource_provider.get(), id));
|
|
|
| int child_id = resource_provider_->CreateChild();
|
| {
|
| @@ -694,18 +692,16 @@
|
| child_resource_provider->PrepareSendToParent(resource_ids_to_transfer,
|
| &list);
|
| ASSERT_EQ(1u, list.size());
|
| - EXPECT_EQ(static_cast<unsigned>(GL_NEAREST), list[0].filter);
|
| + EXPECT_EQ(GL_NEAREST, list[0].filter);
|
| resource_provider_->ReceiveFromChild(child_id, list);
|
| }
|
| ResourceProvider::ResourceIdMap resource_map =
|
| resource_provider_->GetChildToParentMap(child_id);
|
| ResourceProvider::ResourceId mapped_id = resource_map[id];
|
| EXPECT_NE(0u, mapped_id);
|
| - EXPECT_EQ(static_cast<unsigned>(GL_NEAREST),
|
| - GetResourceFilter(resource_provider_.get(), mapped_id));
|
| + EXPECT_EQ(GL_NEAREST, GetResourceFilter(resource_provider_.get(), mapped_id));
|
| SetResourceFilter(resource_provider_.get(), mapped_id, GL_LINEAR);
|
| - EXPECT_EQ(static_cast<unsigned>(GL_LINEAR),
|
| - GetResourceFilter(resource_provider_.get(), mapped_id));
|
| + EXPECT_EQ(GL_LINEAR, GetResourceFilter(resource_provider_.get(), mapped_id));
|
| {
|
| // Transfer resources back from the parent to the child.
|
| ResourceProvider::ResourceIdArray resource_ids_to_transfer;
|
| @@ -714,14 +710,12 @@
|
| resource_provider_->PrepareSendToChild(
|
| child_id, resource_ids_to_transfer, &list);
|
| ASSERT_EQ(1u, list.size());
|
| - EXPECT_EQ(static_cast<unsigned>(GL_LINEAR), list[0].filter);
|
| + EXPECT_EQ(GL_LINEAR, list[0].filter);
|
| child_resource_provider->ReceiveFromParent(list);
|
| }
|
| - EXPECT_EQ(static_cast<unsigned>(GL_LINEAR),
|
| - GetResourceFilter(child_resource_provider.get(), id));
|
| + EXPECT_EQ(GL_LINEAR, GetResourceFilter(child_resource_provider.get(), id));
|
| SetResourceFilter(child_resource_provider.get(), id, GL_NEAREST);
|
| - EXPECT_EQ(static_cast<unsigned>(GL_NEAREST),
|
| - GetResourceFilter(child_resource_provider.get(), id));
|
| + EXPECT_EQ(GL_NEAREST, GetResourceFilter(child_resource_provider.get(), id));
|
| }
|
|
|
| void ReleaseTextureMailbox(unsigned* release_sync_point, unsigned sync_point) {
|
| @@ -751,7 +745,7 @@
|
| ResourceProvider::ResourceId resource =
|
| resource_provider_->CreateResourceFromTextureMailbox(
|
| TextureMailbox(mailbox, callback, sync_point));
|
| - EXPECT_EQ(1, context()->texture_count());
|
| + EXPECT_EQ(1u, context()->texture_count());
|
| EXPECT_EQ(0u, release_sync_point);
|
| {
|
| // Transfer the resource, expect the sync points to be consistent.
|
| @@ -761,7 +755,7 @@
|
| resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list);
|
| ASSERT_EQ(1u, list.size());
|
| EXPECT_LE(sync_point, list[0].sync_point);
|
| - EXPECT_EQ(0,
|
| + EXPECT_EQ(0u,
|
| memcmp(mailbox.name, list[0].mailbox.name, sizeof(mailbox.name)));
|
| EXPECT_EQ(0u, release_sync_point);
|
|
|
| @@ -771,7 +765,7 @@
|
| context()->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
|
| uint8_t test_data[4] = { 0 };
|
| context()->GetPixels(gfx::Size(1, 1), GL_RGBA, test_data);
|
| - EXPECT_EQ(0, memcmp(data, test_data, sizeof(data)));
|
| + EXPECT_EQ(0u, memcmp(data, test_data, sizeof(data)));
|
| context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
|
| context()->deleteTexture(other_texture);
|
| list[0].sync_point = context()->insertSyncPoint();
|
| @@ -780,7 +774,7 @@
|
| // Receive the resource, then delete it, expect the sync points to be
|
| // consistent.
|
| resource_provider_->ReceiveFromParent(list);
|
| - EXPECT_EQ(1, context()->texture_count());
|
| + EXPECT_EQ(1u, context()->texture_count());
|
| EXPECT_EQ(0u, release_sync_point);
|
|
|
| resource_provider_->DeleteResource(resource);
|
| @@ -794,7 +788,7 @@
|
| release_sync_point = 0;
|
| resource = resource_provider_->CreateResourceFromTextureMailbox(
|
| TextureMailbox(mailbox, callback, sync_point));
|
| - EXPECT_EQ(1, context()->texture_count());
|
| + EXPECT_EQ(1u, context()->texture_count());
|
| EXPECT_EQ(0u, release_sync_point);
|
| {
|
| // Transfer the resource, expect the sync points to be consistent.
|
| @@ -804,7 +798,7 @@
|
| resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list);
|
| ASSERT_EQ(1u, list.size());
|
| EXPECT_LE(sync_point, list[0].sync_point);
|
| - EXPECT_EQ(0,
|
| + EXPECT_EQ(0u,
|
| memcmp(mailbox.name, list[0].mailbox.name, sizeof(mailbox.name)));
|
| EXPECT_EQ(0u, release_sync_point);
|
|
|
| @@ -814,7 +808,7 @@
|
| context()->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
|
| uint8_t test_data[4] = { 0 };
|
| context()->GetPixels(gfx::Size(1, 1), GL_RGBA, test_data);
|
| - EXPECT_EQ(0, memcmp(data, test_data, sizeof(data)));
|
| + EXPECT_EQ(0u, memcmp(data, test_data, sizeof(data)));
|
| context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
|
| context()->deleteTexture(other_texture);
|
| list[0].sync_point = context()->insertSyncPoint();
|
| @@ -822,7 +816,7 @@
|
|
|
| // Delete the resource, which shouldn't do anything.
|
| resource_provider_->DeleteResource(resource);
|
| - EXPECT_EQ(1, context()->texture_count());
|
| + EXPECT_EQ(1u, context()->texture_count());
|
| EXPECT_EQ(0u, release_sync_point);
|
|
|
| // Then receive the resource which should release the mailbox, expect the
|
| @@ -955,7 +949,6 @@
|
| GL_TEXTURE_POOL_MANAGED_CHROMIUM));
|
| ResourceProvider::ResourceId id = resource_provider->CreateManagedResource(
|
| size, format, ResourceProvider::TextureUsageAny);
|
| - EXPECT_NE(0u, id);
|
|
|
| Mock::VerifyAndClearExpectations(context);
|
| }
|
|
|
| Property changes on: trunk/src/cc/resources/resource_provider_unittest.cc
|
| ___________________________________________________________________
|
| Added: svn:mergeinfo
|
|
|
|
|