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

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

Issue 1996783002: Make cc::SurfaceId unguessable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Ben's comment Created 4 years, 7 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
« no previous file with comments | « cc/layers/surface_layer_unittest.cc ('k') | cc/quads/surface_draw_quad.cc » ('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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 CREATE_QUAD_3_ALL(StreamVideoDrawQuad, resource_id, resource_size_in_pixels, 500 CREATE_QUAD_3_ALL(StreamVideoDrawQuad, resource_id, resource_size_in_pixels,
501 matrix); 501 matrix);
502 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material); 502 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material);
503 EXPECT_EQ(resource_id, copy_quad->resource_id()); 503 EXPECT_EQ(resource_id, copy_quad->resource_id());
504 EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels()); 504 EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels());
505 EXPECT_EQ(matrix, copy_quad->matrix); 505 EXPECT_EQ(matrix, copy_quad->matrix);
506 } 506 }
507 507
508 TEST(DrawQuadTest, CopySurfaceDrawQuad) { 508 TEST(DrawQuadTest, CopySurfaceDrawQuad) {
509 gfx::Rect visible_rect(40, 50, 30, 20); 509 gfx::Rect visible_rect(40, 50, 30, 20);
510 SurfaceId surface_id(1234); 510 SurfaceId surface_id(0, 1234, 0);
511 CREATE_SHARED_STATE(); 511 CREATE_SHARED_STATE();
512 512
513 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id); 513 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id);
514 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material); 514 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material);
515 EXPECT_EQ(visible_rect, copy_quad->visible_rect); 515 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
516 EXPECT_EQ(surface_id, copy_quad->surface_id); 516 EXPECT_EQ(surface_id, copy_quad->surface_id);
517 517
518 CREATE_QUAD_1_ALL(SurfaceDrawQuad, surface_id); 518 CREATE_QUAD_1_ALL(SurfaceDrawQuad, surface_id);
519 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material); 519 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material);
520 EXPECT_EQ(surface_id, copy_quad->surface_id); 520 EXPECT_EQ(surface_id, copy_quad->surface_id);
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 CREATE_QUAD_5_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id, 789 CREATE_QUAD_5_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id,
790 resource_size_in_pixels, matrix); 790 resource_size_in_pixels, matrix);
791 EXPECT_EQ(resource_id, quad_new->resource_id()); 791 EXPECT_EQ(resource_id, quad_new->resource_id());
792 EXPECT_EQ(resource_size_in_pixels, quad_new->resource_size_in_pixels()); 792 EXPECT_EQ(resource_size_in_pixels, quad_new->resource_size_in_pixels());
793 EXPECT_EQ(1, IterateAndCount(quad_new)); 793 EXPECT_EQ(1, IterateAndCount(quad_new));
794 EXPECT_EQ(resource_id + 1, quad_new->resource_id()); 794 EXPECT_EQ(resource_id + 1, quad_new->resource_id());
795 } 795 }
796 796
797 TEST_F(DrawQuadIteratorTest, SurfaceDrawQuad) { 797 TEST_F(DrawQuadIteratorTest, SurfaceDrawQuad) {
798 gfx::Rect visible_rect(40, 50, 30, 20); 798 gfx::Rect visible_rect(40, 50, 30, 20);
799 SurfaceId surface_id(4321); 799 SurfaceId surface_id(0, 4321, 0);
800 800
801 CREATE_SHARED_STATE(); 801 CREATE_SHARED_STATE();
802 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id); 802 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id);
803 EXPECT_EQ(0, IterateAndCount(quad_new)); 803 EXPECT_EQ(0, IterateAndCount(quad_new));
804 } 804 }
805 805
806 TEST_F(DrawQuadIteratorTest, TextureDrawQuad) { 806 TEST_F(DrawQuadIteratorTest, TextureDrawQuad) {
807 gfx::Rect opaque_rect(33, 47, 10, 12); 807 gfx::Rect opaque_rect(33, 47, 10, 12);
808 gfx::Rect visible_rect(40, 50, 30, 20); 808 gfx::Rect visible_rect(40, 50, 30, 20);
809 unsigned resource_id = 82; 809 unsigned resource_id = 82;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); 974 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad);
975 break; 975 break;
976 case DrawQuad::INVALID: 976 case DrawQuad::INVALID:
977 break; 977 break;
978 } 978 }
979 } 979 }
980 } 980 }
981 981
982 } // namespace 982 } // namespace
983 } // namespace cc 983 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/surface_layer_unittest.cc ('k') | cc/quads/surface_draw_quad.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698