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

Side by Side Diff: ui/compositor/layer_unittest.cc

Issue 12609006: ui::Layer::SwitchToLayer should finish animations on its old cc::Layer (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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
« no previous file with comments | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 #define MAYBE_HierarchyNoTexture DISABLED_HierarchyNoTexture 319 #define MAYBE_HierarchyNoTexture DISABLED_HierarchyNoTexture
320 #define MAYBE_DrawPixels DISABLED_DrawPixels 320 #define MAYBE_DrawPixels DISABLED_DrawPixels
321 #define MAYBE_SetRootLayer DISABLED_SetRootLayer 321 #define MAYBE_SetRootLayer DISABLED_SetRootLayer
322 #define MAYBE_CompositorObservers DISABLED_CompositorObservers 322 #define MAYBE_CompositorObservers DISABLED_CompositorObservers
323 #define MAYBE_ModifyHierarchy DISABLED_ModifyHierarchy 323 #define MAYBE_ModifyHierarchy DISABLED_ModifyHierarchy
324 #define MAYBE_Opacity DISABLED_Opacity 324 #define MAYBE_Opacity DISABLED_Opacity
325 #define MAYBE_ScaleUpDown DISABLED_ScaleUpDown 325 #define MAYBE_ScaleUpDown DISABLED_ScaleUpDown
326 #define MAYBE_ScaleReparent DISABLED_ScaleReparent 326 #define MAYBE_ScaleReparent DISABLED_ScaleReparent
327 #define MAYBE_NoScaleCanvas DISABLED_NoScaleCanvas 327 #define MAYBE_NoScaleCanvas DISABLED_NoScaleCanvas
328 #define MAYBE_AddRemoveThreadedAnimations DISABLED_AddRemoveThreadedAnimations 328 #define MAYBE_AddRemoveThreadedAnimations DISABLED_AddRemoveThreadedAnimations
329 #define MAYBE_SwitchCCLayerAnimations DISABLED_SwitchCCLayerAnimations
329 #else 330 #else
330 #define MAYBE_Delegate Delegate 331 #define MAYBE_Delegate Delegate
331 #define MAYBE_Draw Draw 332 #define MAYBE_Draw Draw
332 #define MAYBE_DrawTree DrawTree 333 #define MAYBE_DrawTree DrawTree
333 #define MAYBE_Hierarchy Hierarchy 334 #define MAYBE_Hierarchy Hierarchy
334 #define MAYBE_HierarchyNoTexture HierarchyNoTexture 335 #define MAYBE_HierarchyNoTexture HierarchyNoTexture
335 #define MAYBE_DrawPixels DrawPixels 336 #define MAYBE_DrawPixels DrawPixels
336 #define MAYBE_SetRootLayer SetRootLayer 337 #define MAYBE_SetRootLayer SetRootLayer
337 #define MAYBE_CompositorObservers CompositorObservers 338 #define MAYBE_CompositorObservers CompositorObservers
338 #define MAYBE_ModifyHierarchy ModifyHierarchy 339 #define MAYBE_ModifyHierarchy ModifyHierarchy
339 #define MAYBE_Opacity Opacity 340 #define MAYBE_Opacity Opacity
340 #define MAYBE_ScaleUpDown ScaleUpDown 341 #define MAYBE_ScaleUpDown ScaleUpDown
341 #define MAYBE_ScaleReparent ScaleReparent 342 #define MAYBE_ScaleReparent ScaleReparent
342 #define MAYBE_NoScaleCanvas NoScaleCanvas 343 #define MAYBE_NoScaleCanvas NoScaleCanvas
343 #define MAYBE_AddRemoveThreadedAnimations AddRemoveThreadedAnimations 344 #define MAYBE_AddRemoveThreadedAnimations AddRemoveThreadedAnimations
345 #define MAYBE_SwitchCCLayerAnimations SwitchCCLayerAnimations
344 #endif 346 #endif
345 347
346 TEST_F(LayerWithRealCompositorTest, MAYBE_Draw) { 348 TEST_F(LayerWithRealCompositorTest, MAYBE_Draw) {
347 scoped_ptr<Layer> layer(CreateColorLayer(SK_ColorRED, 349 scoped_ptr<Layer> layer(CreateColorLayer(SK_ColorRED,
348 gfx::Rect(20, 20, 50, 50))); 350 gfx::Rect(20, 20, 50, 50)));
349 DrawTree(layer.get()); 351 DrawTree(layer.get());
350 } 352 }
351 353
352 // Create this hierarchy: 354 // Create this hierarchy:
353 // L1 - red 355 // L1 - red
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 1353
1352 // Ensure that adding a layer to an existing tree causes its pending 1354 // Ensure that adding a layer to an existing tree causes its pending
1353 // animations to get dispatched. 1355 // animations to get dispatched.
1354 l2->SetOpacity(0.5f); 1356 l2->SetOpacity(0.5f);
1355 EXPECT_TRUE(l2->HasPendingThreadedAnimations()); 1357 EXPECT_TRUE(l2->HasPendingThreadedAnimations());
1356 1358
1357 l1->Add(l2.get()); 1359 l1->Add(l2.get());
1358 EXPECT_FALSE(l2->HasPendingThreadedAnimations()); 1360 EXPECT_FALSE(l2->HasPendingThreadedAnimations());
1359 } 1361 }
1360 1362
1363 // Tests that in-progress threaded animations complete when a Layer's
1364 // cc::Layer changes.
1365 TEST_F(LayerWithRealCompositorTest, MAYBE_SwitchCCLayerAnimations) {
1366 scoped_ptr<Layer> root(CreateLayer(LAYER_TEXTURED));
1367 scoped_ptr<Layer> l1(CreateLayer(LAYER_TEXTURED));
1368 GetCompositor()->SetRootLayer(root.get());
1369 root->Add(l1.get());
1370
1371 l1->SetAnimator(LayerAnimator::CreateImplicitAnimator());
1372
1373 EXPECT_FLOAT_EQ(l1->opacity(), 1.0f);
1374
1375 // Trigger a threaded animation.
1376 l1->SetOpacity(0.5f);
1377
1378 // Change l1's cc::Layer.
1379 l1->SwitchCCLayerForTest();
1380
1381 // Ensure that the opacity animation completed.
1382 EXPECT_FLOAT_EQ(l1->opacity(), 0.5f);
1383 }
1384
1361 } // namespace ui 1385 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698