mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 10:12:34 -05:00
Refresh master with initial release/0.24 snapshot (#332)
* Initial port of release/0.24 source code * Fix additional headers * Fix a typo in launch.json
This commit is contained in:
@@ -7,16 +7,17 @@
|
||||
|
||||
import 'vs/workbench/parts/search/browser/search.contribution'; // load contributions
|
||||
import * as assert from 'assert';
|
||||
import { IWorkspaceContextService, LegacyWorkspace } from 'vs/platform/workspace/common/workspace';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { createSyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { ISearchService } from 'vs/platform/search/common/search';
|
||||
import { ITelemetryService, ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IExperimentService, IExperiments } from 'vs/platform/telemetry/common/experiments';
|
||||
import { IUntitledEditorService, UntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import * as minimist from 'minimist';
|
||||
import * as path from 'path';
|
||||
import { QuickOpenHandler, IQuickOpenRegistry, Extensions } from 'vs/workbench/browser/quickopen';
|
||||
import { IQuickOpenRegistry, Extensions } from 'vs/workbench/browser/quickopen';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { SearchService } from 'vs/workbench/services/search/node/searchService';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
@@ -29,6 +30,7 @@ import { SimpleConfigurationService } from 'vs/editor/standalone/browser/simpleS
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { testWorkspace } from 'vs/platform/workspace/test/common/testWorkspace';
|
||||
|
||||
namespace Timer {
|
||||
export interface ITimerEvent {
|
||||
@@ -56,7 +58,7 @@ suite('QuickOpen performance (integration)', () => {
|
||||
|
||||
test('Measure', () => {
|
||||
if (process.env['VSCODE_PID']) {
|
||||
return; // TODO@Christoph find out why test fails when run from within VS Code
|
||||
return void 0; // TODO@Christoph find out why test fails when run from within VS Code
|
||||
}
|
||||
|
||||
const n = 3;
|
||||
@@ -66,12 +68,14 @@ suite('QuickOpen performance (integration)', () => {
|
||||
const testWorkspacePath = testWorkspaceArg ? path.resolve(testWorkspaceArg) : __dirname;
|
||||
|
||||
const telemetryService = new TestTelemetryService();
|
||||
const experimentService = new TestExperimentService();
|
||||
const configurationService = new SimpleConfigurationService();
|
||||
const instantiationService = new InstantiationService(new ServiceCollection(
|
||||
[ITelemetryService, telemetryService],
|
||||
[IExperimentService, experimentService],
|
||||
[IConfigurationService, configurationService],
|
||||
[IModelService, new ModelServiceImpl(null, configurationService)],
|
||||
[IWorkspaceContextService, new TestContextService(new LegacyWorkspace(URI.file(testWorkspacePath)))],
|
||||
[IWorkspaceContextService, new TestContextService(testWorkspace(URI.file(testWorkspacePath)))],
|
||||
[IWorkbenchEditorService, new TestEditorService()],
|
||||
[IEditorGroupService, new TestEditorGroupService()],
|
||||
[IEnvironmentService, TestEnvironmentService],
|
||||
@@ -84,35 +88,33 @@ suite('QuickOpen performance (integration)', () => {
|
||||
assert.ok(descriptor);
|
||||
|
||||
function measure() {
|
||||
return instantiationService.createInstance(descriptor)
|
||||
.then((handler: QuickOpenHandler) => {
|
||||
handler.onOpen();
|
||||
return handler.getResults('a').then(result => {
|
||||
const uncachedEvent = popEvent();
|
||||
assert.strictEqual(uncachedEvent.data.symbols.fromCache, false, 'symbols.fromCache');
|
||||
assert.strictEqual(uncachedEvent.data.files.fromCache, true, 'files.fromCache');
|
||||
if (testWorkspaceArg) {
|
||||
assert.ok(!!uncachedEvent.data.files.joined, 'files.joined');
|
||||
}
|
||||
return uncachedEvent;
|
||||
}).then(uncachedEvent => {
|
||||
return handler.getResults('ab').then(result => {
|
||||
const cachedEvent = popEvent();
|
||||
assert.strictEqual(uncachedEvent.data.symbols.fromCache, false, 'symbols.fromCache');
|
||||
assert.ok(cachedEvent.data.files.fromCache, 'filesFromCache');
|
||||
handler.onClose(false);
|
||||
return [uncachedEvent, cachedEvent];
|
||||
});
|
||||
});
|
||||
const handler = descriptor.instantiate(instantiationService);
|
||||
handler.onOpen();
|
||||
return handler.getResults('a').then(result => {
|
||||
const uncachedEvent = popEvent();
|
||||
assert.strictEqual(uncachedEvent.data.symbols.fromCache, false, 'symbols.fromCache');
|
||||
assert.strictEqual(uncachedEvent.data.files.fromCache, true, 'files.fromCache');
|
||||
if (testWorkspaceArg) {
|
||||
assert.ok(!!uncachedEvent.data.files.joined, 'files.joined');
|
||||
}
|
||||
return uncachedEvent;
|
||||
}).then(uncachedEvent => {
|
||||
return handler.getResults('ab').then(result => {
|
||||
const cachedEvent = popEvent();
|
||||
assert.strictEqual(uncachedEvent.data.symbols.fromCache, false, 'symbols.fromCache');
|
||||
assert.ok(cachedEvent.data.files.fromCache, 'filesFromCache');
|
||||
handler.onClose(false);
|
||||
return [uncachedEvent, cachedEvent];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function popEvent() {
|
||||
const events = telemetryService.events;
|
||||
const events = telemetryService.events
|
||||
.filter(event => event.name === 'openAnything');
|
||||
assert.strictEqual(events.length, 1);
|
||||
const event = events[0];
|
||||
events.length = 0;
|
||||
assert.strictEqual(event.name, 'openAnything');
|
||||
telemetryService.events.length = 0;
|
||||
return event;
|
||||
}
|
||||
|
||||
@@ -177,3 +179,12 @@ class TestTelemetryService implements ITelemetryService {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
class TestExperimentService implements IExperimentService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
getExperiments(): IExperiments {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user