@@ -21,11 +21,9 @@ import product from 'vs/platform/product/common/product';
21
21
import { IProductService } from 'vs/platform/product/common/productService' ;
22
22
import { resolveMarketplaceHeaders } from 'vs/platform/externalServices/common/marketplace' ;
23
23
import { InMemoryStorageService , IStorageService } from 'vs/platform/storage/common/storage' ;
24
- import { ITelemetryInfo , ITelemetryService , TelemetryConfiguration , TelemetryLevel , TELEMETRY_SETTING_ID } from 'vs/platform/telemetry/common/telemetry' ;
24
+ import { ITelemetryService , TelemetryConfiguration , TELEMETRY_SETTING_ID } from 'vs/platform/telemetry/common/telemetry' ;
25
25
import { TargetPlatform } from 'vs/platform/extensions/common/extensions' ;
26
- import { ClassifiedEvent , GDPRClassification , StrictPropertyCheck } from 'vs/platform/telemetry/common/gdprTypings' ;
27
- import { staticObservableValue } from 'vs/base/common/observableValue' ;
28
- import { Emitter , Event } from 'vs/base/common/event' ;
26
+ import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils' ;
29
27
30
28
class EnvironmentServiceMock extends mock < IEnvironmentService > ( ) {
31
29
override readonly serviceMachineIdResource : URI ;
@@ -51,7 +49,7 @@ suite('Extension Gallery Service', () => {
51
49
configurationService = new TestConfigurationService ( { [ TELEMETRY_SETTING_ID ] : TelemetryConfiguration . ON } ) ;
52
50
configurationService . updateValue ( TELEMETRY_SETTING_ID , TelemetryConfiguration . ON ) ;
53
51
productService = { _serviceBrand : undefined , ...product , enableTelemetry : true } ;
54
- telemetryService = new MockTelemetryService ( ) ;
52
+ telemetryService = NullTelemetryService ;
55
53
} ) ;
56
54
57
55
teardown ( ( ) => disposables . clear ( ) ) ;
@@ -158,51 +156,3 @@ suite('Extension Gallery Service', () => {
158
156
return { version, targetPlatform } as IRawGalleryExtensionVersion ;
159
157
}
160
158
} ) ;
161
-
162
- class MockTelemetryService implements ITelemetryService {
163
- public _serviceBrand : undefined ;
164
- public telemetryLevel = staticObservableValue ( TelemetryLevel . USAGE ) ;
165
- public sendErrorTelemetry = true ;
166
-
167
- public events : any [ ] = [ ] ;
168
-
169
- private readonly emitter = new Emitter < any > ( ) ;
170
-
171
- public get eventLogged ( ) : Event < any > {
172
- return this . emitter . event ;
173
- }
174
-
175
- public setEnabled ( value : boolean ) : void {
176
- }
177
-
178
- public setExperimentProperty ( name : string , value : string ) : void {
179
- }
180
-
181
- public publicLog ( eventName : string , data ?: any ) : Promise < void > {
182
- const event = { name : eventName , data : data } ;
183
- this . events . push ( event ) ;
184
- this . emitter . fire ( event ) ;
185
- return Promise . resolve ( ) ;
186
- }
187
-
188
- public publicLog2 < E extends ClassifiedEvent < T > = never , T extends GDPRClassification < T > = never > ( eventName : string , data ?: StrictPropertyCheck < T , E > ) {
189
- return this . publicLog ( eventName , data as any ) ;
190
- }
191
-
192
- public publicLogError ( eventName : string , data ?: any ) : Promise < void > {
193
- return this . publicLog ( eventName , data ) ;
194
- }
195
-
196
- public publicLogError2 < E extends ClassifiedEvent < T > = never , T extends GDPRClassification < T > = never > ( eventName : string , data ?: StrictPropertyCheck < T , E > ) {
197
- return this . publicLogError ( eventName , data as any ) ;
198
- }
199
-
200
- public getTelemetryInfo ( ) : Promise < ITelemetryInfo > {
201
- return Promise . resolve ( {
202
- instanceId : 'someValue.instanceId' ,
203
- sessionId : 'someValue.sessionId' ,
204
- machineId : 'someValue.machineId' ,
205
- firstSessionDate : 'someValue.firstSessionDate'
206
- } ) ;
207
- }
208
- }
0 commit comments