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

Side by Side Diff: android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java

Issue 1063853005: Unify Android Webview and Chrome's fling (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: rebase Created 5 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 package org.chromium.android_webview.test; 5 package org.chromium.android_webview.test;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.os.Build; 8 import android.os.Build;
9 import android.test.suitebuilder.annotation.SmallTest; 9 import android.test.suitebuilder.annotation.SmallTest;
10 import android.view.View; 10 import android.view.View;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 super.tearDown(); 124 super.tearDown();
125 } 125 }
126 126
127 @Override 127 @Override
128 protected TestDependencyFactory createTestDependencyFactory() { 128 protected TestDependencyFactory createTestDependencyFactory() {
129 return new TestDependencyFactory() { 129 return new TestDependencyFactory() {
130 @Override 130 @Override
131 public AwScrollOffsetManager createScrollOffsetManager( 131 public AwScrollOffsetManager createScrollOffsetManager(
132 AwScrollOffsetManager.Delegate delegate, OverScroller overSc roller) { 132 AwScrollOffsetManager.Delegate delegate, OverScroller overSc roller) {
133 return new AwScrollOffsetManager(delegate, overScroller) { 133 return new AwScrollOffsetManager(delegate, overScroller);
134 @Override
135 public void onUnhandledFlingStartEvent(int velocityX, int ve locityY) {
136 // Intentional no-op. The synthetic scroll gestures this test creates all
137 // happen at the same time which triggers the fling dete ction logic.
138 // NOTE: this simply disables handling the gesture, flin ging the AwContents
139 // via the flingScroll API is still possible.
140 }
141 };
142 } 134 }
143 @Override 135 @Override
144 public AwTestContainerView createAwTestContainerView(AwTestRunnerAct ivity activity, 136 public AwTestContainerView createAwTestContainerView(AwTestRunnerAct ivity activity,
145 boolean allowHardwareAcceleration) { 137 boolean allowHardwareAcceleration) {
146 return new ScrollTestContainerView(activity, allowHardwareAccele ration); 138 return new ScrollTestContainerView(activity, allowHardwareAccele ration);
147 } 139 }
148 }; 140 };
149 } 141 }
150 142
151 private static final String TEST_PAGE_COMMON_HEADERS = 143 private static final String TEST_PAGE_COMMON_HEADERS =
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 @Override 730 @Override
739 public void onFlingStartGesture( 731 public void onFlingStartGesture(
740 int velocityX, int velocityY, int scrollOffsetY, int scrollExten tY) { 732 int velocityX, int velocityY, int scrollOffsetY, int scrollExten tY) {
741 } 733 }
742 734
743 @Override 735 @Override
744 public void onFlingCancelGesture() { 736 public void onFlingCancelGesture() {
745 } 737 }
746 738
747 @Override 739 @Override
748 public void onUnhandledFlingStartEvent(int velocityX, int velocityY) {
749 }
750
751 @Override
752 public void onScrollUpdateGestureConsumed() { 740 public void onScrollUpdateGestureConsumed() {
753 mOnScrollUpdateGestureConsumedHelper.notifyCalled(); 741 mOnScrollUpdateGestureConsumedHelper.notifyCalled();
754 } 742 }
755 } 743 }
756 744
757 @SmallTest 745 @SmallTest
758 @Feature({"AndroidWebView"}) 746 @Feature({"AndroidWebView"})
759 public void testTouchScrollingConsumesScrollByGesture() throws Throwable { 747 public void testTouchScrollingConsumesScrollByGesture() throws Throwable {
760 final TestAwContentsClient contentsClient = new TestAwContentsClient(); 748 final TestAwContentsClient contentsClient = new TestAwContentsClient();
761 final ScrollTestContainerView testContainerView = 749 final ScrollTestContainerView testContainerView =
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 assertTrue(String.format(Locale.ENGLISH, 820 assertTrue(String.format(Locale.ENGLISH,
833 "Scroll range should increase after zoom (%d) > (%d)", 821 "Scroll range should increase after zoom (%d) > (%d)",
834 newScrollRange, oldScrollRange), newScrollRange > oldScr ollRange); 822 newScrollRange, oldScrollRange), newScrollRange > oldScr ollRange);
835 assertEquals(awContents.getContentHeightCss(), oldContentHeightA pproximation); 823 assertEquals(awContents.getContentHeightCss(), oldContentHeightA pproximation);
836 assertEquals(awContents.getContentHeightCss(), newContentHeightA pproximation); 824 assertEquals(awContents.getContentHeightCss(), newContentHeightA pproximation);
837 } 825 }
838 }); 826 });
839 827
840 } 828 }
841 } 829 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698