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

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

Issue 254883004: Revert 266624 "cc: Split animating and drawing into separate act..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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 | Annotate | Revision Log
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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "cc/animation/animation_curve.h" 7 #include "cc/animation/animation_curve.h"
8 #include "cc/animation/layer_animation_controller.h" 8 #include "cc/animation/layer_animation_controller.h"
9 #include "cc/animation/scroll_offset_animation_curve.h" 9 #include "cc/animation/scroll_offset_animation_curve.h"
10 #include "cc/animation/timing_function.h" 10 #include "cc/animation/timing_function.h"
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 bool started_animating_; 1237 bool started_animating_;
1238 int num_commits_; 1238 int num_commits_;
1239 int num_draw_attempts_; 1239 int num_draw_attempts_;
1240 base::TimeTicks last_main_thread_tick_time_; 1240 base::TimeTicks last_main_thread_tick_time_;
1241 base::TimeTicks expected_impl_tick_time_; 1241 base::TimeTicks expected_impl_tick_time_;
1242 }; 1242 };
1243 1243
1244 // Only the non-impl-paint multi-threaded compositor freezes animations. 1244 // Only the non-impl-paint multi-threaded compositor freezes animations.
1245 MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostAnimationTestFrozenAnimationTickTime); 1245 MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostAnimationTestFrozenAnimationTickTime);
1246 1246
1247 class LayerTreeHostAnimationTestAddAnimationAfterAnimating
1248 : public LayerTreeHostAnimationTest {
1249 public:
1250 LayerTreeHostAnimationTestAddAnimationAfterAnimating()
1251 : num_swap_buffers_(0) {}
1252
1253 virtual void SetupTree() OVERRIDE {
1254 LayerTreeHostAnimationTest::SetupTree();
1255 content_ = Layer::Create();
1256 content_->SetBounds(gfx::Size(4, 4));
1257 layer_tree_host()->root_layer()->AddChild(content_);
1258 }
1259
1260 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
1261
1262 virtual void DidCommit() OVERRIDE {
1263 switch (layer_tree_host()->source_frame_number()) {
1264 case 1:
1265 // First frame: add an animation to the root layer.
1266 AddAnimatedTransformToLayer(layer_tree_host()->root_layer(), 0.1, 5, 5);
1267 break;
1268 case 2:
1269 // Second frame: add an animation to the content layer. The root layer
1270 // animation has caused us to animate already during this frame.
1271 AddOpacityTransitionToLayer(content_.get(), 0.1, 5, 5, false);
1272 break;
1273 }
1274 }
1275
1276 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl,
1277 bool result) OVERRIDE {
1278 // The third frame is when both animations have started. Check that both
1279 // have a valid start time.
1280 if (++num_swap_buffers_ == 3) {
1281 EndTest();
1282 AnimationRegistrar::AnimationControllerMap copy =
1283 host_impl->animation_registrar()->active_animation_controllers();
1284 EXPECT_EQ(2u, copy.size());
1285 for (AnimationRegistrar::AnimationControllerMap::iterator iter =
1286 copy.begin();
1287 iter != copy.end();
1288 ++iter) {
1289 int id = ((*iter).second->id());
1290 if (id == host_impl->RootLayer()->id()) {
1291 Animation* anim = (*iter).second->GetAnimation(Animation::Transform);
1292 EXPECT_GT(anim->start_time(), 0);
1293 } else if (id == host_impl->RootLayer()->children()[0]->id()) {
1294 Animation* anim = (*iter).second->GetAnimation(Animation::Opacity);
1295 EXPECT_GT(anim->start_time(), 0);
1296 }
1297 }
1298 }
1299 }
1300
1301 virtual void AfterTest() OVERRIDE {}
1302
1303 private:
1304 scoped_refptr<Layer> content_;
1305 int num_swap_buffers_;
1306 };
1307
1308 SINGLE_AND_MULTI_THREAD_TEST_F(
1309 LayerTreeHostAnimationTestAddAnimationAfterAnimating);
1310
1311 } // namespace 1247 } // namespace
1312 } // namespace cc 1248 } // namespace cc
OLDNEW
« no previous file with comments | « trunk/src/cc/trees/layer_tree_host_impl_unittest.cc ('k') | trunk/src/cc/trees/single_thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698