| OLD | NEW |
| 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.chromoting; | 5 package org.chromium.chromoting; |
| 6 | 6 |
| 7 import android.graphics.Point; | 7 import android.graphics.Point; |
| 8 import android.test.InstrumentationTestCase; | 8 import android.test.InstrumentationTestCase; |
| 9 import android.test.suitebuilder.annotation.SmallTest; | 9 import android.test.suitebuilder.annotation.SmallTest; |
| 10 import android.view.MotionEvent; | 10 import android.view.MotionEvent; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 private void injectUpEvent(int id) { | 190 private void injectUpEvent(int id) { |
| 191 MotionEvent event = mEventGenerator.obtainUpEvent(id); | 191 MotionEvent event = mEventGenerator.obtainUpEvent(id); |
| 192 mInputStrategy.onMotionEvent(event); | 192 mInputStrategy.onMotionEvent(event); |
| 193 event.recycle(); | 193 event.recycle(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 @Override | 196 @Override |
| 197 public void setUp() { | 197 public void setUp() { |
| 198 mRenderData = new RenderData(); | 198 mRenderData = new RenderData(); |
| 199 mRemoteInputInjector = new MockRemoteInputInjector(); | 199 mRemoteInputInjector = new MockRemoteInputInjector(); |
| 200 | 200 mInputStrategy = new TouchInputStrategy(mRenderData); |
| 201 // TODO(lambroslambrou): Provide a mock Client implementation that doesn
't call out to JNI, | |
| 202 // and mock the Client methods instead of using MockRemoteInputInjector
here. | |
| 203 mInputStrategy = new TouchInputStrategy(mRenderData, null); | |
| 204 mInputStrategy.setRemoteInputInjectorForTest(mRemoteInputInjector); | 201 mInputStrategy.setRemoteInputInjectorForTest(mRemoteInputInjector); |
| 205 mEventGenerator = new TouchEventGenerator(); | 202 mEventGenerator = new TouchEventGenerator(); |
| 206 | 203 |
| 207 mRenderData.screenWidth = SCREEN_SIZE_PX; | 204 mRenderData.screenWidth = SCREEN_SIZE_PX; |
| 208 mRenderData.screenHeight = SCREEN_SIZE_PX; | 205 mRenderData.screenHeight = SCREEN_SIZE_PX; |
| 209 mRenderData.imageWidth = REMOTE_DESKTOP_SIZE_PX; | 206 mRenderData.imageWidth = REMOTE_DESKTOP_SIZE_PX; |
| 210 mRenderData.imageHeight = REMOTE_DESKTOP_SIZE_PX; | 207 mRenderData.imageHeight = REMOTE_DESKTOP_SIZE_PX; |
| 211 mRenderData.transform.postTranslate(-TRANSLATE_OFFSET_PX, -TRANSLATE_OFF
SET_PX); | 208 mRenderData.transform.postTranslate(-TRANSLATE_OFFSET_PX, -TRANSLATE_OFF
SET_PX); |
| 212 } | 209 } |
| 213 | 210 |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 for (int i = 0; i < 10000; i++) { | 522 for (int i = 0; i < 10000; i++) { |
| 526 injectMoveEvent(0, fingerOnePosX, i % 10); | 523 injectMoveEvent(0, fingerOnePosX, i % 10); |
| 527 injectMoveEvent(1, fingerTwoPosX, i % 10); | 524 injectMoveEvent(1, fingerTwoPosX, i % 10); |
| 528 } | 525 } |
| 529 mRemoteInputInjector.assertNothingInjected(); | 526 mRemoteInputInjector.assertNothingInjected(); |
| 530 | 527 |
| 531 mInputStrategy.onScroll(0.0f, 0.0f); | 528 mInputStrategy.onScroll(0.0f, 0.0f); |
| 532 mRemoteInputInjector.assertNothingInjected(); | 529 mRemoteInputInjector.assertNothingInjected(); |
| 533 } | 530 } |
| 534 } | 531 } |
| OLD | NEW |