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

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

Issue 1001833005: Update from https://crrev.com/320343 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Supress Created 5 years, 9 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
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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 LayerTreeHostAnimationTestAnimationsGetDeleted() 189 LayerTreeHostAnimationTestAnimationsGetDeleted()
190 : started_animating_(false) {} 190 : started_animating_(false) {}
191 191
192 void BeginTest() override { 192 void BeginTest() override {
193 PostAddAnimationToMainThread(layer_tree_host()->root_layer()); 193 PostAddAnimationToMainThread(layer_tree_host()->root_layer());
194 } 194 }
195 195
196 void AnimateLayers(LayerTreeHostImpl* host_impl, 196 void AnimateLayers(LayerTreeHostImpl* host_impl,
197 base::TimeTicks monotonic_time) override { 197 base::TimeTicks monotonic_time) override {
198 bool have_animations = !host_impl->animation_registrar() 198 bool have_animations = !host_impl->animation_registrar()
199 ->active_animation_controllers() 199 ->active_animation_controllers_for_testing()
200 .empty(); 200 .empty();
201 if (!started_animating_ && have_animations) { 201 if (!started_animating_ && have_animations) {
202 started_animating_ = true; 202 started_animating_ = true;
203 return; 203 return;
204 } 204 }
205 205
206 if (started_animating_ && !have_animations) 206 if (started_animating_ && !have_animations)
207 EndTest(); 207 EndTest();
208 } 208 }
209 209
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 AddOpacityTransitionToLayer(content_.get(), 0.1, 5, 5, false); 1236 AddOpacityTransitionToLayer(content_.get(), 0.1, 5, 5, false);
1237 break; 1237 break;
1238 } 1238 }
1239 } 1239 }
1240 1240
1241 void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override { 1241 void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override {
1242 // After both animations have started, verify that they have valid 1242 // After both animations have started, verify that they have valid
1243 // start times. 1243 // start times.
1244 num_swap_buffers_++; 1244 num_swap_buffers_++;
1245 AnimationRegistrar::AnimationControllerMap controllers_copy = 1245 AnimationRegistrar::AnimationControllerMap controllers_copy =
1246 host_impl->animation_registrar()->active_animation_controllers(); 1246 host_impl->animation_registrar()
1247 ->active_animation_controllers_for_testing();
1247 if (controllers_copy.size() == 2u) { 1248 if (controllers_copy.size() == 2u) {
1248 EndTest(); 1249 EndTest();
1249 EXPECT_GE(num_swap_buffers_, 3); 1250 EXPECT_GE(num_swap_buffers_, 3);
1250 for (auto& it : controllers_copy) { 1251 for (auto& it : controllers_copy) {
1251 int id = it.first; 1252 int id = it.first;
1252 if (id == host_impl->RootLayer()->id()) { 1253 if (id == host_impl->RootLayer()->id()) {
1253 Animation* anim = it.second->GetAnimation(Animation::TRANSFORM); 1254 Animation* anim = it.second->GetAnimation(Animation::TRANSFORM);
1254 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); 1255 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0);
1255 } else if (id == host_impl->RootLayer()->children()[0]->id()) { 1256 } else if (id == host_impl->RootLayer()->children()[0]->id()) {
1256 Animation* anim = it.second->GetAnimation(Animation::OPACITY); 1257 Animation* anim = it.second->GetAnimation(Animation::OPACITY);
1257 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0); 1258 EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0);
1258 } 1259 }
1259 } 1260 }
1260 } 1261 }
1261 } 1262 }
1262 1263
1263 void AfterTest() override {} 1264 void AfterTest() override {}
1264 1265
1265 private: 1266 private:
1266 scoped_refptr<Layer> content_; 1267 scoped_refptr<Layer> content_;
1267 int num_swap_buffers_; 1268 int num_swap_buffers_;
1268 }; 1269 };
1269 1270
1270 SINGLE_AND_MULTI_THREAD_TEST_F( 1271 SINGLE_AND_MULTI_THREAD_TEST_F(
1271 LayerTreeHostAnimationTestAddAnimationAfterAnimating); 1272 LayerTreeHostAnimationTestAddAnimationAfterAnimating);
1272 1273
1273 } // namespace 1274 } // namespace
1274 } // namespace cc 1275 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_no_message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698