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

Side by Side Diff: trunk/src/cc/trees/layer_tree_host_impl_unittest.cc

Issue 13316003: Revert 191364 "cc: Add ‘chromium_code’: 1 to cc.gyp and cc_t..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 gfx::Transform expected_scale; 1572 gfx::Transform expected_scale;
1573 expected_scale.Scale(page_scale, page_scale); 1573 expected_scale.Scale(page_scale, page_scale);
1574 EXPECT_EQ(expected_scale, 1574 EXPECT_EQ(expected_scale,
1575 host_impl_->active_tree()->root_layer()->impl_transform()); 1575 host_impl_->active_tree()->root_layer()->impl_transform());
1576 } 1576 }
1577 1577
1578 TEST_F(LayerTreeHostImplTest, PageScaleDeltaAppliedToRootScrollLayerOnly) { 1578 TEST_F(LayerTreeHostImplTest, PageScaleDeltaAppliedToRootScrollLayerOnly) {
1579 gfx::Size surface_size(10, 10); 1579 gfx::Size surface_size(10, 10);
1580 float default_page_scale = 1.f; 1580 float default_page_scale = 1.f;
1581 gfx::Transform default_page_scale_matrix; 1581 gfx::Transform default_page_scale_matrix;
1582 default_page_scale_matrix.Scale(default_page_scale, default_page_scale);
1583 1582
1584 float new_page_scale = 2.f; 1583 float new_page_scale = 2.f;
1585 gfx::Transform new_page_scale_matrix; 1584 gfx::Transform new_page_scale_matrix;
1586 new_page_scale_matrix.Scale(new_page_scale, new_page_scale); 1585 new_page_scale_matrix.Scale(new_page_scale, new_page_scale);
1587 1586
1588 // Create a normal scrollable root layer and another scrollable child layer. 1587 // Create a normal scrollable root layer and another scrollable child layer.
1589 SetupScrollAndContentsLayers(surface_size); 1588 SetupScrollAndContentsLayers(surface_size);
1590 LayerImpl* root = host_impl_->active_tree()->root_layer(); 1589 LayerImpl* root = host_impl_->active_tree()->root_layer();
1591 LayerImpl* child = root->children()[0]; 1590 LayerImpl* child = root->children()[0];
1592 1591
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after
2971 return WebKit::WebString(); 2970 return WebKit::WebString();
2972 } 2971 }
2973 2972
2974 unsigned num_textures() const { return num_textures_; } 2973 unsigned num_textures() const { return num_textures_; }
2975 2974
2976 private: 2975 private:
2977 base::hash_map<WebKit::WebGLId, bool> textures_; 2976 base::hash_map<WebKit::WebGLId, bool> textures_;
2978 unsigned num_textures_; 2977 unsigned num_textures_;
2979 }; 2978 };
2980 2979
2980 static unsigned CreateResourceId(ResourceProvider* resource_provider) {
2981 return resource_provider->CreateResource(
2982 gfx::Size(20, 12),
2983 resource_provider->best_texture_format(),
2984 ResourceProvider::TextureUsageAny);
2985 }
2986
2987 static unsigned CreateTextureId(ResourceProvider* resource_provider) {
2988 return ResourceProvider::ScopedReadLockGL(
2989 resource_provider, CreateResourceId(resource_provider)).texture_id();
2990 }
2991
2981 TEST_F(LayerTreeHostImplTest, LayersFreeTextures) { 2992 TEST_F(LayerTreeHostImplTest, LayersFreeTextures) {
2982 scoped_ptr<TestWebGraphicsContext3D> context = 2993 scoped_ptr<TestWebGraphicsContext3D> context =
2983 TestWebGraphicsContext3D::Create(); 2994 TestWebGraphicsContext3D::Create();
2984 TestWebGraphicsContext3D* context3d = context.get(); 2995 TestWebGraphicsContext3D* context3d = context.get();
2985 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d( 2996 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(
2986 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); 2997 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>();
2987 host_impl_->InitializeRenderer(output_surface.Pass()); 2998 host_impl_->InitializeRenderer(output_surface.Pass());
2988 2999
2989 scoped_ptr<LayerImpl> root_layer = 3000 scoped_ptr<LayerImpl> root_layer =
2990 LayerImpl::Create(host_impl_->active_tree(), 1); 3001 LayerImpl::Create(host_impl_->active_tree(), 1);
(...skipping 1986 matching lines...) Expand 10 before | Expand all | Expand 10 after
4977 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), 4988 EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(),
4978 render_pass_quad->mask_uv_rect.ToString()); 4989 render_pass_quad->mask_uv_rect.ToString());
4979 4990
4980 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); 4991 host_impl_->DrawLayers(&frame, base::TimeTicks::Now());
4981 host_impl_->DidDrawAllLayers(frame); 4992 host_impl_->DidDrawAllLayers(frame);
4982 } 4993 }
4983 } 4994 }
4984 4995
4985 } // namespace 4996 } // namespace
4986 } // namespace cc 4997 } // namespace cc
OLDNEW
« no previous file with comments | « trunk/src/cc/trees/layer_tree_host_impl.cc ('k') | trunk/src/cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698