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

Side by Side Diff: chrome/test/android/javatests/src/org/chromium/chrome/test/util/TabStripUtils.java

Issue 2774443002: chrome/android: Push EventFilters into the Layout implementations. (Closed)
Patch Set: fix for re-landing Created 3 years, 8 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 | « chrome/android/java_sources.gni ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.chrome.test.util; 5 package org.chromium.chrome.test.util;
6 6
7 import org.chromium.chrome.browser.ChromeTabbedActivity; 7 import org.chromium.chrome.browser.ChromeTabbedActivity;
8 import org.chromium.chrome.browser.compositor.layouts.components.CompositorButto n; 8 import org.chromium.chrome.browser.compositor.layouts.components.CompositorButto n;
9 import org.chromium.chrome.browser.compositor.overlays.strip.StripLayoutHelper; 9 import org.chromium.chrome.browser.compositor.overlays.strip.StripLayoutHelper;
10 import org.chromium.chrome.browser.compositor.overlays.strip.StripLayoutHelperMa nager; 10 import org.chromium.chrome.browser.compositor.overlays.strip.StripLayoutHelperMa nager;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 * @param tab The tab to click. 73 * @param tab The tab to click.
74 * @param base The ChromeTabbedActivityTestBase where we're calling this fro m. 74 * @param base The ChromeTabbedActivityTestBase where we're calling this fro m.
75 */ 75 */
76 public static void clickTab(StripLayoutTab tab, ChromeTabbedActivityTestBase base) { 76 public static void clickTab(StripLayoutTab tab, ChromeTabbedActivityTestBase base) {
77 final StripLayoutHelperManager manager = getStripLayoutHelperManager(bas e.getActivity()); 77 final StripLayoutHelperManager manager = getStripLayoutHelperManager(bas e.getActivity());
78 final float x = (tab.getDrawX() + tab.getWidth() / 2); 78 final float x = (tab.getDrawX() + tab.getWidth() / 2);
79 final float y = (tab.getDrawY() + tab.getHeight() / 2); 79 final float y = (tab.getDrawY() + tab.getHeight() / 2);
80 base.getInstrumentation().runOnMainSync(new Runnable() { 80 base.getInstrumentation().runOnMainSync(new Runnable() {
81 @Override 81 @Override
82 public void run() { 82 public void run() {
83 manager.click(0, x, y, false, 0); 83 manager.simulateClick(x, y, false, 0);
84 } 84 }
85 }); 85 });
86 } 86 }
87 87
88 /** 88 /**
89 * Click a compositor button. 89 * Click a compositor button.
90 * @param button The button to click. 90 * @param button The button to click.
91 * @param base The ChromeTabbedActivityTestBase where we're calling this fro m. 91 * @param base The ChromeTabbedActivityTestBase where we're calling this fro m.
92 */ 92 */
93 public static void clickCompositorButton(CompositorButton button, 93 public static void clickCompositorButton(CompositorButton button,
94 ChromeTabbedActivityTestBase base) { 94 ChromeTabbedActivityTestBase base) {
95 final StripLayoutHelperManager manager = getStripLayoutHelperManager(bas e.getActivity()); 95 final StripLayoutHelperManager manager = getStripLayoutHelperManager(bas e.getActivity());
96 final float x = button.getX() + button.getWidth() / 2; 96 final float x = button.getX() + button.getWidth() / 2;
97 final float y = button.getY() + button.getHeight() / 2; 97 final float y = button.getY() + button.getHeight() / 2;
98 base.getInstrumentation().runOnMainSync(new Runnable() { 98 base.getInstrumentation().runOnMainSync(new Runnable() {
99 @Override 99 @Override
100 public void run() { 100 public void run() {
101 manager.click(0, x, y, false, 0); 101 manager.simulateClick(x, y, false, 0);
102 } 102 }
103 }); 103 });
104 } 104 }
105 105
106 /** 106 /**
107 * Long press a compositor button. 107 * Long press a compositor button.
108 * @param button The button to long press. 108 * @param button The button to long press.
109 * @param base The ChromeTabbedActivityTestBase where we're calling this fro m. 109 * @param base The ChromeTabbedActivityTestBase where we're calling this fro m.
110 */ 110 */
111 public static void longPressCompositorButton(CompositorButton button, 111 public static void longPressCompositorButton(CompositorButton button,
112 ChromeTabbedActivityTestBase base) { 112 ChromeTabbedActivityTestBase base) {
113 final StripLayoutHelperManager manager = getStripLayoutHelperManager(bas e.getActivity()); 113 final StripLayoutHelperManager manager = getStripLayoutHelperManager(bas e.getActivity());
114 final float x = button.getX() + button.getWidth() / 2; 114 final float x = button.getX() + button.getWidth() / 2;
115 final float y = button.getY() + button.getHeight() / 2; 115 final float y = button.getY() + button.getHeight() / 2;
116 base.getInstrumentation().runOnMainSync(new Runnable() { 116 base.getInstrumentation().runOnMainSync(new Runnable() {
117 @Override 117 @Override
118 public void run() { 118 public void run() {
119 manager.onLongPress(0, x, y); 119 manager.simulateLongPress(x, y);
120 } 120 }
121 }); 121 });
122 } 122 }
123 123
124 /** 124 /**
125 * @param tabStrip The tab strip to wait for. 125 * @param tabStrip The tab strip to wait for.
126 */ 126 */
127 public static void settleDownCompositor(final StripLayoutHelper tabStrip) { 127 public static void settleDownCompositor(final StripLayoutHelper tabStrip) {
128 CriteriaHelper.pollUiThread(new Criteria() { 128 CriteriaHelper.pollUiThread(new Criteria() {
129 @Override 129 @Override
130 public boolean isSatisfied() { 130 public boolean isSatisfied() {
131 return !tabStrip.isAnimating(); 131 return !tabStrip.isAnimating();
132 } 132 }
133 }); 133 });
134 } 134 }
135 } 135 }
OLDNEW
« no previous file with comments | « chrome/android/java_sources.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698