Skip to content

Commit dbb478b

Browse files
authored
Remove cancellation token from CopyResultsAsync (#1461)
* Remove cancellation token from CopyResultsAsync * Remove null argument
1 parent fe850ca commit dbb478b

5 files changed

Lines changed: 16 additions & 21 deletions

File tree

src/Microsoft.DotNet.XHarness.Android/InstrumentationRunner.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ public class InstrumentationRunner
2525

2626
private readonly ILogger _logger;
2727
private readonly AdbRunner _runner;
28-
28+
2929
public InstrumentationRunner(ILogger logger, AdbRunner runner)
3030
{
3131
_logger = logger;
3232
_runner = runner;
3333
}
34-
34+
3535
public ExitCode RunApkInstrumentation(
3636
string apkPackageName,
3737
string? instrumentationName,

src/Microsoft.DotNet.XHarness.Apple/AppOperations/AppTester.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,7 @@ private async Task RunSimulatorTests(
347347
simulator.OSVersion,
348348
simulator.UDID,
349349
appInformation.BundleIdentifier,
350-
deviceListener.TestLog.FullPath,
351-
cancellationToken))
350+
deviceListener.TestLog.FullPath))
352351
{
353352
throw new InvalidOperationException("Failed to copy test results from simulator to host.");
354353
}
@@ -435,8 +434,7 @@ private async Task RunDeviceTests(
435434
device.OSVersion,
436435
device.UDID,
437436
appInformation.BundleIdentifier,
438-
deviceListener.TestLog.FullPath,
439-
cancellationToken))
437+
deviceListener.TestLog.FullPath))
440438
{
441439
throw new InvalidOperationException("Failed to copy test results from device to host.");
442440
}

src/Microsoft.DotNet.XHarness.iOS.Shared/IResultFileHandler.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,5 @@ Task<bool> CopyResultsAsync(
2424
string osVersion,
2525
string udid,
2626
string bundleIdentifier,
27-
string hostDestinationPath,
28-
CancellationToken token);
27+
string hostDestinationPath);
2928
}

src/Microsoft.DotNet.XHarness.iOS.Shared/ResultFileHandler.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ public async Task<bool> CopyResultsAsync(
6767
string osVersion,
6868
string udid,
6969
string bundleIdentifier,
70-
string hostDestinationPath,
71-
CancellationToken token)
70+
string hostDestinationPath)
7271
{
7372
// This file path is set in iOSApplicationEntryPointBase
7473
string sourcePath = runMode == RunMode.iOS
@@ -94,8 +93,7 @@ await _processManager.ExecuteCommandAsync(
9493
_mainLog,
9594
_mainLog,
9695
TimeSpan.FromMinutes(1),
97-
null,
98-
cancellationToken: token);
96+
null);
9997

10098
if (!File.Exists(hostDestinationPath))
10199
{

tests/Microsoft.DotNet.XHarness.iOS.Shared.Tests/ResultFileHandlerTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public async Task SimulatorBadOsVersionFormatThrowsException()
4747

4848
var exception = await Assert.ThrowsAsync<FormatException>(async () =>
4949
await handler.CopyResultsAsync(
50-
RunMode.iOS, true, "Simulator", "udid", "bundle", _tempFile, CancellationToken.None));
50+
RunMode.iOS, true, "Simulator", "udid", "bundle", _tempFile));
5151

5252
Assert.Equal("Simulator OS version is not in the expected format.", exception.Message);
5353
}
@@ -61,7 +61,7 @@ public async Task SimulatorBadOsVersionNumberThrowsException()
6161

6262
var exception = await Assert.ThrowsAsync<FormatException>(async () =>
6363
await handler.CopyResultsAsync(
64-
RunMode.iOS, true, "Simulator notanumber", "udid", "bundle", _tempFile, CancellationToken.None));
64+
RunMode.iOS, true, "Simulator notanumber", "udid", "bundle", _tempFile));
6565

6666
Assert.Equal("Simulator OS version is not in the expected format.", exception.Message);
6767
}
@@ -74,7 +74,7 @@ public async Task SimulatorOsVersionLessThan18ReturnsFalse()
7474
ResultFileHandler handler = CreateHandler(pm, log);
7575

7676
bool result = await handler.CopyResultsAsync(
77-
RunMode.iOS, true, "Simulator 17.4", "udid", "bundle", _tempFile, CancellationToken.None);
77+
RunMode.iOS, true, "Simulator 17.4", "udid", "bundle", _tempFile);
7878

7979
Assert.True(result);
8080
}
@@ -89,7 +89,7 @@ public async Task SimulatorOsVersion18FileExistsReturnsTrue()
8989
File.WriteAllText(_tempFile, "dummy");
9090

9191
bool result = await handler.CopyResultsAsync(
92-
RunMode.iOS, true, "Simulator 18.0", "udid", "bundle", _tempFile, CancellationToken.None);
92+
RunMode.iOS, true, "Simulator 18.0", "udid", "bundle", _tempFile);
9393

9494
Assert.True(result);
9595
}
@@ -105,7 +105,7 @@ public async Task SimulatorOsVersion18FileMissingReturnsFalse()
105105
File.Delete(_tempFile);
106106

107107
bool result = await handler.CopyResultsAsync(
108-
RunMode.iOS, true, "Simulator 18.0", "udid", "bundle", _tempFile, CancellationToken.None);
108+
RunMode.iOS, true, "Simulator 18.0", "udid", "bundle", _tempFile);
109109

110110
Assert.False(result);
111111
log.Verify(l => l.WriteLine($"Failed to copy results file from simulator. Expected at: {_tempFile}"), Times.Once);
@@ -120,7 +120,7 @@ public async Task DeviceBadOsVersionFormatThrowsException()
120120

121121
var exception = await Assert.ThrowsAsync<FormatException>(async () =>
122122
await handler.CopyResultsAsync(
123-
RunMode.iOS, false, "notanumber", "udid", "bundle", _tempFile, CancellationToken.None));
123+
RunMode.iOS, false, "notanumber", "udid", "bundle", _tempFile));
124124

125125
Assert.Equal("Device OS version is not in the expected format.", exception.Message);
126126
}
@@ -133,7 +133,7 @@ public async Task DeviceOsVersionLessThan18ReturnsTrue()
133133
ResultFileHandler handler = CreateHandler(pm, log);
134134

135135
bool result = await handler.CopyResultsAsync(
136-
RunMode.iOS, false, "17.4", "udid", "bundle", _tempFile, CancellationToken.None);
136+
RunMode.iOS, false, "17.4", "udid", "bundle", _tempFile);
137137

138138
Assert.True(result);
139139
}
@@ -148,7 +148,7 @@ public async Task DeviceOsVersion18FileExistsReturnsTrue()
148148
File.WriteAllText(_tempFile, "dummy");
149149

150150
bool result = await handler.CopyResultsAsync(
151-
RunMode.iOS, false, "18.0", "udid", "bundle", _tempFile, CancellationToken.None);
151+
RunMode.iOS, false, "18.0", "udid", "bundle", _tempFile);
152152

153153
Assert.True(result);
154154
}
@@ -164,7 +164,7 @@ public async Task DeviceOsVersion18FileMissingReturnsFalse()
164164
File.Delete(_tempFile);
165165

166166
bool result = await handler.CopyResultsAsync(
167-
RunMode.iOS, false, "18.0", "udid", "bundle", _tempFile, CancellationToken.None);
167+
RunMode.iOS, false, "18.0", "udid", "bundle", _tempFile);
168168

169169
Assert.False(result);
170170
log.Verify(l => l.WriteLine($"Failed to copy results file from device. Expected at: {_tempFile}"), Times.Once);

0 commit comments

Comments
 (0)