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

Side by Side Diff: cc/layers/nine_patch_layer_impl_unittest.cc

Issue 1062043003: cc: Add ResourceId validation checks at the time of AppendQuads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resource-validate: fixtests Created 5 years, 8 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/nine_patch_layer_impl.cc ('k') | cc/layers/painted_scrollbar_layer_impl.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 "base/containers/hash_tables.h" 5 #include "base/containers/hash_tables.h"
6 #include "cc/layers/append_quads_data.h" 6 #include "cc/layers/append_quads_data.h"
7 #include "cc/layers/nine_patch_layer_impl.h" 7 #include "cc/layers/nine_patch_layer_impl.h"
8 #include "cc/quads/texture_draw_quad.h" 8 #include "cc/quads/texture_draw_quad.h"
9 #include "cc/resources/ui_resource_bitmap.h" 9 #include "cc/resources/ui_resource_bitmap.h"
10 #include "cc/resources/ui_resource_client.h" 10 #include "cc/resources/ui_resource_client.h"
11 #include "cc/test/fake_impl_proxy.h" 11 #include "cc/test/fake_impl_proxy.h"
12 #include "cc/test/fake_output_surface.h"
12 #include "cc/test/fake_ui_resource_layer_tree_host_impl.h" 13 #include "cc/test/fake_ui_resource_layer_tree_host_impl.h"
13 #include "cc/test/geometry_test_utils.h" 14 #include "cc/test/geometry_test_utils.h"
14 #include "cc/test/layer_test_common.h" 15 #include "cc/test/layer_test_common.h"
15 #include "cc/trees/single_thread_proxy.h" 16 #include "cc/trees/single_thread_proxy.h"
16 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "ui/gfx/geometry/rect_conversions.h" 19 #include "ui/gfx/geometry/rect_conversions.h"
19 #include "ui/gfx/geometry/safe_integer_conversions.h" 20 #include "ui/gfx/geometry/safe_integer_conversions.h"
20 #include "ui/gfx/transform.h" 21 #include "ui/gfx/transform.h"
21 22
(...skipping 16 matching lines...) Expand all
38 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 39 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
39 gfx::Rect visible_content_rect(layer_size); 40 gfx::Rect visible_content_rect(layer_size);
40 gfx::Rect expected_remaining(border.x(), 41 gfx::Rect expected_remaining(border.x(),
41 border.y(), 42 border.y(),
42 layer_size.width() - border.width(), 43 layer_size.width() - border.width(),
43 layer_size.height() - border.height()); 44 layer_size.height() - border.height());
44 45
45 FakeImplProxy proxy; 46 FakeImplProxy proxy;
46 TestSharedBitmapManager shared_bitmap_manager; 47 TestSharedBitmapManager shared_bitmap_manager;
47 FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 48 FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
49 host_impl.InitializeRenderer(FakeOutputSurface::Create3d());
50
48 scoped_ptr<NinePatchLayerImpl> layer = 51 scoped_ptr<NinePatchLayerImpl> layer =
49 NinePatchLayerImpl::Create(host_impl.active_tree(), 1); 52 NinePatchLayerImpl::Create(host_impl.active_tree(), 1);
50 layer->draw_properties().visible_content_rect = visible_content_rect; 53 layer->draw_properties().visible_content_rect = visible_content_rect;
51 layer->SetBounds(layer_size); 54 layer->SetBounds(layer_size);
52 layer->SetContentBounds(layer_size); 55 layer->SetContentBounds(layer_size);
53 layer->SetHasRenderSurface(true); 56 layer->SetHasRenderSurface(true);
54 layer->draw_properties().render_target = layer.get(); 57 layer->draw_properties().render_target = layer.get();
55 58
56 UIResourceId uid = 1; 59 UIResourceId uid = 1;
57 bool is_opaque = false; 60 bool is_opaque = false;
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 334
332 const QuadList &quad_list = impl.quad_list(); 335 const QuadList &quad_list = impl.quad_list();
333 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); 336 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin();
334 it != quad_list.BackToFrontEnd(); ++it) 337 it != quad_list.BackToFrontEnd(); ++it)
335 EXPECT_TRUE(it->ShouldDrawWithBlending()); 338 EXPECT_TRUE(it->ShouldDrawWithBlending());
336 } 339 }
337 } 340 }
338 341
339 } // namespace 342 } // namespace
340 } // namespace cc 343 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/nine_patch_layer_impl.cc ('k') | cc/layers/painted_scrollbar_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698