diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /mobile/android/tests/browser/robocop/testUnifiedTelemetryClientId.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'mobile/android/tests/browser/robocop/testUnifiedTelemetryClientId.js')
-rw-r--r-- | mobile/android/tests/browser/robocop/testUnifiedTelemetryClientId.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/mobile/android/tests/browser/robocop/testUnifiedTelemetryClientId.js b/mobile/android/tests/browser/robocop/testUnifiedTelemetryClientId.js new file mode 100644 index 000000000..d574aaef1 --- /dev/null +++ b/mobile/android/tests/browser/robocop/testUnifiedTelemetryClientId.js @@ -0,0 +1,50 @@ +var { classes: Cc, interfaces: Ci, utils: Cu } = Components; + +Cu.import('resource://gre/modules/ClientID.jsm'); + +var java = new JavaBridge(this); +do_register_cleanup(() => { + java.disconnect(); +}); +do_test_pending(); + +var isClientIDSet; +var clientID; + +var isResetDone; + +function getAsyncClientId() { + isClientIDSet = false; + ClientID.getClientID().then(function (retClientID) { + // Ideally, we'd directly send the client ID back to Java but Java won't listen for + // js messages after we return from the containing function (bug 1253467). + // + // Note that my brief attempts to get synchronous Promise resolution (via Task.jsm) + // working failed - I have other things to focus on. + clientID = retClientID; + isClientIDSet = true; + }, function (fail) { + // Since Java doesn't listen to our messages (bug 1253467), I don't expect + // this throw to work correctly but we should timeout in Java. + do_throw('Could not retrieve client ID: ' + fail); + }); +} + +function pollGetAsyncClientId() { + java.asyncCall('blockingFromJsResponseString', isClientIDSet, clientID); +} + +function getAsyncReset() { + isResetDone = false; + ClientID._reset().then(function () { + isResetDone = true; + }); +} + +function pollGetAsyncReset() { + java.asyncCall('blockingFromJsResponseString', isResetDone, ''); +} + +function endTest() { + do_test_finished(); +} |