Skip to content

Commit 96b24e1

Browse files
committed
fix: remove unused Android helper cache export
1 parent dae33d4 commit 96b24e1

4 files changed

Lines changed: 30 additions & 36 deletions

File tree

‎src/platforms/android/__tests__/multitouch-helper-install.test.ts‎

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,11 @@ import crypto from 'node:crypto';
33
import { promises as fs } from 'node:fs';
44
import os from 'node:os';
55
import path from 'node:path';
6-
import { beforeEach, test } from 'vitest';
7-
import {
8-
ensureAndroidMultiTouchHelper,
9-
resetAndroidMultiTouchHelperInstallCache,
10-
} from '../multitouch-helper-install.ts';
6+
import { test } from 'vitest';
7+
import { ensureAndroidMultiTouchHelper } from '../multitouch-helper-install.ts';
118
import type { AndroidAdbExecutor, AndroidAdbProvider } from '../adb-executor.ts';
129
import { ANDROID_MULTITOUCH_HELPER_MANIFEST } from './multitouch-helper.fixtures.ts';
1310

14-
beforeEach(() => {
15-
resetAndroidMultiTouchHelperInstallCache();
16-
});
17-
1811
test('helper install uses replace and test-package semantics', async () => {
1912
const fixture = await makeInstallFixture('helper-apk');
2013
const installCalls: unknown[] = [];
@@ -36,7 +29,7 @@ test('helper install uses replace and test-package semantics', async () => {
3629
adb,
3730
adbProvider: provider,
3831
artifact: fixture.artifact,
39-
deviceKey: 'android:emulator-5554',
32+
deviceKey: 'android:install-semantics',
4033
});
4134

4235
assert.equal(result.reason, 'missing');
@@ -64,7 +57,7 @@ test('same-version helper is current only when installed APK bytes match', async
6457
adb,
6558
adbProvider: provider,
6659
artifact: fixture.artifact,
67-
deviceKey: 'android:emulator-5554',
60+
deviceKey: 'android:matching-bytes',
6861
});
6962

7063
assert.equal(result.reason, 'current');
@@ -85,7 +78,7 @@ test('same-version helper is replaced when installed APK bytes differ', async ()
8578
adb,
8679
adbProvider: provider,
8780
artifact: fixture.artifact,
88-
deviceKey: 'android:emulator-5554',
81+
deviceKey: 'android:mismatched-bytes',
8982
});
9083

9184
assert.equal(result.reason, 'mismatched');
@@ -104,7 +97,7 @@ test('same-version helper is replaced when installed APK identity is unavailable
10497
adb,
10598
adbProvider: provider,
10699
artifact: fixture.artifact,
107-
deviceKey: 'android:emulator-5554',
100+
deviceKey: 'android:unverifiable-identity',
108101
});
109102

110103
assert.equal(result.reason, 'unverifiable');
@@ -122,7 +115,7 @@ test('newer installed helper remains current without an unsafe downgrade', async
122115
adb,
123116
adbProvider: provider,
124117
artifact: fixture.artifact,
125-
deviceKey: 'android:emulator-5554',
118+
deviceKey: 'android:newer-helper',
126119
});
127120

128121
assert.equal(result.reason, 'current');
@@ -143,14 +136,14 @@ test('install memo includes artifact identity, not only version code', async ()
143136
adb: device.adb,
144137
adbProvider: device.provider,
145138
artifact: first.artifact,
146-
deviceKey: 'android:emulator-5554',
139+
deviceKey: 'android:artifact-identity',
147140
});
148141
device.setInstalledApk('first-helper');
149142
const result = await ensureAndroidMultiTouchHelper({
150143
adb: device.adb,
151144
adbProvider: device.provider,
152145
artifact: second.artifact,
153-
deviceKey: 'android:emulator-5554',
146+
deviceKey: 'android:artifact-identity',
154147
});
155148

156149
assert.equal(result.reason, 'mismatched');
@@ -168,7 +161,7 @@ test('install memo skips repeated APK reads for the same artifact identity', asy
168161
adb: device.adb,
169162
adbProvider: device.provider,
170163
artifact: fixture.artifact,
171-
deviceKey: 'android:emulator-5554',
164+
deviceKey: 'android:install-memo',
172165
});
173166
await fs.rm(fixture.artifact.apkPath);
174167
const result = await ensureAndroidMultiTouchHelper({
@@ -181,7 +174,7 @@ test('install memo skips repeated APK reads for the same artifact identity', asy
181174
},
182175
},
183176
artifact: fixture.artifact,
184-
deviceKey: 'android:emulator-5554',
177+
deviceKey: 'android:install-memo',
185178
});
186179

187180
assert.equal(result.reason, 'current');

‎src/platforms/android/__tests__/multitouch-helper.test.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
import assert from 'node:assert/strict';
2-
import { beforeEach, test } from 'vitest';
2+
import { test } from 'vitest';
33
import { buildGesturePlan } from '../../../contracts/gesture-plan.ts';
44
import {
55
normalizeAndroidMultiTouchHelperGestureRequest,
66
parseAndroidMultiTouchHelperOutput,
77
runAndroidMultiTouchHelperGesture,
88
parseAndroidGestureViewportResult,
99
} from '../multitouch-helper.ts';
10-
import { resetAndroidMultiTouchHelperInstallCache } from '../multitouch-helper-install.ts';
1110
import {
1211
ANDROID_MULTITOUCH_HELPER_MANIFEST as manifest,
1312
androidMultiTouchResultRecord as resultRecord,
1413
} from './multitouch-helper.fixtures.ts';
1514

1615
const viewport = { x: 0, y: 0, width: 400, height: 800 };
1716

18-
beforeEach(resetAndroidMultiTouchHelperInstallCache);
19-
2017
test('helper response parsing returns instrumentation evidence', () => {
2118
assert.deepEqual(
2219
parseAndroidMultiTouchHelperOutput(

‎src/platforms/android/__tests__/touch-executor-helper.test.ts‎

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { buildGesturePlan } from '../../../contracts/gesture-plan.ts';
55
import { AppError } from '../../../kernel/errors.ts';
66
import { withAndroidAdbProvider } from '../adb-executor.ts';
77
import { longPressAndroid } from '../input-actions.ts';
8-
import { resetAndroidMultiTouchHelperInstallCache } from '../multitouch-helper-install.ts';
98
import { stopAndroidSnapshotHelperSessionForDevice } from '../snapshot-helper.ts';
109
import { executeAndroidTouchPlan, readAndroidGestureViewport } from '../touch-executor.ts';
1110
import {
@@ -35,13 +34,19 @@ vi.mock('../helper-package-install.ts', async (importOriginal) => {
3534
});
3635

3736
const mockStopSnapshotSession = vi.mocked(stopAndroidSnapshotHelperSessionForDevice);
37+
let deviceSequence = 0;
3838

3939
beforeEach(() => {
40-
resetAndroidMultiTouchHelperInstallCache();
4140
mockStopSnapshotSession.mockReset();
4241
});
4342

43+
function makeIsolatedDevice() {
44+
deviceSequence += 1;
45+
return { ...ANDROID_EMULATOR, id: `emulator-touch-${deviceSequence}` };
46+
}
47+
4448
test('helper gesture releases persistent snapshot instrumentation before touch instrumentation', async () => {
49+
const device = makeIsolatedDevice();
4550
const events: string[] = [];
4651
mockStopSnapshotSession.mockImplementation(async () => {
4752
events.push('snapshot-stop');
@@ -71,10 +76,10 @@ test('helper gesture releases persistent snapshot instrumentation before touch i
7176
throw new Error(`unexpected adb call: ${args.join(' ')}`);
7277
},
7378
},
74-
{ serial: ANDROID_EMULATOR.id },
79+
{ serial: device.id },
7580
async () =>
7681
await executeAndroidTouchPlan(
77-
ANDROID_EMULATOR,
82+
device,
7883
buildGesturePlan(
7984
{
8085
intent: 'pan',
@@ -94,6 +99,7 @@ test('helper gesture releases persistent snapshot instrumentation before touch i
9499
});
95100

96101
test('bare-adb long press executes one helper gesture without a viewport probe', async () => {
102+
const device = makeIsolatedDevice();
97103
const instrumentCalls: string[][] = [];
98104
const result = await withAndroidAdbProvider(
99105
{
@@ -119,8 +125,8 @@ test('bare-adb long press executes one helper gesture without a viewport probe',
119125
throw new Error(`unexpected adb call: ${args.join(' ')}`);
120126
},
121127
},
122-
{ serial: ANDROID_EMULATOR.id },
123-
async () => await longPressAndroid(ANDROID_EMULATOR, 30, 40, 750),
128+
{ serial: device.id },
129+
async () => await longPressAndroid(device, 30, 40, 750),
124130
);
125131

126132
assert.equal(result.backend, 'android-multitouch-helper');
@@ -130,6 +136,7 @@ test('bare-adb long press executes one helper gesture without a viewport probe',
130136
});
131137

132138
test('single-pointer helper failure propagates through the touch executor', async () => {
139+
const device = makeIsolatedDevice();
133140
await assert.rejects(
134141
withAndroidAdbProvider(
135142
{
@@ -158,10 +165,10 @@ test('single-pointer helper failure propagates through the touch executor', asyn
158165
throw new Error(`unexpected adb call: ${args.join(' ')}`);
159166
},
160167
},
161-
{ serial: ANDROID_EMULATOR.id },
168+
{ serial: device.id },
162169
async () =>
163170
await executeAndroidTouchPlan(
164-
ANDROID_EMULATOR,
171+
device,
165172
buildGesturePlan(
166173
{
167174
intent: 'pan',
@@ -186,6 +193,7 @@ test('single-pointer helper failure propagates through the touch executor', asyn
186193
});
187194

188195
test('helper viewport failure preserves its structured message and error type', async () => {
196+
const device = makeIsolatedDevice();
189197
await assert.rejects(
190198
withAndroidAdbProvider(
191199
{
@@ -214,8 +222,8 @@ test('helper viewport failure preserves its structured message and error type',
214222
throw new Error(`unexpected adb call: ${args.join(' ')}`);
215223
},
216224
},
217-
{ serial: ANDROID_EMULATOR.id },
218-
async () => await readAndroidGestureViewport(ANDROID_EMULATOR),
225+
{ serial: device.id },
226+
async () => await readAndroidGestureViewport(device),
219227
),
220228
(error: unknown) => {
221229
assert.ok(error instanceof AppError);

‎src/platforms/android/multitouch-helper-install.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,3 @@ export const ensureAndroidMultiTouchHelper =
9393
installTimeoutMs: HELPER_INSTALL_TIMEOUT_MS,
9494
helperLabel: HELPER_LABEL,
9595
});
96-
97-
export function resetAndroidMultiTouchHelperInstallCache(): void {
98-
installedMultiTouchHelpers.clear();
99-
}

0 commit comments

Comments
 (0)