Skip to content

Commit 11f8cd3

Browse files
committed
Move TestNotificationService down to /platform/
1 parent 25ecfcf commit 11f8cd3

8 files changed

Lines changed: 48 additions & 34 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
'use strict';
6+
7+
import { INotificationService, INotificationHandle, NoOpNotification, Severity, INotification, IPromptChoice } from 'vs/platform/notification/common/notification';
8+
9+
export class TestNotificationService implements INotificationService {
10+
11+
public _serviceBrand: any;
12+
13+
private static readonly NO_OP: INotificationHandle = new NoOpNotification();
14+
15+
public info(message: string): INotificationHandle {
16+
return this.notify({ severity: Severity.Info, message });
17+
}
18+
19+
public warn(message: string): INotificationHandle {
20+
return this.notify({ severity: Severity.Warning, message });
21+
}
22+
23+
public error(error: string | Error): INotificationHandle {
24+
return this.notify({ severity: Severity.Error, message: error });
25+
}
26+
27+
public notify(notification: INotification): INotificationHandle {
28+
return TestNotificationService.NO_OP;
29+
}
30+
31+
public prompt(severity: Severity, message: string, choices: IPromptChoice[], onCancel?: () => void): INotificationHandle {
32+
return TestNotificationService.NO_OP;
33+
}
34+
}

src/vs/workbench/parts/extensions/test/electron-browser/extensionsTipsService.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import { Emitter } from 'vs/base/common/event';
2323
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
2424
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
2525
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
26-
import { TestTextResourceConfigurationService, TestContextService, TestLifecycleService, TestEnvironmentService, TestNotificationService, TestStorageService } from 'vs/workbench/test/workbenchTestServices';
26+
import { TestTextResourceConfigurationService, TestContextService, TestLifecycleService, TestEnvironmentService, TestStorageService } from 'vs/workbench/test/workbenchTestServices';
27+
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
2728
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
2829
import URI from 'vs/base/common/uri';
2930
import { testWorkspace } from 'vs/platform/workspace/test/common/testWorkspace';

src/vs/workbench/services/backup/test/electron-browser/backupFileService.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import Uri from 'vs/base/common/uri';
1616
import { BackupFileService, BackupFilesModel } from 'vs/workbench/services/backup/node/backupFileService';
1717
import { FileService } from 'vs/workbench/services/files/electron-browser/fileService';
1818
import { TextModel, createTextBufferFactory } from 'vs/editor/common/model/textModel';
19-
import { TestContextService, TestTextResourceConfigurationService, getRandomTestPath, TestLifecycleService, TestEnvironmentService, TestNotificationService, TestStorageService } from 'vs/workbench/test/workbenchTestServices';
19+
import { TestContextService, TestTextResourceConfigurationService, getRandomTestPath, TestLifecycleService, TestEnvironmentService, TestStorageService } from 'vs/workbench/test/workbenchTestServices';
20+
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
2021
import { Workspace, toWorkspaceFolders } from 'vs/platform/workspace/common/workspace';
2122
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
2223
import { DefaultEndOfLine } from 'vs/editor/common/model';

src/vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import { parseArgs } from 'vs/platform/environment/node/argv';
1818
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
1919
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
2020
import * as extfs from 'vs/base/node/extfs';
21-
import { TestTextFileService, TestTextResourceConfigurationService, workbenchInstantiationService, TestLifecycleService, TestEnvironmentService, TestStorageService, TestNotificationService } from 'vs/workbench/test/workbenchTestServices';
21+
import { TestTextFileService, TestTextResourceConfigurationService, workbenchInstantiationService, TestLifecycleService, TestEnvironmentService, TestStorageService } from 'vs/workbench/test/workbenchTestServices';
22+
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
2223
import * as uuid from 'vs/base/common/uuid';
2324
import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry';
2425
import { WorkspaceService } from 'vs/workbench/services/configuration/node/configurationService';

src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ import { ConfigurationEditingErrorCode } from 'vs/workbench/services/configurati
2424
import { IFileService } from 'vs/platform/files/common/files';
2525
import { IWorkspaceContextService, WorkbenchState, IWorkspaceFoldersChangeEvent } from 'vs/platform/workspace/common/workspace';
2626
import { ConfigurationTarget, IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
27-
import { workbenchInstantiationService, TestTextResourceConfigurationService, TestTextFileService, TestLifecycleService, TestEnvironmentService, TestStorageService, TestNotificationService } from 'vs/workbench/test/workbenchTestServices';
27+
import { workbenchInstantiationService, TestTextResourceConfigurationService, TestTextFileService, TestLifecycleService, TestEnvironmentService, TestStorageService } from 'vs/workbench/test/workbenchTestServices';
28+
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
2829
import { FileService } from 'vs/workbench/services/files/electron-browser/fileService';
2930
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
3031
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';

src/vs/workbench/services/files/test/electron-browser/fileService.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import * as uuid from 'vs/base/common/uuid';
1818
import * as pfs from 'vs/base/node/pfs';
1919
import * as encodingLib from 'vs/base/node/encoding';
2020
import * as utils from 'vs/workbench/services/files/test/electron-browser/utils';
21-
import { TestEnvironmentService, TestContextService, TestTextResourceConfigurationService, getRandomTestPath, TestLifecycleService, TestNotificationService, TestStorageService } from 'vs/workbench/test/workbenchTestServices';
21+
import { TestEnvironmentService, TestContextService, TestTextResourceConfigurationService, getRandomTestPath, TestLifecycleService, TestStorageService } from 'vs/workbench/test/workbenchTestServices';
22+
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
2223
import { Workspace, toWorkspaceFolders } from 'vs/platform/workspace/common/workspace';
2324
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
2425
import { TextModel } from 'vs/editor/common/model/textModel';

src/vs/workbench/services/keybinding/test/electron-browser/keybindingEditing.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import { TPromise } from 'vs/base/common/winjs.base';
1616
import { KeyCode, SimpleKeybinding, ChordKeybinding } from 'vs/base/common/keyCodes';
1717
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
1818
import * as extfs from 'vs/base/node/extfs';
19-
import { TestTextFileService, TestEditorGroupService, TestLifecycleService, TestBackupFileService, TestContextService, TestTextResourceConfigurationService, TestHashService, TestEnvironmentService, TestStorageService, TestNotificationService } from 'vs/workbench/test/workbenchTestServices';
19+
import { TestTextFileService, TestEditorGroupService, TestLifecycleService, TestBackupFileService, TestContextService, TestTextResourceConfigurationService, TestHashService, TestEnvironmentService, TestStorageService } from 'vs/workbench/test/workbenchTestServices';
20+
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
2021
import { IWorkspaceContextService, Workspace, toWorkspaceFolders } from 'vs/platform/workspace/common/workspace';
2122
import * as uuid from 'vs/base/common/uuid';
2223
import { ConfigurationService } from 'vs/platform/configuration/node/configurationService';

src/vs/workbench/test/workbenchTestServices.ts

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKe
6363
import { ITextBufferFactory, DefaultEndOfLine, EndOfLinePreference } from 'vs/editor/common/model';
6464
import { Range } from 'vs/editor/common/core/range';
6565
import { IConfirmation, IConfirmationResult, IDialogService, IDialogOptions } from 'vs/platform/dialogs/common/dialogs';
66-
import { INotificationService, INotificationHandle, INotification, NoOpNotification, IPromptChoice } from 'vs/platform/notification/common/notification';
66+
import { INotificationService } from 'vs/platform/notification/common/notification';
67+
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
6768

6869
export function createFileInput(instantiationService: IInstantiationService, resource: URI): FileEditorInput {
6970
return instantiationService.createInstance(FileEditorInput, resource, void 0);
@@ -306,33 +307,6 @@ export class TestHistoryService implements IHistoryService {
306307
}
307308
}
308309

309-
export class TestNotificationService implements INotificationService {
310-
311-
public _serviceBrand: any;
312-
313-
private static readonly NO_OP: INotificationHandle = new NoOpNotification();
314-
315-
public info(message: string): INotificationHandle {
316-
return this.notify({ severity: Severity.Info, message });
317-
}
318-
319-
public warn(message: string): INotificationHandle {
320-
return this.notify({ severity: Severity.Warning, message });
321-
}
322-
323-
public error(error: string | Error): INotificationHandle {
324-
return this.notify({ severity: Severity.Error, message: error });
325-
}
326-
327-
public notify(notification: INotification): INotificationHandle {
328-
return TestNotificationService.NO_OP;
329-
}
330-
331-
public prompt(severity: Severity, message: string, choices: IPromptChoice[], onCancel?: () => void): INotificationHandle {
332-
return TestNotificationService.NO_OP;
333-
}
334-
}
335-
336310
export class TestDialogService implements IDialogService {
337311

338312
public _serviceBrand: any;

0 commit comments

Comments
 (0)