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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp

Issue 1950243005: Communicate MT changes to impl-only scroll offset animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 EXPECT_EQ(scrollAnimator->m_runState, 512 EXPECT_EQ(scrollAnimator->m_runState,
513 ScrollAnimatorCompositorCoordinator::RunState::RunningOnCompositorButNee dsUpdate); 513 ScrollAnimatorCompositorCoordinator::RunState::RunningOnCompositorButNee dsUpdate);
514 EXPECT_EQ(250, scrollAnimator->desiredTargetPosition().x()); 514 EXPECT_EQ(250, scrollAnimator->desiredTargetPosition().x());
515 EXPECT_EQ(0, scrollAnimator->desiredTargetPosition().y()); 515 EXPECT_EQ(0, scrollAnimator->desiredTargetPosition().y());
516 reset(*scrollAnimator); 516 reset(*scrollAnimator);
517 517
518 // Forced GC in order to finalize objects depending on the mock object. 518 // Forced GC in order to finalize objects depending on the mock object.
519 ThreadHeap::collectAllGarbage(); 519 ThreadHeap::collectAllGarbage();
520 } 520 }
521 521
522 // This test verifies that ImplOnlyAnimationUpdates get cleared once they're
523 // pushed to compositor animation host.
524 TEST(ScrollAnimatorTest, ImplOnlyAnimationUpdatesCleared)
525 {
526 MockScrollableArea* scrollableArea = MockScrollableArea::create(true);
527 TestScrollAnimator* scrollAnimator = new TestScrollAnimator(scrollableArea, getMockedTime);
528
529 EXPECT_CALL(*scrollableArea, registerForAnimation()).Times(2);
530
531 EXPECT_EQ(scrollAnimator->m_runState, ScrollAnimatorCompositorCoordinator::R unState::Idle);
532 EXPECT_FALSE(scrollAnimator->hasAnimationThatRequiresService());
533 EXPECT_TRUE(scrollAnimator->m_implOnlyAnimationAdjustments.empty());
534
535 scrollAnimator->updateImplOnlyScrollOffsetAnimation(FloatSize(100.f, 100.f)) ;
536 scrollAnimator->updateImplOnlyScrollOffsetAnimation(FloatSize(10.f, -10.f));
537
538 EXPECT_TRUE(scrollAnimator->hasAnimationThatRequiresService());
539 EXPECT_EQ(2U, scrollAnimator->m_implOnlyAnimationAdjustments.size());
jbroman 2016/05/16 19:15:11 Accessing the private members of an object is unfo
ymalik 2016/05/16 20:52:35 The correct way to test the bad behavior would req
540
541 scrollAnimator->updateCompositorAnimations();
542
543 EXPECT_EQ(scrollAnimator->m_runState, ScrollAnimatorCompositorCoordinator::R unState::Idle);
544 EXPECT_FALSE(scrollAnimator->hasAnimationThatRequiresService());
545 EXPECT_TRUE(scrollAnimator->m_implOnlyAnimationAdjustments.empty());
546
547 // Forced GC in order to finalize objects depending on the mock object.
548 ThreadHeap::collectAllGarbage();
549 }
550
522 } // namespace blink 551 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698