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

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 13975019: Merge 194269 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1479/src/
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
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_settings.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 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.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "cc/animation/timing_function.h" 10 #include "cc/animation/timing_function.h"
(...skipping 2192 matching lines...) Expand 10 before | Expand all | Expand 10 after
2203 2203
2204 virtual void AfterTest() OVERRIDE { 2204 virtual void AfterTest() OVERRIDE {
2205 } 2205 }
2206 2206
2207 FakeContentLayerClient client_; 2207 FakeContentLayerClient client_;
2208 }; 2208 };
2209 2209
2210 MULTI_THREAD_TEST_F( 2210 MULTI_THREAD_TEST_F(
2211 LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation); 2211 LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation);
2212 2212
2213 class LayerTreeHostTestChangeLayerPropertiesInPaintContents
2214 : public LayerTreeHostTest {
2215 public:
2216 class SetBoundsClient : public ContentLayerClient {
2217 public:
2218 SetBoundsClient() : layer_(0) {}
2219
2220 void set_layer(Layer* layer) { layer_ = layer; }
2221
2222 virtual void PaintContents(SkCanvas* canvas,
2223 gfx::Rect clip,
2224 gfx::RectF* opaque) OVERRIDE {
2225 layer_->SetBounds(gfx::Size(2, 2));
2226 }
2227
2228 virtual void DidChangeLayerCanUseLCDText() OVERRIDE {}
2229
2230 private:
2231 Layer* layer_;
2232 };
2233
2234 LayerTreeHostTestChangeLayerPropertiesInPaintContents() : num_commits_(0) {}
2235
2236 virtual void SetupTree() OVERRIDE {
2237 scoped_refptr<ContentLayer> root_layer = ContentLayer::Create(&client_);
2238 root_layer->SetIsDrawable(true);
2239 root_layer->SetBounds(gfx::Size(1, 1));
2240
2241 layer_tree_host()->SetRootLayer(root_layer);
2242 client_.set_layer(root_layer.get());
2243
2244 LayerTreeHostTest::SetupTree();
2245 }
2246
2247 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
2248 virtual void AfterTest() OVERRIDE {}
2249
2250 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
2251 num_commits_++;
2252 if (num_commits_ == 1) {
2253 LayerImpl* root_layer = host_impl->active_tree()->root_layer();
2254 EXPECT_SIZE_EQ(gfx::Size(1, 1), root_layer->bounds());
2255 } else {
2256 LayerImpl* root_layer = host_impl->active_tree()->root_layer();
2257 EXPECT_SIZE_EQ(gfx::Size(2, 2), root_layer->bounds());
2258 EndTest();
2259 }
2260 }
2261
2262 private:
2263 SetBoundsClient client_;
2264 int num_commits_;
2265 };
2266
2267 SINGLE_THREAD_TEST_F(LayerTreeHostTestChangeLayerPropertiesInPaintContents);
2268
2213 } // namespace 2269 } // namespace
2214 } // namespace cc 2270 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698