Chromium Code Reviews| Index: cc/resource_provider_unittest.cc |
| diff --git a/cc/resource_provider_unittest.cc b/cc/resource_provider_unittest.cc |
| index 9b22a0a7519be3336e70b46676538edd3b4cac79..2bf6f91f7d670d78cae24e809e681941efb07bab 100644 |
| --- a/cc/resource_provider_unittest.cc |
| +++ b/cc/resource_provider_unittest.cc |
| @@ -9,6 +9,7 @@ |
| #include "CCGraphicsContext.h" |
| #include "CCSingleThreadProxy.h" // For DebugScopedSetImplThread |
| #include "Extensions3DChromium.h" |
| +#include "cc/dcheck.h" |
| #include "cc/test/compositor_fake_web_graphics_context_3d.h" |
| #include "cc/test/fake_web_compositor_output_surface.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| @@ -60,9 +61,9 @@ public: |
| { |
| unsigned mailbox = 0; |
| memcpy(&mailbox, mailboxName, sizeof(mailbox)); |
| - ASSERT(mailbox && mailbox < m_nextMailBox); |
| + CC_DCHECK(mailbox && mailbox < m_nextMailBox); |
|
enne (OOO)
2012/10/16 18:34:22
This is in a unit test, so maybe ASSERT and ASSERT
danakj
2012/10/16 19:11:51
Done.
|
| m_textures.set(mailbox, texture); |
| - ASSERT(m_syncPointForMailbox.get(mailbox) < syncPoint); |
| + ASSERT_LT(m_syncPointForMailbox.get(mailbox), syncPoint); |
| m_syncPointForMailbox.set(mailbox, syncPoint); |
| } |
| @@ -70,7 +71,7 @@ public: |
| { |
| unsigned mailbox = 0; |
| memcpy(&mailbox, mailboxName, sizeof(mailbox)); |
| - ASSERT(mailbox && mailbox < m_nextMailBox); |
| + CC_DCHECK(mailbox && mailbox < m_nextMailBox); |
|
enne (OOO)
2012/10/16 18:34:22
Same here?
danakj
2012/10/16 19:11:51
This one has to be a dcheck because the function h
|
| // If the latest sync point the context has waited on is before the sync |
| // point for when the mailbox was set, pretend we never saw that |
| @@ -115,8 +116,8 @@ public: |
| virtual void bindTexture(WGC3Denum target, WebGLId texture) |
| { |
| - ASSERT(target == GraphicsContext3D::TEXTURE_2D); |
| - ASSERT(!texture || m_textures.find(texture) != m_textures.end()); |
| + ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); |
| + ASSERT_TRUE(!texture || m_textures.find(texture) != m_textures.end()); |
| m_currentTexture = texture; |
| } |
| @@ -130,7 +131,7 @@ public: |
| virtual void deleteTexture(WebGLId id) |
| { |
| TextureMap::iterator it = m_textures.find(id); |
| - ASSERT(it != m_textures.end()); |
| + ASSERT_NE(it, m_textures.end()); |
| m_textures.remove(it); |
| if (m_currentTexture == id) |
| m_currentTexture = 0; |
| @@ -139,9 +140,9 @@ public: |
| virtual void texStorage2DEXT(WGC3Denum target, WGC3Dint levels, WGC3Duint internalformat, |
| WGC3Dint width, WGC3Dint height) |
| { |
| - ASSERT(m_currentTexture); |
| - ASSERT(target == GraphicsContext3D::TEXTURE_2D); |
| - ASSERT(levels == 1); |
| + ASSERT_TRUE(m_currentTexture); |
| + ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); |
| + ASSERT_EQ(levels, 1); |
| WGC3Denum format = GraphicsContext3D::RGBA; |
| switch (internalformat) { |
| case Extensions3D::RGBA8_OES: |
| @@ -150,19 +151,19 @@ public: |
| format = Extensions3D::BGRA_EXT; |
| break; |
| default: |
| - ASSERT_NOT_REACHED(); |
| + NOTREACHED(); |
| } |
| allocateTexture(IntSize(width, height), format); |
| } |
| virtual void texImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format, WGC3Denum type, const void* pixels) |
| { |
| - ASSERT(m_currentTexture); |
| - ASSERT(target == GraphicsContext3D::TEXTURE_2D); |
| - ASSERT(!level); |
| - ASSERT(internalformat == format); |
| - ASSERT(!border); |
| - ASSERT(type == GraphicsContext3D::UNSIGNED_BYTE); |
| + ASSERT_TRUE(m_currentTexture); |
| + ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); |
| + ASSERT_FALSE(level); |
| + ASSERT_EQ(internalformat, format); |
| + ASSERT_FALSE(border); |
| + ASSERT_EQ(type, GraphicsContext3D::UNSIGNED_BYTE); |
| allocateTexture(IntSize(width, height), format); |
| if (pixels) |
| setPixels(0, 0, width, height, pixels); |
| @@ -170,21 +171,21 @@ public: |
| virtual void texSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, const void* pixels) |
| { |
| - ASSERT(m_currentTexture); |
| - ASSERT(target == GraphicsContext3D::TEXTURE_2D); |
| - ASSERT(!level); |
| - ASSERT(m_textures.get(m_currentTexture)); |
| - ASSERT(m_textures.get(m_currentTexture)->format == format); |
| - ASSERT(type == GraphicsContext3D::UNSIGNED_BYTE); |
| - ASSERT(pixels); |
| + ASSERT_TRUE(m_currentTexture); |
| + ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); |
| + ASSERT_FALSE(level); |
| + ASSERT_TRUE(m_textures.get(m_currentTexture)); |
| + ASSERT_EQ(m_textures.get(m_currentTexture)->format, format); |
| + ASSERT_EQ(type, GraphicsContext3D::UNSIGNED_BYTE); |
| + ASSERT_TRUE(pixels); |
| setPixels(xoffset, yoffset, width, height, pixels); |
| } |
| virtual void genMailboxCHROMIUM(WGC3Dbyte* mailbox) { return m_sharedData->genMailbox(mailbox); } |
| virtual void produceTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) |
| { |
| - ASSERT(m_currentTexture); |
| - ASSERT(target == GraphicsContext3D::TEXTURE_2D); |
| + ASSERT_TRUE(m_currentTexture); |
| + ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); |
| // Delay movind the texture into the mailbox until the next |
| // insertSyncPoint, so that it is not visible to other contexts that |
| @@ -198,18 +199,18 @@ public: |
| virtual void consumeTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) |
| { |
| - ASSERT(m_currentTexture); |
| - ASSERT(target == GraphicsContext3D::TEXTURE_2D); |
| + ASSERT_TRUE(m_currentTexture); |
| + ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); |
| m_textures.set(m_currentTexture, m_sharedData->consumeTexture(mailbox, m_lastWaitedSyncPoint)); |
| } |
| void getPixels(const IntSize& size, WGC3Denum format, uint8_t* pixels) |
| { |
| - ASSERT(m_currentTexture); |
| + ASSERT_TRUE(m_currentTexture); |
| Texture* texture = m_textures.get(m_currentTexture); |
| - ASSERT(texture); |
| - ASSERT(texture->size == size); |
| - ASSERT(texture->format == format); |
| + ASSERT_TRUE(texture); |
| + ASSERT_EQ(texture->size, size); |
| + ASSERT_EQ(texture->format, format); |
| memcpy(pixels, texture->data.get(), textureSize(size, format)); |
| } |
| @@ -229,18 +230,18 @@ protected: |
| private: |
| void allocateTexture(const IntSize& size, WGC3Denum format) |
| { |
| - ASSERT(m_currentTexture); |
| + ASSERT_TRUE(m_currentTexture); |
| m_textures.set(m_currentTexture, adoptPtr(new Texture(size, format))); |
| } |
| void setPixels(int xoffset, int yoffset, int width, int height, const void* pixels) |
| { |
| - ASSERT(m_currentTexture); |
| + ASSERT_TRUE(m_currentTexture); |
| Texture* texture = m_textures.get(m_currentTexture); |
| - ASSERT(texture); |
| - ASSERT(xoffset >= 0 && xoffset+width <= texture->size.width()); |
| - ASSERT(yoffset >= 0 && yoffset+height <= texture->size.height()); |
| - ASSERT(pixels); |
| + ASSERT_TRUE(texture); |
| + ASSERT_TRUE(xoffset >= 0 && xoffset+width <= texture->size.width()); |
| + ASSERT_TRUE(yoffset >= 0 && yoffset+height <= texture->size.height()); |
| + ASSERT_TRUE(pixels); |
| size_t inPitch = textureSize(IntSize(width, 1), texture->format); |
| size_t outPitch = textureSize(IntSize(texture->size.width(), 1), texture->format); |
| uint8_t* dest = texture->data.get() + yoffset * outPitch + textureSize(IntSize(xoffset, 1), texture->format); |