OLD | NEW |
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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 EXPECT_EQ(offsetX + 15 + 10, scrollAnimator->currentPosition().x()); | 442 EXPECT_EQ(offsetX + 15 + 10, scrollAnimator->currentPosition().x()); |
443 EXPECT_EQ(0, scrollAnimator->currentPosition().y()); | 443 EXPECT_EQ(0, scrollAnimator->currentPosition().y()); |
444 reset(*scrollAnimator); | 444 reset(*scrollAnimator); |
445 } | 445 } |
446 | 446 |
447 // Test the behavior when in WaitingToCancelOnCompositor and a new user scroll | 447 // Test the behavior when in WaitingToCancelOnCompositor and a new user scroll |
448 // happens. | 448 // happens. |
449 TEST(ScrollAnimatorTest, CancellingCompositorAnimation) | 449 TEST(ScrollAnimatorTest, CancellingCompositorAnimation) |
450 { | 450 { |
451 RawPtr<MockScrollableArea> scrollableArea = MockScrollableArea::create(true)
; | 451 RawPtr<MockScrollableArea> scrollableArea = MockScrollableArea::create(true)
; |
452 RawPtr<TestScrollAnimator> scrollAnimator = adoptPtrWillBeNoop(new TestScrol
lAnimator(scrollableArea.get(), getMockedTime)); | 452 RawPtr<TestScrollAnimator> scrollAnimator = new TestScrollAnimator(scrollabl
eArea.get(), getMockedTime); |
453 | 453 |
454 EXPECT_CALL(*scrollableArea, minimumScrollPosition()).Times(AtLeast(1)) | 454 EXPECT_CALL(*scrollableArea, minimumScrollPosition()).Times(AtLeast(1)) |
455 .WillRepeatedly(Return(IntPoint())); | 455 .WillRepeatedly(Return(IntPoint())); |
456 EXPECT_CALL(*scrollableArea, maximumScrollPosition()).Times(AtLeast(1)) | 456 EXPECT_CALL(*scrollableArea, maximumScrollPosition()).Times(AtLeast(1)) |
457 .WillRepeatedly(Return(IntPoint(1000, 1000))); | 457 .WillRepeatedly(Return(IntPoint(1000, 1000))); |
458 // Called when reset, not setting anywhere else. | 458 // Called when reset, not setting anywhere else. |
459 EXPECT_CALL(*scrollableArea, setScrollOffset(_, _)).Times(1); | 459 EXPECT_CALL(*scrollableArea, setScrollOffset(_, _)).Times(1); |
460 // Called from first and last user scroll, and first update. | 460 // Called from first and last user scroll, and first update. |
461 EXPECT_CALL(*scrollableArea, registerForAnimation()).Times(3); | 461 EXPECT_CALL(*scrollableArea, registerForAnimation()).Times(3); |
462 EXPECT_CALL(*scrollableArea, scheduleAnimation()).Times(AtLeast(1)) | 462 EXPECT_CALL(*scrollableArea, scheduleAnimation()).Times(AtLeast(1)) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 ScrollAnimatorCompositorCoordinator::RunState::WaitingToSendToCompositor
); | 511 ScrollAnimatorCompositorCoordinator::RunState::WaitingToSendToCompositor
); |
512 EXPECT_EQ(100, scrollAnimator->desiredTargetPosition().x()); | 512 EXPECT_EQ(100, scrollAnimator->desiredTargetPosition().x()); |
513 EXPECT_EQ(0, scrollAnimator->desiredTargetPosition().y()); | 513 EXPECT_EQ(0, scrollAnimator->desiredTargetPosition().y()); |
514 reset(*scrollAnimator); | 514 reset(*scrollAnimator); |
515 | 515 |
516 // Forced GC in order to finalize objects depending on the mock object. | 516 // Forced GC in order to finalize objects depending on the mock object. |
517 Heap::collectAllGarbage(); | 517 Heap::collectAllGarbage(); |
518 } | 518 } |
519 | 519 |
520 } // namespace blink | 520 } // namespace blink |
OLD | NEW |