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

Unified Diff: cc/layers/tiled_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/tiled_layer_impl.cc ('k') | cc/layers/ui_resource_layer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/tiled_layer_impl_unittest.cc
diff --git a/cc/layers/tiled_layer_impl_unittest.cc b/cc/layers/tiled_layer_impl_unittest.cc
index 7a47887c282e8abc8da3957fd489d34ebf54d040..f3f772159a40748ec712e96f3a3603ef0ea9e530 100644
--- a/cc/layers/tiled_layer_impl_unittest.cc
+++ b/cc/layers/tiled_layer_impl_unittest.cc
@@ -9,6 +9,7 @@
#include "cc/resources/layer_tiling_data.h"
#include "cc/test/fake_impl_proxy.h"
#include "cc/test/fake_layer_tree_host_impl.h"
+#include "cc/test/fake_output_surface.h"
#include "cc/test/layer_test_common.h"
#include "cc/test/test_task_graph_runner.h"
#include "cc/trees/single_thread_proxy.h"
@@ -21,7 +22,9 @@ namespace {
class TiledLayerImplTest : public testing::Test {
public:
TiledLayerImplTest()
- : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_) {}
+ : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_) {
+ host_impl_.InitializeRenderer(FakeOutputSurface::Create3d());
+ }
scoped_ptr<TiledLayerImpl> CreateLayerNoTiles(
const gfx::Size& tile_size,
@@ -53,10 +56,14 @@ class TiledLayerImplTest : public testing::Test {
scoped_ptr<TiledLayerImpl> layer =
CreateLayerNoTiles(tile_size, layer_size, border_texels);
- ResourceProvider::ResourceId resource_id = 1;
for (int i = 0; i < layer->TilingForTesting()->num_tiles_x(); ++i) {
- for (int j = 0; j < layer->TilingForTesting()->num_tiles_y(); ++j)
- layer->PushTileProperties(i, j, resource_id++, false);
+ for (int j = 0; j < layer->TilingForTesting()->num_tiles_y(); ++j) {
+ ResourceProvider::ResourceId resource_id =
+ host_impl_.resource_provider()->CreateResource(
+ gfx::Size(1, 1), GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888);
+ layer->PushTileProperties(i, j, resource_id, false);
+ }
}
return layer.Pass();
@@ -333,10 +340,14 @@ TEST_F(TiledLayerImplTest, Occlusion) {
tiler->SetTilingSize(layer_bounds);
tiled_layer->SetTilingData(*tiler);
- ResourceProvider::ResourceId resource_id = 1;
for (int i = 0; i < tiled_layer->TilingForTesting()->num_tiles_x(); ++i) {
- for (int j = 0; j < tiled_layer->TilingForTesting()->num_tiles_y(); ++j)
- tiled_layer->PushTileProperties(i, j, resource_id++, false);
+ for (int j = 0; j < tiled_layer->TilingForTesting()->num_tiles_y(); ++j) {
+ ResourceProvider::ResourceId resource_id =
+ impl.resource_provider()->CreateResource(
+ gfx::Size(1, 1), GL_CLAMP_TO_EDGE,
+ ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888);
+ tiled_layer->PushTileProperties(i, j, resource_id, false);
+ }
}
impl.CalcDrawProps(viewport_size);
« no previous file with comments | « cc/layers/tiled_layer_impl.cc ('k') | cc/layers/ui_resource_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698