@@ -21,11 +21,13 @@ import { getGalleryExtensionId } from 'vs/platform/extensionManagement/common/ex
21
21
import { ExtensionsDownloader } from 'vs/platform/extensionManagement/node/extensionDownloader' ;
22
22
import { ExtensionsScanner , InstallGalleryExtensionTask } from 'vs/platform/extensionManagement/node/extensionManagementService' ;
23
23
import { IExtensionSignatureVerificationService } from 'vs/platform/extensionManagement/node/extensionSignatureVerificationService' ;
24
+ import { TargetPlatform } from 'vs/platform/extensions/common/extensions' ;
24
25
import { IFileService } from 'vs/platform/files/common/files' ;
25
26
import { FileService } from 'vs/platform/files/common/fileService' ;
26
27
import { InMemoryFileSystemProvider } from 'vs/platform/files/common/inMemoryFilesystemProvider' ;
27
28
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock' ;
28
29
import { ILogService , NullLogService } from 'vs/platform/log/common/log' ;
30
+ import { IProductService } from 'vs/platform/product/common/productService' ;
29
31
30
32
const ROOT = URI . file ( 'tests' ) . with ( { scheme : 'vscode-tests' } ) ;
31
33
@@ -86,8 +88,17 @@ suite('InstallGalleryExtensionTask Tests', () => {
86
88
87
89
teardown ( ( ) => disposables . clear ( ) ) ;
88
90
89
- test ( 'if verification is disabled by default, the task skips verification' , async ( ) => {
90
- const testObject = new TestInstallGalleryExtensionTask ( aGalleryExtension ( 'a' , { isSigned : true } ) , anExtensionsDownloader ( 'error' ) ) ;
91
+ test ( 'if verification is enabled by default, the task completes' , async ( ) => {
92
+ const testObject = new TestInstallGalleryExtensionTask ( aGalleryExtension ( 'a' , { isSigned : true } ) , anExtensionsDownloader ( true ) ) ;
93
+
94
+ await testObject . run ( ) ;
95
+
96
+ assert . strictEqual ( testObject . wasVerified , true ) ;
97
+ assert . strictEqual ( testObject . installed , true ) ;
98
+ } ) ;
99
+
100
+ test ( 'if verification is disabled in stable, the task completes' , async ( ) => {
101
+ const testObject = new TestInstallGalleryExtensionTask ( aGalleryExtension ( 'a' , { isSigned : true } ) , anExtensionsDownloader ( 'error' , undefined , 'stable' ) ) ;
91
102
92
103
await testObject . run ( ) ;
93
104
@@ -160,13 +171,14 @@ suite('InstallGalleryExtensionTask Tests', () => {
160
171
assert . strictEqual ( testObject . installed , true ) ;
161
172
} ) ;
162
173
163
- function anExtensionsDownloader ( verificationResult : string | boolean , isSignatureVerificationEnabled ?: boolean ) : ExtensionsDownloader {
174
+ function anExtensionsDownloader ( verificationResult : string | boolean , isSignatureVerificationEnabled ?: boolean , quality ?: string ) : ExtensionsDownloader {
164
175
const logService = new NullLogService ( ) ;
165
176
const fileService = disposables . add ( new FileService ( logService ) ) ;
166
177
const fileSystemProvider = disposables . add ( new InMemoryFileSystemProvider ( ) ) ;
167
178
fileService . registerProvider ( ROOT . scheme , fileSystemProvider ) ;
168
179
169
180
const instantiationService = new TestInstantiationService ( ) ;
181
+ instantiationService . stub ( IProductService , { quality : quality ?? 'insiders' } ) ;
170
182
instantiationService . stub ( IFileService , fileService ) ;
171
183
instantiationService . stub ( ILogService , logService ) ;
172
184
instantiationService . stub ( INativeEnvironmentService , < Partial < INativeEnvironmentService > > { extensionsDownloadLocation : joinPath ( ROOT , 'CachedExtensionVSIXs' ) } ) ;
@@ -180,7 +192,7 @@ suite('InstallGalleryExtensionTask Tests', () => {
180
192
} ) ;
181
193
instantiationService . stub ( IConfigurationService , new TestConfigurationService ( isBoolean ( isSignatureVerificationEnabled ) ? { extensions : { verifySignature : isSignatureVerificationEnabled } } : undefined ) ) ;
182
194
instantiationService . stub ( IExtensionSignatureVerificationService , new TestExtensionSignatureVerificationService ( verificationResult ) ) ;
183
- return instantiationService . createInstance ( ExtensionsDownloader ) ;
195
+ return instantiationService . createInstance ( ExtensionsDownloader , Promise . resolve ( TargetPlatform . LINUX_X64 ) ) ;
184
196
}
185
197
186
198
function aGalleryExtension ( name : string , properties : Partial < IGalleryExtension > = { } , galleryExtensionProperties : any = { } , assets : Partial < IGalleryExtensionAssets > = { } ) : IGalleryExtension {
0 commit comments