44 *--------------------------------------------------------------------------------------------*/
55import * as assert from 'assert' ;
66import { IDisposable } from 'vs/base/common/lifecycle' ;
7- import { TPromise } from 'vs/base/common/winjs.base' ;
87import { CommandsRegistry } from 'vs/platform/commands/common/commands' ;
98import { CommandService } from 'vs/workbench/services/commands/common/commandService' ;
109import { IExtensionService , ExtensionPointContribution , IExtensionDescription , ProfileSession } from 'vs/workbench/services/extensions/common/extensions' ;
@@ -21,25 +20,25 @@ class SimpleExtensionService implements IExtensionService {
2120 return this . _onDidRegisterExtensions . event ;
2221 }
2322 onDidChangeExtensionsStatus = null ;
24- activateByEvent ( activationEvent : string ) : TPromise < void > {
23+ activateByEvent ( activationEvent : string ) : Promise < void > {
2524 return this . whenInstalledExtensionsRegistered ( ) . then ( ( ) => { } ) ;
2625 }
27- whenInstalledExtensionsRegistered ( ) : TPromise < boolean > {
28- return TPromise . as ( true ) ;
26+ whenInstalledExtensionsRegistered ( ) : Promise < boolean > {
27+ return Promise . resolve ( true ) ;
2928 }
30- readExtensionPointContributions < T > ( extPoint : IExtensionPoint < T > ) : TPromise < ExtensionPointContribution < T > [ ] > {
31- return TPromise . as ( [ ] ) ;
29+ readExtensionPointContributions < T > ( extPoint : IExtensionPoint < T > ) : Promise < ExtensionPointContribution < T > [ ] > {
30+ return Promise . resolve ( [ ] ) ;
3231 }
3332 getExtensionsStatus ( ) {
3433 return undefined ;
3534 }
36- getExtensions ( ) : TPromise < IExtensionDescription [ ] > {
37- return TPromise . wrap ( [ ] ) ;
35+ getExtensions ( ) : Promise < IExtensionDescription [ ] > {
36+ return Promise . resolve ( [ ] ) ;
3837 }
3938 canProfileExtensionHost ( ) {
4039 return false ;
4140 }
42- startExtensionHostProfile ( ) : TPromise < ProfileSession > {
41+ startExtensionHostProfile ( ) : Promise < ProfileSession > {
4342 throw new Error ( 'Not implemented' ) ;
4443 }
4544 getInspectPort ( ) : number {
@@ -81,7 +80,7 @@ suite('CommandService', function () {
8180 let lastEvent : string ;
8281
8382 let service = new CommandService ( new InstantiationService ( ) , new class extends SimpleExtensionService {
84- activateByEvent ( activationEvent : string ) : TPromise < void > {
83+ activateByEvent ( activationEvent : string ) : Promise < void > {
8584 lastEvent = activationEvent ;
8685 return super . activateByEvent ( activationEvent ) ;
8786 }
@@ -97,13 +96,17 @@ suite('CommandService', function () {
9796 } ) ;
9897 } ) ;
9998
100- test ( 'fwd activation error' , function ( ) {
99+ test ( 'fwd activation error' , async function ( ) {
101100
102- let service = new CommandService ( new InstantiationService ( ) , new class extends SimpleExtensionService {
103- activateByEvent ( activationEvent : string ) : TPromise < void > {
104- return TPromise . wrapError < void > ( new Error ( 'bad_activate' ) ) ;
101+ const extensionService = new class extends SimpleExtensionService {
102+ activateByEvent ( activationEvent : string ) : Promise < void > {
103+ return Promise . reject ( new Error ( 'bad_activate' ) ) ;
105104 }
106- } , new NullLogService ( ) , progressService ) ;
105+ } ;
106+
107+ let service = new CommandService ( new InstantiationService ( ) , extensionService , new NullLogService ( ) , progressService ) ;
108+
109+ await extensionService . whenInstalledExtensionsRegistered ( ) ;
107110
108111 return service . executeCommand ( 'foo' ) . then ( ( ) => assert . ok ( false ) , err => {
109112 assert . equal ( err . message , 'bad_activate' ) ;
@@ -117,7 +120,7 @@ suite('CommandService', function () {
117120
118121 let service = new CommandService ( new InstantiationService ( ) , new class extends SimpleExtensionService {
119122 whenInstalledExtensionsRegistered ( ) {
120- return new TPromise < boolean > ( _resolve => { /*ignore*/ } ) ;
123+ return new Promise < boolean > ( _resolve => { /*ignore*/ } ) ;
121124 }
122125 } , new NullLogService ( ) , progressService ) ;
123126
@@ -130,7 +133,7 @@ suite('CommandService', function () {
130133
131134 let callCounter = 0 ;
132135 let resolveFunc : Function ;
133- const whenInstalledExtensionsRegistered = new TPromise < boolean > ( _resolve => { resolveFunc = _resolve ; } ) ;
136+ const whenInstalledExtensionsRegistered = new Promise < boolean > ( _resolve => { resolveFunc = _resolve ; } ) ;
134137
135138 let service = new CommandService ( new InstantiationService ( ) , new class extends SimpleExtensionService {
136139 whenInstalledExtensionsRegistered ( ) {
0 commit comments