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

Side by Side Diff: cc/gl_renderer_unittest.cc

Issue 11192030: cc: Switch to Chromium DCHECKs LOGs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dcheck and ndebug 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "CCRendererGL.h" 6 #include "CCRendererGL.h"
7 7
8 #include "CCDrawQuad.h" 8 #include "CCDrawQuad.h"
9 #include "CCPrioritizedTextureManager.h" 9 #include "CCPrioritizedTextureManager.h"
10 #include "CCResourceProvider.h" 10 #include "CCResourceProvider.h"
(...skipping 25 matching lines...) Expand all
36 { 36 {
37 if (name == GraphicsContext3D::EXTENSIONS) 37 if (name == GraphicsContext3D::EXTENSIONS)
38 return WebString("GL_CHROMIUM_set_visibility GL_CHROMIUM_gpu_memory_ manager GL_CHROMIUM_discard_framebuffer"); 38 return WebString("GL_CHROMIUM_set_visibility GL_CHROMIUM_gpu_memory_ manager GL_CHROMIUM_discard_framebuffer");
39 return WebString(); 39 return WebString();
40 } 40 }
41 41
42 // Methods added for test. 42 // Methods added for test.
43 int frameCount() { return m_frame; } 43 int frameCount() { return m_frame; }
44 void setMemoryAllocation(WebGraphicsMemoryAllocation allocation) 44 void setMemoryAllocation(WebGraphicsMemoryAllocation allocation)
45 { 45 {
46 ASSERT(CCProxy::isImplThread()); 46 DCHECK(CCProxy::isImplThread());
47 // In single threaded mode we expect this callback on main thread. 47 // In single threaded mode we expect this callback on main thread.
48 DebugScopedSetMainThread main; 48 DebugScopedSetMainThread main;
49 m_memoryAllocationChangedCallback->onMemoryAllocationChanged(allocation) ; 49 m_memoryAllocationChangedCallback->onMemoryAllocationChanged(allocation) ;
50 } 50 }
51 51
52 private: 52 private:
53 int m_frame; 53 int m_frame;
54 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* m_memoryAllocationChange dCallback; 54 WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* m_memoryAllocationChange dCallback;
55 }; 55 };
56 56
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); 396 FakeCCRendererGL renderer(&mockClient, resourceProvider.get());
397 397
398 mockClient.rootRenderPass()->setHasTransparentBackground(false); 398 mockClient.rootRenderPass()->setHasTransparentBackground(false);
399 399
400 EXPECT_TRUE(renderer.initialize()); 400 EXPECT_TRUE(renderer.initialize());
401 401
402 renderer.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPa sses()); 402 renderer.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPa sses());
403 403
404 // On DEBUG builds, render passes with opaque background clear to blue to 404 // On DEBUG builds, render passes with opaque background clear to blue to
405 // easily see regions that were not drawn on the screen. 405 // easily see regions that were not drawn on the screen.
406 #if defined(NDEBUG) 406 #ifdef NDEBUG
407 EXPECT_EQ(0, context->clearCount()); 407 EXPECT_EQ(0, context->clearCount());
408 #else 408 #else
409 EXPECT_EQ(1, context->clearCount()); 409 EXPECT_EQ(1, context->clearCount());
410 #endif 410 #endif
411 } 411 }
412 412
413 TEST(CCRendererGLTest2, transparentBackground) 413 TEST(CCRendererGLTest2, transparentBackground)
414 { 414 {
415 FakeCCRendererClient mockClient; 415 FakeCCRendererClient mockClient;
416 scoped_ptr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::crea te(adoptPtr(new ClearCountingContext))); 416 scoped_ptr<CCGraphicsContext> ccContext(FakeWebCompositorOutputSurface::crea te(adoptPtr(new ClearCountingContext)));
417 ClearCountingContext* context = static_cast<ClearCountingContext*>(ccContext ->context3D()); 417 ClearCountingContext* context = static_cast<ClearCountingContext*>(ccContext ->context3D());
418 scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(c cContext.get())); 418 scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(c cContext.get()));
419 FakeCCRendererGL renderer(&mockClient, resourceProvider.get()); 419 FakeCCRendererGL renderer(&mockClient, resourceProvider.get());
420 420
421 mockClient.rootRenderPass()->setHasTransparentBackground(true); 421 mockClient.rootRenderPass()->setHasTransparentBackground(true);
422 422
423 EXPECT_TRUE(renderer.initialize()); 423 EXPECT_TRUE(renderer.initialize());
424 424
425 renderer.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPa sses()); 425 renderer.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPa sses());
426 426
427 EXPECT_EQ(1, context->clearCount()); 427 EXPECT_EQ(1, context->clearCount());
428 } 428 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698