@@ -39,6 +39,7 @@ import { FileService } from 'vs/platform/files/common/fileService';
39
39
import { NullLogService } from 'vs/platform/log/common/log' ;
40
40
import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider' ;
41
41
import { ConfigurationCache } from 'vs/workbench/services/configuration/node/configurationCache' ;
42
+ import { ConfigurationCache as BrowserConfigurationCache } from 'vs/workbench/services/configuration/browser/configurationCache' ;
42
43
import { IRemoteAgentEnvironment } from 'vs/platform/remote/common/remoteAgentEnvironment' ;
43
44
import { IConfigurationCache } from 'vs/workbench/services/configuration/common/configuration' ;
44
45
import { SignService } from 'vs/platform/sign/browser/signService' ;
@@ -50,6 +51,7 @@ import { timeout } from 'vs/base/common/async';
50
51
import { VSBuffer } from 'vs/base/common/buffer' ;
51
52
import { DisposableStore } from 'vs/base/common/lifecycle' ;
52
53
import product from 'vs/platform/product/common/product' ;
54
+ import { BrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService' ;
53
55
54
56
class TestEnvironmentService extends NativeWorkbenchEnvironmentService {
55
57
@@ -2059,6 +2061,46 @@ suite('WorkspaceConfigurationService - Remote Folder', () => {
2059
2061
2060
2062
} ) ;
2061
2063
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
+
2062
2104
function getWorkspaceId ( configPath : URI ) : string {
2063
2105
let workspaceConfigPath = configPath . scheme === Schemas . file ? originalFSPath ( configPath ) : configPath . toString ( ) ;
2064
2106
if ( ! isLinux ) {
0 commit comments