Cut over the window to Explorer.Host.exe so only the host writes the index.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -14,7 +14,7 @@ public class WorkbenchPipeTests
|
||||
var indexing = new FakeIndexing();
|
||||
var transfers = new FakeTransfers();
|
||||
var server = new WorkbenchPipeServer(
|
||||
new WorkbenchHost(indexing, transfers),
|
||||
new WorkbenchHost(indexing, transfers, new StubSources(), new StubMutations()),
|
||||
new WorkbenchIpcOptions { PipeName = "ew-test" },
|
||||
NullLogger<WorkbenchPipeServer>.Instance);
|
||||
|
||||
@@ -31,13 +31,23 @@ public class WorkbenchPipeTests
|
||||
|
||||
var paused = server.Handle(new IpcEnvelope { V = WorkbenchIpc.ProtocolVersion, Op = "Transfers.IsPaused" });
|
||||
Assert.True(paused.Paused);
|
||||
|
||||
var copy = server.Handle(new IpcEnvelope
|
||||
{
|
||||
V = WorkbenchIpc.ProtocolVersion,
|
||||
Op = "Transfers.EnqueueCopy",
|
||||
Paths = ["C:\\a.txt"],
|
||||
Dest = "D:\\"
|
||||
});
|
||||
Assert.True(copy.Ok);
|
||||
Assert.Equal(@"D:\", transfers.CopiedDest);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Handle_rejects_other_protocol_versions()
|
||||
{
|
||||
var server = new WorkbenchPipeServer(
|
||||
new WorkbenchHost(new FakeIndexing(), new FakeTransfers()),
|
||||
new WorkbenchHost(new FakeIndexing(), new FakeTransfers(), new StubSources(), new StubMutations()),
|
||||
new WorkbenchIpcOptions(),
|
||||
NullLogger<WorkbenchPipeServer>.Instance);
|
||||
var reply = server.Handle(new IpcEnvelope { V = 99, Op = "Ping" });
|
||||
@@ -72,5 +82,37 @@ public class WorkbenchPipeTests
|
||||
public void ClearFinished() { }
|
||||
public bool MoveUp(long jobId) => false;
|
||||
public bool MoveDown(long jobId) => false;
|
||||
public string? CopiedDest { get; private set; }
|
||||
public Task EnqueueCopyAsync(IReadOnlyList<string> sources, string destinationDirectory, CancellationToken cancellationToken = default)
|
||||
{
|
||||
CopiedDest = destinationDirectory;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class StubSources : ISourceHost
|
||||
{
|
||||
public Task RefreshAsync(CancellationToken cancellationToken = default) => Task.CompletedTask;
|
||||
public Task<Source> AddUncAsync(string path, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult(new Source { StableKey = "x", DisplayName = path });
|
||||
public Task<Source?> EnsureForPathAsync(string path, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult<Source?>(null);
|
||||
public Task<bool> ForgetAsync(string path, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult(false);
|
||||
}
|
||||
|
||||
private sealed class StubMutations : IIndexMutations
|
||||
{
|
||||
public Task<long> UpsertSyncProfileAsync(SyncProfile profile, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult(1L);
|
||||
public Task DeleteSyncProfileAsync(long id, CancellationToken cancellationToken = default) => Task.CompletedTask;
|
||||
public Task<long> UpsertOperationProfileAsync(OperationProfile profile, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult(1L);
|
||||
public Task DeleteOperationProfileAsync(long id, CancellationToken cancellationToken = default) => Task.CompletedTask;
|
||||
public Task<long> CreateRenameBatchAsync(IReadOnlyList<RenameBatchItem> items, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult(1L);
|
||||
public Task MarkRenameBatchUndoneAsync(long id, CancellationToken cancellationToken = default) => Task.CompletedTask;
|
||||
public Task EnqueueHashCollisionsAsync(long? sourceId, CancellationToken cancellationToken = default) => Task.CompletedTask;
|
||||
public Task UpsertRelationAsync(FileRelation relation, CancellationToken cancellationToken = default) => Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user