Merge from vscode fc10e26ea50f82cdd84e9141491357922e6f5fba (#4639)

This commit is contained in:
Anthony Dresser
2019-03-21 10:58:16 -07:00
committed by GitHub
parent 8298db7d13
commit b65ee5b42e
149 changed files with 1408 additions and 814 deletions

View File

@@ -24,7 +24,7 @@ import { TestConfigurationService } from 'vs/platform/configuration/test/common/
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import { assign } from 'vs/base/common/objects';
import { URI } from 'vs/base/common/uri';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { lastSessionDateStorageKey } from 'vs/platform/telemetry/node/workbenchCommonProperties';
import { getGalleryExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
import { ExtensionType } from 'vs/platform/extensions/common/extensions';
@@ -86,11 +86,11 @@ suite('Experiment Service', () => {
testConfigurationService = new TestConfigurationService();
instantiationService.stub(IConfigurationService, testConfigurationService);
instantiationService.stub(ILifecycleService, new TestLifecycleService());
instantiationService.stub(IStorageService, { get: (a, b, c) => c, getBoolean: (a, b, c) => c, store: () => { }, remove: () => { } });
instantiationService.stub(IStorageService, <Partial<IStorageService>>{ get: (a: string, b: StorageScope, c?: string) => c, getBoolean: (a: string, b: StorageScope, c?: boolean) => c, store: () => { }, remove: () => { } });
setup(() => {
instantiationService.stub(IEnvironmentService, {});
instantiationService.stub(IStorageService, { get: (a, b, c) => c, getBoolean: (a, b, c) => c, store: () => { }, remove: () => { } });
instantiationService.stub(IStorageService, <Partial<IStorageService>>{ get: (a: string, b: StorageScope, c?: string) => c, getBoolean: (a: string, b: StorageScope, c?: boolean) => c, store: () => { }, remove: () => { } });
});
teardown(() => {
@@ -196,11 +196,11 @@ suite('Experiment Service', () => {
]
};
instantiationService.stub(IStorageService, {
get: (a, b, c) => {
instantiationService.stub(IStorageService, <Partial<IStorageService>>{
get: (a: string, b: StorageScope, c?: string) => {
return a === lastSessionDateStorageKey ? 'some-date' : undefined;
},
getBoolean: (a, b, c) => c, store: () => { }, remove: () => { }
getBoolean: (a: string, b: StorageScope, c?: boolean) => c, store: () => { }, remove: () => { }
});
testObject = instantiationService.createInstance(TestExperimentService);
return testObject.getExperimentById('experiment1').then(result => {
@@ -240,11 +240,11 @@ suite('Experiment Service', () => {
]
};
instantiationService.stub(IStorageService, {
get: (a, b, c) => {
instantiationService.stub(IStorageService, <Partial<IStorageService>>{
get: (a: string, b: StorageScope, c: string | undefined) => {
return a === lastSessionDateStorageKey ? 'some-date' : undefined;
},
getBoolean: (a, b, c) => c, store: () => { }, remove: () => { }
getBoolean: (a: string, b: StorageScope, c?: boolean) => c, store: () => { }, remove: () => { }
});
testObject = instantiationService.createInstance(TestExperimentService);
return testObject.getExperimentById('experiment1').then(result => {
@@ -372,9 +372,9 @@ suite('Experiment Service', () => {
]
};
instantiationService.stub(IStorageService, {
get: (a, b, c) => a === 'experiments.experiment1' ? JSON.stringify({ state: ExperimentState.Complete }) : c,
store: (a, b, c) => { }
instantiationService.stub(IStorageService, <Partial<IStorageService>>{
get: (a: string, b: StorageScope, c?: string) => a === 'experiments.experiment1' ? JSON.stringify({ state: ExperimentState.Complete }) : c,
store: () => { }
});
testObject = instantiationService.createInstance(TestExperimentService);
@@ -400,9 +400,9 @@ suite('Experiment Service', () => {
]
};
instantiationService.stub(IStorageService, {
get: (a, b, c) => a === 'experiments.experiment1' ? JSON.stringify({ enabled: true, state: ExperimentState.Run }) : c,
store: (a, b, c) => { }
instantiationService.stub(IStorageService, <Partial<IStorageService>>{
get: (a: string, b: StorageScope, c?: string) => a === 'experiments.experiment1' ? JSON.stringify({ enabled: true, state: ExperimentState.Run }) : c,
store: () => { }
});
testObject = instantiationService.createInstance(TestExperimentService);
return testObject.getExperimentById('experiment1').then(result => {
@@ -508,8 +508,8 @@ suite('Experiment Service', () => {
let storageDataExperiment1: ExperimentSettings | null = { enabled: false };
let storageDataExperiment2: ExperimentSettings | null = { enabled: false };
let storageDataAllExperiments: string[] | null = ['experiment1', 'experiment2', 'experiment3'];
instantiationService.stub(IStorageService, {
get: (a, b, c) => {
instantiationService.stub(IStorageService, <Partial<IStorageService>>{
get: (a: string, b: StorageScope, c?: string) => {
switch (a) {
case 'experiments.experiment1':
return JSON.stringify(storageDataExperiment1);
@@ -522,7 +522,7 @@ suite('Experiment Service', () => {
}
return c;
},
store: (a, b, c) => {
store: (a: string, b: any, c: StorageScope) => {
switch (a) {
case 'experiments.experiment1':
storageDataExperiment1 = JSON.parse(b);
@@ -537,7 +537,7 @@ suite('Experiment Service', () => {
break;
}
},
remove: a => {
remove: (a: string) => {
switch (a) {
case 'experiments.experiment1':
storageDataExperiment1 = null;
@@ -580,8 +580,8 @@ suite('Experiment Service', () => {
let storageDataExperiment3: ExperimentSettings | null = { enabled: true, state: ExperimentState.Evaluating };
let storageDataExperiment4: ExperimentSettings | null = { enabled: true, state: ExperimentState.Complete };
let storageDataAllExperiments: string[] | null = ['experiment1', 'experiment2', 'experiment3', 'experiment4'];
instantiationService.stub(IStorageService, {
get: (a, b, c) => {
instantiationService.stub(IStorageService, <Partial<IStorageService>>{
get: (a: string, b: StorageScope, c?: string) => {
switch (a) {
case 'experiments.experiment1':
return JSON.stringify(storageDataExperiment1);
@@ -601,19 +601,19 @@ suite('Experiment Service', () => {
store: (a, b, c) => {
switch (a) {
case 'experiments.experiment1':
storageDataExperiment1 = JSON.parse(b);
storageDataExperiment1 = JSON.parse(b + '');
break;
case 'experiments.experiment2':
storageDataExperiment2 = JSON.parse(b);
storageDataExperiment2 = JSON.parse(b + '');
break;
case 'experiments.experiment3':
storageDataExperiment3 = JSON.parse(b);
storageDataExperiment3 = JSON.parse(b + '');
break;
case 'experiments.experiment4':
storageDataExperiment4 = JSON.parse(b);
storageDataExperiment4 = JSON.parse(b + '');
break;
case 'allExperiments':
storageDataAllExperiments = JSON.parse(b);
storageDataAllExperiments = JSON.parse(b + '');
break;
default:
break;
@@ -768,8 +768,8 @@ suite('Experiment Service', () => {
let storageDataExperiment3 = { enabled: true, state: ExperimentState.Evaluating };
let storageDataExperiment4 = { enabled: true, state: ExperimentState.Evaluating };
instantiationService.stub(IStorageService, {
get: (a, b, c) => {
instantiationService.stub(IStorageService, <Partial<IStorageService>>{
get: (a: string, b: StorageScope, c?: string) => {
switch (a) {
case 'currentOrPreviouslyRunExperiments':
return JSON.stringify(['experiment1', 'experiment2']);
@@ -781,10 +781,10 @@ suite('Experiment Service', () => {
store: (a, b, c) => {
switch (a) {
case 'experiments.experiment3':
storageDataExperiment3 = JSON.parse(b);
storageDataExperiment3 = JSON.parse(b + '');
break;
case 'experiments.experiment4':
storageDataExperiment4 = JSON.parse(b);
storageDataExperiment4 = JSON.parse(b + '');
break;
default:
break;

View File

@@ -95,6 +95,7 @@ suite('Experimental Prompts', () => {
assert.equal(b, promptText);
assert.equal(c.length, 2);
c[0].run();
return undefined!;
}
});
@@ -119,6 +120,7 @@ suite('Experimental Prompts', () => {
assert.equal(b, promptText);
assert.equal(c.length, 2);
c[1].run();
return undefined!;
}
});
@@ -143,6 +145,7 @@ suite('Experimental Prompts', () => {
assert.equal(b, promptText);
assert.equal(c.length, 2);
options.onCancel();
return undefined!;
}
});