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

Side by Side Diff: cc/quads/draw_quad_unittest.cc

Issue 331533002: Use a struct for cc::Surface ids for more type safety (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add is_null and explicit ctor Created 6 years, 6 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
« no previous file with comments | « cc/layers/surface_layer_impl_unittest.cc ('k') | cc/quads/surface_draw_quad.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "cc/quads/draw_quad.h" 5 #include "cc/quads/draw_quad.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 EXPECT_EQ(matrix, copy_quad->matrix); 483 EXPECT_EQ(matrix, copy_quad->matrix);
484 484
485 CREATE_QUAD_2_ALL(StreamVideoDrawQuad, resource_id, matrix); 485 CREATE_QUAD_2_ALL(StreamVideoDrawQuad, resource_id, matrix);
486 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material); 486 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material);
487 EXPECT_EQ(resource_id, copy_quad->resource_id); 487 EXPECT_EQ(resource_id, copy_quad->resource_id);
488 EXPECT_EQ(matrix, copy_quad->matrix); 488 EXPECT_EQ(matrix, copy_quad->matrix);
489 } 489 }
490 490
491 TEST(DrawQuadTest, CopySurfaceDrawQuad) { 491 TEST(DrawQuadTest, CopySurfaceDrawQuad) {
492 gfx::Rect visible_rect(40, 50, 30, 20); 492 gfx::Rect visible_rect(40, 50, 30, 20);
493 int surface_id = 1234; 493 SurfaceId surface_id(1234);
494 CREATE_SHARED_STATE(); 494 CREATE_SHARED_STATE();
495 495
496 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id); 496 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id);
497 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material); 497 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material);
498 EXPECT_RECT_EQ(visible_rect, copy_quad->visible_rect); 498 EXPECT_RECT_EQ(visible_rect, copy_quad->visible_rect);
499 EXPECT_EQ(surface_id, copy_quad->surface_id); 499 EXPECT_EQ(surface_id, copy_quad->surface_id);
500 500
501 CREATE_QUAD_1_ALL(SurfaceDrawQuad, surface_id); 501 CREATE_QUAD_1_ALL(SurfaceDrawQuad, surface_id);
502 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material); 502 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material);
503 EXPECT_EQ(surface_id, copy_quad->surface_id); 503 EXPECT_EQ(surface_id, copy_quad->surface_id);
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 CREATE_SHARED_STATE(); 791 CREATE_SHARED_STATE();
792 CREATE_QUAD_4_NEW( 792 CREATE_QUAD_4_NEW(
793 StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id, matrix); 793 StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id, matrix);
794 EXPECT_EQ(resource_id, quad_new->resource_id); 794 EXPECT_EQ(resource_id, quad_new->resource_id);
795 EXPECT_EQ(1, IterateAndCount(quad_new.get())); 795 EXPECT_EQ(1, IterateAndCount(quad_new.get()));
796 EXPECT_EQ(resource_id + 1, quad_new->resource_id); 796 EXPECT_EQ(resource_id + 1, quad_new->resource_id);
797 } 797 }
798 798
799 TEST_F(DrawQuadIteratorTest, SurfaceDrawQuad) { 799 TEST_F(DrawQuadIteratorTest, SurfaceDrawQuad) {
800 gfx::Rect visible_rect(40, 50, 30, 20); 800 gfx::Rect visible_rect(40, 50, 30, 20);
801 int surface_id = 4321; 801 SurfaceId surface_id(4321);
802 802
803 CREATE_SHARED_STATE(); 803 CREATE_SHARED_STATE();
804 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id); 804 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id);
805 EXPECT_EQ(0, IterateAndCount(quad_new.get())); 805 EXPECT_EQ(0, IterateAndCount(quad_new.get()));
806 } 806 }
807 807
808 TEST_F(DrawQuadIteratorTest, TextureDrawQuad) { 808 TEST_F(DrawQuadIteratorTest, TextureDrawQuad) {
809 gfx::Rect opaque_rect(33, 47, 10, 12); 809 gfx::Rect opaque_rect(33, 47, 10, 12);
810 gfx::Rect visible_rect(40, 50, 30, 20); 810 gfx::Rect visible_rect(40, 50, 30, 20);
811 unsigned resource_id = 82; 811 unsigned resource_id = 82;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 texture_size, 904 texture_size,
905 texture_format, 905 texture_format,
906 content_rect, 906 content_rect,
907 contents_scale, 907 contents_scale,
908 picture_pile); 908 picture_pile);
909 EXPECT_EQ(0, IterateAndCount(quad_new.get())); 909 EXPECT_EQ(0, IterateAndCount(quad_new.get()));
910 } 910 }
911 911
912 } // namespace 912 } // namespace
913 } // namespace cc 913 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/surface_layer_impl_unittest.cc ('k') | cc/quads/surface_draw_quad.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698