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 /dom/system/gonk/tests/marionette/test_data_connection.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 'dom/system/gonk/tests/marionette/test_data_connection.js')
-rw-r--r-- | dom/system/gonk/tests/marionette/test_data_connection.js | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/dom/system/gonk/tests/marionette/test_data_connection.js b/dom/system/gonk/tests/marionette/test_data_connection.js new file mode 100644 index 000000000..5a53b1e5f --- /dev/null +++ b/dom/system/gonk/tests/marionette/test_data_connection.js @@ -0,0 +1,70 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 60000; +MARIONETTE_HEAD_JS = "head.js"; + +function setEmulatorAPN() { + let apn = [ + [{"carrier":"T-Mobile US", + "apn":"epc.tmobile.com", + "mmsc":"http://mms.msg.eng.t-mobile.com/mms/wapenc", + "types":["default","supl","mms","ims","dun", "fota"]}] + ]; + + return setSettings(SETTINGS_KEY_DATA_APN_SETTINGS, apn); +} + +// Test initial State +function testInitialState() { + log("= testInitialState ="); + + // Data should be off before starting any test. + return getSettings(SETTINGS_KEY_DATA_ENABLED) + .then(value => { + is(value, false, "Data must be off"); + }); +} + +// Test default data Connection +function testDefaultDataConnection() { + log("= testDefaultDataConnection ="); + + // Enable default data + return setDataEnabledAndWait(true) + // Disable default data + .then(() => setDataEnabledAndWait(false)); +} + +// Test non default data connection +function testNonDefaultDataConnection() { + log("= testNonDefaultDataConnection ="); + + function doTestNonDefaultDataConnection(type) { + log("doTestNonDefaultDataConnection: " + type); + + return setupDataCallAndWait(type) + .then(() => deactivateDataCallAndWait(type)); + } + + let currentApn; + return getSettings(SETTINGS_KEY_DATA_APN_SETTINGS) + .then(value => { + currentApn = value; + }) + .then(setEmulatorAPN) + .then(() => doTestNonDefaultDataConnection(NETWORK_TYPE_MOBILE_MMS)) + .then(() => doTestNonDefaultDataConnection(NETWORK_TYPE_MOBILE_SUPL)) + .then(() => doTestNonDefaultDataConnection(NETWORK_TYPE_MOBILE_IMS)) + .then(() => doTestNonDefaultDataConnection(NETWORK_TYPE_MOBILE_DUN)) + .then(() => doTestNonDefaultDataConnection(NETWORK_TYPE_MOBILE_FOTA)) + // Restore APN settings + .then(() => setSettings(SETTINGS_KEY_DATA_APN_SETTINGS, currentApn)); +} + +// Start test +startTestBase(function() { + return testInitialState() + .then(() => testDefaultDataConnection()) + .then(() => testNonDefaultDataConnection()); +}); |