Skip to content

Commit a0e0967

Browse files
committed
revert(android): restore runtime test parity
Reverts fd62fdb so the imported Android runtime tests run as they do upstream instead of adding engine-specific gates in this monorepo refactor.
1 parent 6ba820c commit a0e0967

16 files changed

Lines changed: 73 additions & 118 deletions

platforms/android/test-app/app/src/main/assets/app/shared/Require/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
describe("TNS require", function () {
22

3-
var isHermesNodeApi = global.__engineVariant === "HERMES" || global.__engineVariant === "SHERMES";
4-
53
beforeEach(TNSClearOutput);
64
afterEach(TNSClearOutput);
75

@@ -60,7 +58,7 @@ describe("TNS require", function () {
6058
if (!global.NSObject) {
6159
it('deletes module cache on error', function () {
6260
require("./ModuleErrorCache");
63-
expect(TNSGetOutput()).toBe(isHermesNodeApi ? 'did throw0no throw' : 'did throw1no throw');
61+
expect(TNSGetOutput()).toBe('did throw1no throw');
6462
});
6563
}
6664

platforms/android/test-app/app/src/main/assets/app/shared/Workers/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const describeWorkers = (global.__engineVariant === "HERMES" || global.__engineVariant === "SHERMES" || global.__engineVariant === "JSC") ? xdescribe : describe;
2-
3-
describeWorkers("TNS Workers", () => {
1+
describe("TNS Workers", () => {
42
let expectedAliveRuntimes = 1; // Main thread's TNSRuntime
53
var originalTimeout;
64
var DEFAULT_TIMEOUT_BEFORE_ASSERT = 500;
@@ -14,7 +12,7 @@ describeWorkers("TNS Workers", () => {
1412

1513
beforeEach(() => {
1614
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
17-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; // For slower android emulators
15+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 16000; // For slower android emulators
1816
});
1917

2018
afterEach(() => {

platforms/android/test-app/app/src/main/assets/app/tests/extendedClassesTests.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
describe("Tests extended classes ", function () {
22

3-
var itUnlessHermesNodeApi = (global.__engineVariant === "HERMES" || global.__engineVariant === "SHERMES") ? xit : it;
4-
5-
itUnlessHermesNodeApi("Instance with no extension shouldn't use previously defined implementation object", function () {
3+
it("Instance with no extension shouldn't use previously defined implementation object", function () {
64
var MyButton = com.tns.tests.Button1.extend({
75
toString: function () {
86
return "overriden toString method of chronometer instance";
@@ -84,7 +82,7 @@ describe("Tests extended classes ", function () {
8482
expect(Child.extend()).toBe("expectedValue");
8583
});
8684

87-
itUnlessHermesNodeApi("Instance with extension shouldn't use previously defined implementation object", function () {
85+
it("Instance with extension shouldn't use previously defined implementation object", function () {
8886

8987
var MyButton = com.tns.tests.Button1.extend({
9088
toString: function () {
@@ -115,7 +113,7 @@ describe("Tests extended classes ", function () {
115113
expect(labelgetIMAGE_ID_PROP).not.toBe(labelgetIMAGE_ID_PROP1);
116114
});
117115

118-
itUnlessHermesNodeApi("Newly created instances should behave the same and not use previously defined implementation objects", function () {
116+
it("Newly created instances should behave the same and not use previously defined implementation objects", function () {
119117

120118
var button1 = new com.tns.tests.Button1();
121119
var labelgetIMAGE_ID_PROP1 = button1.getIMAGE_ID_PROP();
@@ -134,11 +132,11 @@ describe("Tests extended classes ", function () {
134132
expect(labelgetIMAGE_ID_PROP1).toBe(labelgetIMAGE_ID_PROP2);
135133
});
136134

137-
itUnlessHermesNodeApi("Should not crash with no exception when incorrectly calling extended class constructor", function () {
135+
it("Should not crash with no exception when incorrectly calling extended class constructor", function () {
138136
let MyObj = java.lang.Object.extend({
139137
toString: () => { return "It's MyObj" }
140138
});
141139

142140
expect(() => { myObj() }).toThrow();
143141
});
144-
});
142+
});

platforms/android/test-app/app/src/main/assets/app/tests/java-array-test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ describe("Tests instancing java arrays", function () {
133133
// expect(arr.getClass().getName()).toBe("[D");
134134
// });
135135

136-
var itUnlessJsc = global.__engineVariant === "JSC" ? xit : it;
137-
138-
itUnlessJsc("should instantiate Object array", function () {
136+
it("should instantiate Object array", function () {
139137
var len = 123;
140138
var arr = Array.create(java.lang.Object, len);
141139
expect(arr.length).toBe(len);
@@ -152,4 +150,4 @@ describe("Tests instancing java arrays", function () {
152150
// var expectedArrayClassName = Array(count+2).join("[") + typename;
153151
// expect(arr.getClass().getName()).toBe(expectedArrayClassName);
154152
// });
155-
});
153+
});

platforms/android/test-app/app/src/main/assets/app/tests/kotlin/extensions/testExtensionFunctionsSupport.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ describe("Tests Kotlin extension functions support", function () {
116116
expect(hasException).toBe(false);
117117
});
118118

119-
var describeUnlessJsc = global.__engineVariant === "JSC" ? xdescribe : describe;
120-
121-
describeUnlessJsc("Kotlin extension functions that shadow Java functions", function () {
119+
describe("Kotlin extension functions that shadow Java functions", function () {
122120
let handler;
123121
beforeEach(function () {
124122
handler = new android.os.Handler(android.os.Looper.getMainLooper());
@@ -141,4 +139,4 @@ describe("Tests Kotlin extension functions support", function () {
141139
handler.postAtTime(1, cancelToken, kotlinFunc);
142140
})
143141
});
144-
});
142+
});

platforms/android/test-app/app/src/main/assets/app/tests/numericConversionTests.js

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
describe("Tests numeric conversions and constructor/method resolutions", function() {
22

3-
var itUnlessHermesNodeApi = (global.__engineVariant === "HERMES" || global.__engineVariant === "SHERMES") ? xit : it;
4-
53
var myCustomEquality = function(first, second) {
64
return first == second;
75
};
@@ -248,7 +246,7 @@ describe("Tests numeric conversions and constructor/method resolutions", functio
248246
});
249247

250248
// long cast
251-
itUnlessHermesNodeApi("TestIfNeedsToReturnLongItAlwaysReturnsLong", function() {
249+
it("TestIfNeedsToReturnLongItAlwaysReturnsLong", function() {
252250

253251
__log("TEST: TestIfNeedsToReturnLongItAlwaysReturnsLong");
254252

@@ -302,7 +300,7 @@ describe("Tests numeric conversions and constructor/method resolutions", functio
302300
expect(value).toBe(-1147483649); // this is because v8 treats 3147483647 as in if not passed like so long(3147483647)
303301
});
304302

305-
itUnlessHermesNodeApi("TestIfNeedsToReturnLongItAlwaysReturnsLong2", function() {
303+
it("TestIfNeedsToReturnLongItAlwaysReturnsLong2", function() {
306304

307305
__log("TEST: TestIfNeedsToReturnLongItAlwaysReturnsLong2");
308306

@@ -329,7 +327,7 @@ describe("Tests numeric conversions and constructor/method resolutions", functio
329327
expect(value).toBe(3147483647);
330328
});
331329

332-
itUnlessHermesNodeApi("TestIfNeedsToReturnLongItAlwaysReturnsLong3", function() {
330+
it("TestIfNeedsToReturnLongItAlwaysReturnsLong3", function() {
333331

334332
__log("TEST: TestIfNeedsToReturnLongItAlwaysReturnsLong3");
335333

@@ -359,7 +357,7 @@ describe("Tests numeric conversions and constructor/method resolutions", functio
359357
});
360358

361359
// int cast
362-
itUnlessHermesNodeApi("TestIfNeedsToReturnIntItAlwaysReturnsInt", function() {
360+
it("TestIfNeedsToReturnIntItAlwaysReturnsInt", function() {
363361

364362
__log("TEST: TestIfNeedsToReturnIntItAlwaysReturnsInt");
365363

@@ -386,7 +384,7 @@ describe("Tests numeric conversions and constructor/method resolutions", functio
386384
expect(value).toBe(1234);
387385
});
388386

389-
itUnlessHermesNodeApi("TestIfNeedsToReturnIntAndWePassLongExceptionShouldBeThrown", function() {
387+
it("TestIfNeedsToReturnIntAndWePassLongExceptionShouldBeThrown", function() {
390388

391389
__log("TEST: TestIfNeedsToReturnIntAndWePassLongExceptionShouldBeThrown");
392390

@@ -413,7 +411,7 @@ describe("Tests numeric conversions and constructor/method resolutions", functio
413411
});
414412

415413
// double cast
416-
itUnlessHermesNodeApi("TestIfNeedsToReturnDoubleItAlwaysReturnsDouble", function() {
414+
it("TestIfNeedsToReturnDoubleItAlwaysReturnsDouble", function() {
417415

418416
__log("TEST: TestIfNeedsToReturnDoubleItAlwaysReturnsDouble");
419417

@@ -449,7 +447,7 @@ describe("Tests numeric conversions and constructor/method resolutions", functio
449447
expect(isReturnValueCorrect).toBe(true);
450448
});
451449

452-
itUnlessHermesNodeApi("TestIfNeedsToReturnDoubleItAlwaysReturnsDouble1", function() {
450+
it("TestIfNeedsToReturnDoubleItAlwaysReturnsDouble1", function() {
453451

454452
__log("TEST: TestIfNeedsToReturnDoubleItAlwaysReturnsDouble1");
455453

@@ -476,7 +474,7 @@ describe("Tests numeric conversions and constructor/method resolutions", functio
476474
expect(value).toBe(1234.1234);
477475
});
478476

479-
itUnlessHermesNodeApi("TestIfNeedsToReturnDoubleItAlwaysReturnsDouble2", function() {
477+
it("TestIfNeedsToReturnDoubleItAlwaysReturnsDouble2", function() {
480478

481479
__log("TEST: TestIfNeedsToReturnDoubleItAlwaysReturnsDouble2");
482480

@@ -513,7 +511,7 @@ describe("Tests numeric conversions and constructor/method resolutions", functio
513511
expect(isReturnValueCorrect).toBe(true);
514512
});
515513

516-
itUnlessHermesNodeApi("TestIfNeedsToReturnDoubleItAlwaysReturnsDouble3", function() {
514+
it("TestIfNeedsToReturnDoubleItAlwaysReturnsDouble3", function() {
517515

518516
__log("TEST: TestIfNeedsToReturnDoubleItAlwaysReturnsDouble3");
519517

@@ -541,7 +539,7 @@ describe("Tests numeric conversions and constructor/method resolutions", functio
541539
expect(value).toBe(doubleVal);
542540
});
543541

544-
itUnlessHermesNodeApi("TestIfNeedsToReturnDoubleItAlwaysReturnsDouble4", function() {
542+
it("TestIfNeedsToReturnDoubleItAlwaysReturnsDouble4", function() {
545543

546544
__log("TEST: TestIfNeedsToReturnDoubleItAlwaysReturnsDouble4");
547545

@@ -578,7 +576,7 @@ describe("Tests numeric conversions and constructor/method resolutions", functio
578576
});
579577

580578
// float cast
581-
itUnlessHermesNodeApi("TestIfNeedsToReturnFloatItAlwaysReturnsFloat", function() {
579+
it("TestIfNeedsToReturnFloatItAlwaysReturnsFloat", function() {
582580

583581
__log("TEST: TestIfNeedsToReturnFloatItAlwaysReturnsFloat");
584582

@@ -615,7 +613,7 @@ describe("Tests numeric conversions and constructor/method resolutions", functio
615613
expect(isReturnValueCorrect).toBe(true);
616614
});
617615

618-
itUnlessHermesNodeApi("TestIfNeedsToReturnFloatItAlwaysReturnsFloat1", function() {
616+
it("TestIfNeedsToReturnFloatItAlwaysReturnsFloat1", function() {
619617

620618
__log("TEST: TestIfNeedsToReturnFloatItAlwaysReturnsFloat1");
621619

@@ -651,7 +649,7 @@ describe("Tests numeric conversions and constructor/method resolutions", functio
651649
expect(isReturnValueCorrect).toBe(true);
652650
});
653651

654-
itUnlessHermesNodeApi("TestIfNeedsToReturnFloatAndWePassDoubleExceptionShouldBeThrown", function() {
652+
it("TestIfNeedsToReturnFloatAndWePassDoubleExceptionShouldBeThrown", function() {
655653

656654
__log("TEST: TestIfNeedsToReturnFloatAndWePassDoubleExceptionShouldBeThrown");
657655

@@ -678,7 +676,7 @@ describe("Tests numeric conversions and constructor/method resolutions", functio
678676
expect(exceptionCaught).toBe(true);
679677
});
680678

681-
itUnlessHermesNodeApi("TestIfNeedsToReturnFloatAndWePassDoubleExceptionShouldBeThrown1", function() {
679+
it("TestIfNeedsToReturnFloatAndWePassDoubleExceptionShouldBeThrown1", function() {
682680

683681
__log("TEST: TestIfNeedsToReturnFloatAndWePassDoubleExceptionShouldBeThrown1");
684682

@@ -715,4 +713,4 @@ describe("Tests numeric conversions and constructor/method resolutions", functio
715713

716714
expect(result).toBe(expectedResult);
717715
});
718-
});
716+
});

platforms/android/test-app/app/src/main/assets/app/tests/testArrays.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
describe("Tests array operations", function () {
2-
var itUnlessJsc = global.__engineVariant === "JSC" ? xit : it;
3-
42

53
var myCustomEquality = function(first, second) {
64
return first == second;
@@ -42,7 +40,7 @@ describe("Tests array operations", function () {
4240
expect(arr.length).toBe(size);
4341
});
4442

45-
itUnlessJsc("TestArrayOperations", function () {
43+
it("TestArrayOperations", function () {
4644

4745
// keep 'size' value large (>512) in order to test for JNI reference leaks as well
4846
var size = 10000;
@@ -118,4 +116,4 @@ describe("Tests array operations", function () {
118116

119117
});
120118

121-
});
119+
});

platforms/android/test-app/app/src/main/assets/app/tests/testJniReferenceLeak.js

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
1-
var describeJniReferenceLeak = global.__engineVariant === "SHERMES" ? xdescribe : describe;
2-
3-
describeJniReferenceLeak("Tests JNI reference leak", function () {
4-
var originalTimeout;
5-
6-
beforeEach(function () {
7-
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
8-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 120000;
9-
});
10-
11-
afterEach(function () {
12-
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
13-
});
1+
describe("Tests JNI reference leak", function () {
142

153
// var myCustomEquality = function(first, second) {
164
// return first == second;
@@ -107,7 +95,7 @@ describeJniReferenceLeak("Tests JNI reference leak", function () {
10795
expect(n).toBe(N);
10896
});
10997

110-
if (__engine !== "Hermes" && global.__engineVariant !== "JSC") {
98+
if (__engine !== "Hermes") {
11199
it("test_if_global_reference_leaks_when_interface_implementation_is_created", function () {
112100
var n = 0;
113101
var N = 100 * 1000;
@@ -142,4 +130,4 @@ describeJniReferenceLeak("Tests JNI reference leak", function () {
142130
expect(n).toBe(N-1);
143131
});
144132

145-
});
133+
});

platforms/android/test-app/app/src/main/assets/app/tests/testMultithreadedJavascript.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const describeMultithreadedJavascript = global.__engineVariant === "JSC" ? xdescribe : describe;
2-
3-
describeMultithreadedJavascript("Test multithreaded javascript ", () => {
1+
describe("Test multithreaded javascript ", () => {
42
it("Should execute callbacks on specified native thread", done => {
53

64
const currentThreadId = java.lang.Thread.currentThread().getId();

platforms/android/test-app/app/src/main/assets/app/tests/testNativeTimers.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const describeNativeTimer = global.__engineVariant === "SHERMES" ? xdescribe : describe;
2-
3-
describeNativeTimer('native timer', () => {
1+
describe('native timer', () => {
42

53
/** @type {global.setTimeout} */
64
let setTimeout = global.__ns__setTimeout;
@@ -36,15 +34,14 @@ describeNativeTimer('native timer', () => {
3634

3735
it('triggers interval', (done) => {
3836
let calls = 0;
39-
const now = Date.now();
4037
const itv = setInterval(() => {
4138
calls++;
42-
if (calls === 3) {
43-
clearInterval(itv);
44-
expect(Date.now() - now).not.toBeLessThan(250);
45-
done();
46-
}
4739
}, 100);
40+
setTimeout(() => {
41+
clearInterval(itv);
42+
expect(calls).toBe(10);
43+
done();
44+
}, 1000);
4845
});
4946

5047
it('cancels timeout', (done) => {
@@ -126,4 +123,4 @@ describeNativeTimer('native timer', () => {
126123
})
127124
}, 200);
128125
})
129-
});
126+
});

0 commit comments

Comments
 (0)