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

Unified Diff: cc/resource_provider_unittest.cc

Issue 11192030: cc: Switch to Chromium DCHECKs LOGs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebaseonenne Created 8 years, 2 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 | « cc/resource_provider.cc ('k') | cc/scheduler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resource_provider_unittest.cc
diff --git a/cc/resource_provider_unittest.cc b/cc/resource_provider_unittest.cc
index a72f45bb6502effffab208866b166a1586368145..5d387f725a273236d72ac44078cbe34767271648 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 "base/logging.h"
#include "cc/scoped_ptr_deque.h"
#include "cc/scoped_ptr_hash_map.h"
#include "cc/test/compositor_fake_web_graphics_context_3d.h"
@@ -60,9 +61,9 @@ public:
{
unsigned mailbox = 0;
memcpy(&mailbox, mailboxName, sizeof(mailbox));
- ASSERT(mailbox && mailbox < m_nextMailBox);
+ ASSERT_TRUE(mailbox && mailbox < m_nextMailBox);
m_textures.set(mailbox, texture.Pass());
- ASSERT(m_syncPointForMailbox[mailbox] < syncPoint);
+ ASSERT_LT(m_syncPointForMailbox[mailbox], syncPoint);
m_syncPointForMailbox[mailbox] = syncPoint;
}
@@ -70,7 +71,7 @@ public:
{
unsigned mailbox = 0;
memcpy(&mailbox, mailboxName, sizeof(mailbox));
- ASSERT(mailbox && mailbox < m_nextMailBox);
+ DCHECK(mailbox && mailbox < m_nextMailBox);
// 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_FALSE(it == m_textures.end());
m_textures.erase(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 moving 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, make_scoped_ptr(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);
« no previous file with comments | « cc/resource_provider.cc ('k') | cc/scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698