Skip to content

Commit fa721bc

Browse files
committed
Migrate web bridge test app to use extra path
1 parent a8a06a2 commit fa721bc

File tree

2 files changed

+20
-28
lines changed

2 files changed

+20
-28
lines changed

AdjustTests/AdjustWebBridgeTestApp/AdjustWebBridgeTestApp/TestLibraryBridge.js

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ var TestLibraryBridge = {
3535
var AdjustCommandExecutor = function(baseUrl, gdprUrl) {
3636
this.baseUrl = baseUrl;
3737
this.gdprUrl = gdprUrl;
38-
this.basePath = null;
39-
this.gdprPath = null;
38+
this.extraPath = null;
4039
this.savedEvents = {};
4140
this.savedConfigs = {};
4241
this.savedCommands = [];
@@ -50,8 +49,7 @@ AdjustCommandExecutor.prototype.testOptions = function(params) {
5049
var TestOptions = function() {
5150
this.baseUrl = null;
5251
this.gdprUrl = null;
53-
this.basePath = null;
54-
this.gdprPath = null;
52+
this.extraPath = null;
5553
this.timerIntervalInMilliseconds = null;
5654
this.timerStartInMilliseconds = null;
5755
this.sessionIntervalInMilliseconds = null;
@@ -67,10 +65,7 @@ AdjustCommandExecutor.prototype.testOptions = function(params) {
6765
testOptions.gdprUrl = this.gdprUrl;
6866

6967
if ('basePath' in params) {
70-
var basePath = getFirstValue(params, 'basePath');
71-
console.log('TestLibraryBridge hasOwnProperty basePath, first: ' + basePath);
72-
this.basePath = basePath;
73-
this.gdprPath = basePath;
68+
this.extraPath = getFirstValue(params, 'basePath');
7469
}
7570
if ('timerInterval' in params) {
7671
testOptions.timerIntervalInMilliseconds = getFirstValue(params, 'timerInterval');
@@ -106,8 +101,7 @@ AdjustCommandExecutor.prototype.testOptions = function(params) {
106101
switch(teardownOption) {
107102
case 'resetSdk':
108103
testOptions.teardown = true;
109-
testOptions.basePath = this.basePath;
110-
testOptions.gdprPath = this.gdprPath;
104+
testOptions.extraPath = this.extraPath;
111105
break;
112106
case 'deleteState':
113107
testOptions.deleteState = true;
@@ -122,15 +116,13 @@ AdjustCommandExecutor.prototype.testOptions = function(params) {
122116
break;
123117
case 'sdk':
124118
testOptions.teardown = true;
125-
testOptions.basePath = null;
126-
testOptions.gdprPath = null;
119+
testOptions.extraPath = null;
127120
break;
128121
case 'test':
129122
// TODO: null configs
130123
// TODO: null events
131124
// TODO: null delegate
132-
this.basePath = null;
133-
this.gdprPath = null;
125+
this.extraPath = null;
134126
testOptions.timerIntervalInMilliseconds = -1;
135127
testOptions.timerStartInMilliseconds = -1;
136128
testOptions.sessionIntervalInMilliseconds = -1;
@@ -260,7 +252,7 @@ AdjustCommandExecutor.prototype.config = function(params) {
260252

261253
if ('attributionCallbackSendAll' in params) {
262254
console.log('AdjustCommandExecutor.prototype.config attributionCallbackSendAll');
263-
var basePath = this.basePath;
255+
var extraPath = this.extraPath;
264256
adjustConfig.setAttributionCallback(
265257
function(attribution) {
266258
console.log('attributionCallback: ' + JSON.stringify(attribution));
@@ -272,29 +264,29 @@ AdjustCommandExecutor.prototype.config = function(params) {
272264
addInfoToSend('creative', attribution.creative);
273265
addInfoToSend('clickLabel', attribution.click_label);
274266
addInfoToSend('adid', attribution.adid);
275-
WebViewJavascriptBridge.callHandler('adjustTLB_sendInfoToServer', basePath, null);
267+
WebViewJavascriptBridge.callHandler('adjustTLB_sendInfoToServer', extraPath, null);
276268
}
277269
);
278270
}
279271

280272
if ('sessionCallbackSendSuccess' in params) {
281273
console.log('AdjustCommandExecutor.prototype.config sessionCallbackSendSuccess');
282-
var basePath = this.basePath;
274+
var extraPath = this.extraPath;
283275
adjustConfig.setSessionSuccessCallback(
284276
function(sessionSuccessResponseData) {
285277
console.log('sessionSuccessCallback: ' + JSON.stringify(sessionSuccessResponseData));
286278
addInfoToSend('message', sessionSuccessResponseData.message);
287279
addInfoToSend('timestamp', sessionSuccessResponseData.timestamp);
288280
addInfoToSend('adid', sessionSuccessResponseData.adid);
289281
addInfoToSend('jsonResponse', sessionSuccessResponseData.jsonResponse);
290-
WebViewJavascriptBridge.callHandler('adjustTLB_sendInfoToServer', basePath, null);
282+
WebViewJavascriptBridge.callHandler('adjustTLB_sendInfoToServer', extraPath, null);
291283
}
292284
);
293285
}
294286

295287
if ('sessionCallbackSendFailure' in params) {
296288
console.log('AdjustCommandExecutor.prototype.config sessionCallbackSendFailure');
297-
var basePath = this.basePath;
289+
var extraPath = this.extraPath;
298290
adjustConfig.setSessionFailureCallback(
299291
function(sessionFailureResponseData) {
300292
console.log('sessionFailureCallback: ' + JSON.stringify(sessionFailureResponseData));
@@ -303,14 +295,14 @@ AdjustCommandExecutor.prototype.config = function(params) {
303295
addInfoToSend('adid', sessionFailureResponseData.adid);
304296
addInfoToSend('willRetry', sessionFailureResponseData.willRetry ? 'true' : 'false');
305297
addInfoToSend('jsonResponse', sessionFailureResponseData.jsonResponse);
306-
WebViewJavascriptBridge.callHandler('adjustTLB_sendInfoToServer', basePath, null);
298+
WebViewJavascriptBridge.callHandler('adjustTLB_sendInfoToServer', extraPath, null);
307299
}
308300
);
309301
}
310302

311303
if ('eventCallbackSendSuccess' in params) {
312304
console.log('AdjustCommandExecutor.prototype.config eventCallbackSendSuccess');
313-
var basePath = this.basePath;
305+
var extraPath = this.extraPath;
314306
adjustConfig.setEventSuccessCallback(
315307
function(eventSuccessResponseData) {
316308
console.log('eventSuccessCallback: ' + JSON.stringify(eventSuccessResponseData));
@@ -320,14 +312,14 @@ AdjustCommandExecutor.prototype.config = function(params) {
320312
addInfoToSend('eventToken', eventSuccessResponseData.eventToken);
321313
addInfoToSend('callbackId', eventSuccessResponseData.callbackId);
322314
addInfoToSend('jsonResponse', eventSuccessResponseData.jsonResponse);
323-
WebViewJavascriptBridge.callHandler('adjustTLB_sendInfoToServer', basePath, null);
315+
WebViewJavascriptBridge.callHandler('adjustTLB_sendInfoToServer', extraPath, null);
324316
}
325317
);
326318
}
327319

328320
if ('eventCallbackSendFailure' in params) {
329321
console.log('AdjustCommandExecutor.prototype.config eventCallbackSendFailure');
330-
var basePath = this.basePath;
322+
var extraPath = this.extraPath;
331323
adjustConfig.setEventFailureCallback(
332324
function(eventFailureResponseData) {
333325
console.log('eventFailureCallback: ' + JSON.stringify(eventFailureResponseData));
@@ -338,7 +330,7 @@ AdjustCommandExecutor.prototype.config = function(params) {
338330
addInfoToSend('callbackId', eventFailureResponseData.callbackId);
339331
addInfoToSend('willRetry', eventFailureResponseData.willRetry ? 'true' : 'false');
340332
addInfoToSend('jsonResponse', eventFailureResponseData.jsonResponse);
341-
WebViewJavascriptBridge.callHandler('adjustTLB_sendInfoToServer', basePath, null);
333+
WebViewJavascriptBridge.callHandler('adjustTLB_sendInfoToServer', extraPath, null);
342334
}
343335
);
344336
}
@@ -352,12 +344,12 @@ AdjustCommandExecutor.prototype.config = function(params) {
352344
if (shouldOpenDeeplinkS === 'false') {
353345
adjustConfig.setOpenDeferredDeeplink(false);
354346
}
355-
var basePath = this.basePath;
347+
var extraPath = this.extraPath;
356348
adjustConfig.setDeferredDeeplinkCallback(
357349
function(deeplink) {
358350
console.log('deferredDeeplinkCallback: ' + JSON.stringify(deeplink));
359351
addInfoToSend('deeplink', deeplink);
360-
WebViewJavascriptBridge.callHandler('adjustTLB_sendInfoToServer', basePath, null);
352+
WebViewJavascriptBridge.callHandler('adjustTLB_sendInfoToServer', extraPath, null);
361353
}
362354
);
363355
}

AdjustTests/AdjustWebBridgeTestApp/AdjustWebBridgeTestApp/TestLibraryBridge.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ - (id)initWithAdjustBridgeRegister:(AdjustBridgeRegister *)adjustBridgeRegister
4949
return;
5050
}
5151

52-
NSString *basePath = (NSString *)data;
53-
[self.testLibrary sendInfoToServer:basePath];
52+
NSString *extraPath = (NSString *)data;
53+
[self.testLibrary sendInfoToServer:extraPath];
5454
}];
5555

5656
self.adjustBridgeRegister = adjustBridgeRegister;

0 commit comments

Comments
 (0)