Port VS Code telemetry opt-in dialog (#1130)

This commit is contained in:
Karl Burtram
2018-04-11 15:47:34 -07:00
committed by GitHub
parent ed10f984b6
commit cd0210c88a
22 changed files with 240 additions and 107 deletions

View File

@@ -96,11 +96,11 @@ suite('Notifications', () => {
assert.equal(called, 1);
called = 0;
item1.onDidDispose(() => {
item1.onDidClose(() => {
called++;
});
item1.dispose();
item1.close();
assert.equal(called, 1);
// Error with Action
@@ -157,11 +157,11 @@ suite('Notifications', () => {
assert.equal(model.notifications.length, 3);
let called = 0;
item1Handle.onDidDispose(() => {
item1Handle.onDidClose(() => {
called++;
});
item1Handle.dispose();
item1Handle.close();
assert.equal(called, 1);
assert.equal(model.notifications.length, 2);
assert.equal(lastEvent.item.severity, item1.severity);
@@ -176,7 +176,7 @@ suite('Notifications', () => {
assert.equal(lastEvent.index, 0);
assert.equal(lastEvent.kind, NotificationChangeType.ADD);
item2Handle.dispose();
item2Handle.close();
assert.equal(model.notifications.length, 1);
assert.equal(lastEvent.item.severity, item2Duplicate.severity);
assert.equal(lastEvent.item.message.value, item2Duplicate.message);

View File

@@ -9,7 +9,7 @@ import * as assert from 'assert';
import { MainThreadMessageService } from 'vs/workbench/api/electron-browser/mainThreadMessageService';
import { TPromise as Promise, TPromise } from 'vs/base/common/winjs.base';
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
import { INotificationService, INotification, NoOpNotification, INotificationHandle } from 'vs/platform/notification/common/notification';
import { INotificationService, INotification, NoOpNotification, INotificationHandle, IPromptChoice, Severity } from 'vs/platform/notification/common/notification';
import { ICommandService } from 'vs/platform/commands/common/commands';
const emptyChoiceService = new class implements IChoiceService {
@@ -41,6 +41,9 @@ const emptyNotificationService = new class implements INotificationService {
error(...args: any[]): never {
throw new Error('not implemented');
}
prompt(severity: Severity, message: string, choices: IPromptChoice[], onCancel?: () => void): INotificationHandle {
throw new Error('not implemented');
}
};
class EmptyNotificationService implements INotificationService {
@@ -64,6 +67,9 @@ class EmptyNotificationService implements INotificationService {
error(message: any): void {
throw new Error('Method not implemented.');
}
prompt(severity: Severity, message: string, choices: IPromptChoice[], onCancel?: () => void): INotificationHandle {
throw new Error('not implemented');
}
}
suite('ExtHostMessageService', function () {

View File

@@ -63,7 +63,7 @@ import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKe
import { ITextBufferFactory, DefaultEndOfLine, EndOfLinePreference } from 'vs/editor/common/model';
import { Range } from 'vs/editor/common/core/range';
import { IChoiceService, IConfirmation, IConfirmationResult, IConfirmationService } from 'vs/platform/dialogs/common/dialogs';
import { INotificationService, INotificationHandle, INotification, NoOpNotification } from 'vs/platform/notification/common/notification';
import { INotificationService, INotificationHandle, INotification, NoOpNotification, IPromptChoice } from 'vs/platform/notification/common/notification';
export function createFileInput(instantiationService: IInstantiationService, resource: URI): FileEditorInput {
return instantiationService.createInstance(FileEditorInput, resource, void 0);
@@ -331,6 +331,10 @@ export class TestNotificationService implements INotificationService {
public notify(notification: INotification): INotificationHandle {
return TestNotificationService.NO_OP;
}
public prompt(severity: Severity, message: string, choices: IPromptChoice[], onCancel?: () => void): INotificationHandle {
return TestNotificationService.NO_OP;
}
}
export class TestConfirmationService implements IConfirmationService {