@@ -39,6 +39,7 @@ import { FileService } from 'vs/platform/files/common/fileService';
3939import { NullLogService } from 'vs/platform/log/common/log' ;
4040import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider' ;
4141import { ConfigurationCache } from 'vs/workbench/services/configuration/node/configurationCache' ;
42+ import { ConfigurationCache as BrowserConfigurationCache } from 'vs/workbench/services/configuration/browser/configurationCache' ;
4243import { IRemoteAgentEnvironment } from 'vs/platform/remote/common/remoteAgentEnvironment' ;
4344import { IConfigurationCache } from 'vs/workbench/services/configuration/common/configuration' ;
4445import { SignService } from 'vs/platform/sign/browser/signService' ;
@@ -50,6 +51,7 @@ import { timeout } from 'vs/base/common/async';
5051import { VSBuffer } from 'vs/base/common/buffer' ;
5152import { DisposableStore } from 'vs/base/common/lifecycle' ;
5253import product from 'vs/platform/product/common/product' ;
54+ import { BrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService' ;
5355
5456class TestEnvironmentService extends NativeWorkbenchEnvironmentService {
5557
@@ -2059,6 +2061,46 @@ suite('WorkspaceConfigurationService - Remote Folder', () => {
20592061
20602062} ) ;
20612063
2064+ suite ( 'ConfigurationService - Configuration Defaults' , ( ) => {
2065+
2066+ const disposableStore : DisposableStore = new DisposableStore ( ) ;
2067+
2068+ suiteSetup ( ( ) => {
2069+ Registry . as < IConfigurationRegistry > ( ConfigurationExtensions . Configuration ) . registerConfiguration ( {
2070+ 'id' : '_test' ,
2071+ 'type' : 'object' ,
2072+ 'properties' : {
2073+ 'configurationService.defaultOverridesSetting' : {
2074+ 'type' : 'string' ,
2075+ 'default' : 'isSet' ,
2076+ } ,
2077+ }
2078+ } ) ;
2079+ } ) ;
2080+
2081+ teardown ( ( ) => {
2082+ disposableStore . clear ( ) ;
2083+ } ) ;
2084+
2085+ test ( 'when default value is not overriden' , ( ) => {
2086+ const testObject = createConfiurationService ( { } ) ;
2087+ assert . deepEqual ( testObject . getValue ( 'configurationService.defaultOverridesSetting' ) , 'isSet' ) ;
2088+ } ) ;
2089+
2090+ test ( 'when default value is overriden' , ( ) => {
2091+ const testObject = createConfiurationService ( { 'configurationService.defaultOverridesSetting' : 'overriddenValue' } ) ;
2092+ assert . deepEqual ( testObject . getValue ( 'configurationService.defaultOverridesSetting' ) , 'overriddenValue' ) ;
2093+ } ) ;
2094+
2095+ function createConfiurationService ( configurationDefaults : Record < string , any > ) : IConfigurationService {
2096+ const remoteAgentService = ( < TestInstantiationService > workbenchInstantiationService ( ) ) . createInstance ( RemoteAgentService ) ;
2097+ const environmentService = new BrowserWorkbenchEnvironmentService ( { logsPath : URI . file ( '' ) , workspaceId : '' , configurationDefaults } ) ;
2098+ const fileService = new FileService ( new NullLogService ( ) ) ;
2099+ return disposableStore . add ( new WorkspaceService ( { configurationCache : new BrowserConfigurationCache ( ) } , environmentService , fileService , remoteAgentService ) ) ;
2100+ }
2101+
2102+ } ) ;
2103+
20622104function getWorkspaceId ( configPath : URI ) : string {
20632105 let workspaceConfigPath = configPath . scheme === Schemas . file ? originalFSPath ( configPath ) : configPath . toString ( ) ;
20642106 if ( ! isLinux ) {
0 commit comments