зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1167099 - Fix wifi tethering test case on KK emulator. r=vchang.
This commit is contained in:
Родитель
70e5300323
Коммит
0923c52f45
|
@ -50,6 +50,7 @@ let gTestSuite = (function() {
|
|||
let wifiManager;
|
||||
let wifiOrigEnabled;
|
||||
let pendingEmulatorShellCount = 0;
|
||||
let sdkVersion;
|
||||
|
||||
/**
|
||||
* A wrapper function of "is".
|
||||
|
@ -1179,7 +1180,13 @@ let gTestSuite = (function() {
|
|||
// when tethering is enabled. 'MASQUERADE' shouldn't be found when tethering
|
||||
// is disabled.
|
||||
function verifyIptables() {
|
||||
return runEmulatorShellSafe(['iptables', '-t', 'nat', '-L', 'POSTROUTING'])
|
||||
let MASQUERADE_checkSection = 'POSTROUTING';
|
||||
if (sdkVersion > 15) {
|
||||
// Check 'natctrl_nat_POSTROUTING' section after ICS.
|
||||
MASQUERADE_checkSection = 'natctrl_nat_POSTROUTING';
|
||||
}
|
||||
|
||||
return runEmulatorShellSafe(['iptables', '-t', 'nat', '-L', MASQUERADE_checkSection])
|
||||
.then(function(aLines) {
|
||||
// $ iptables -t nat -L POSTROUTING
|
||||
//
|
||||
|
@ -1273,6 +1280,10 @@ let gTestSuite = (function() {
|
|||
throw 'window.navigator.mozWifiManager is NULL';
|
||||
}
|
||||
wifiOrigEnabled = wifiManager.enabled;
|
||||
})
|
||||
.then(() => runEmulatorShellSafe(['getprop', 'ro.build.version.sdk']))
|
||||
.then(aLines => {
|
||||
sdkVersion = parseInt(aLines[0]);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1397,7 +1408,12 @@ let gTestSuite = (function() {
|
|||
return suite.doTest(function() {
|
||||
return verifyInitialState()
|
||||
.then(initTetheringTestEnvironment)
|
||||
// Since stock hostapd is not reliable after ICS, we just
|
||||
// turn off potential stock hostapd during testing to avoid
|
||||
// interference.
|
||||
.then(stopStockHostapd)
|
||||
.then(aTestCaseChain)
|
||||
.then(startStockHostapd)
|
||||
.then(restoreToInitialState, function onreject(aReason) {
|
||||
return restoreToInitialState()
|
||||
.then(() => { throw aReason; }); // Re-throw the orignal reject reason.
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = 'head.js';
|
||||
|
||||
const TESTING_HOSTAPD = [{ ssid: 'ap0' }];
|
||||
|
||||
function connectToFirstNetwork() {
|
||||
let firstNetwork;
|
||||
return gTestSuite.requestWifiScan()
|
||||
|
@ -18,6 +20,11 @@ gTestSuite.doTestTethering(function() {
|
|||
let firstNetwork;
|
||||
|
||||
return gTestSuite.ensureWifiEnabled(true)
|
||||
// Start custom hostapd for testing.
|
||||
.then(() => gTestSuite.startHostapds(TESTING_HOSTAPD))
|
||||
.then(() => gTestSuite.verifyNumOfProcesses('hostapd', TESTING_HOSTAPD.length))
|
||||
|
||||
// Connect to the testing AP and wait for data becoming disconnected.
|
||||
.then(function () {
|
||||
return Promise.all([
|
||||
// 1) Set up the event listener first:
|
||||
|
@ -46,8 +53,12 @@ gTestSuite.doTestTethering(function() {
|
|||
// Wifi should be enabled, RIL data should become disconnected and
|
||||
// we should connect to an wifi AP.
|
||||
gTestSuite.waitForWifiManagerEventOnce('enabled'),
|
||||
gTestSuite.waitForRilDataConnected(false),
|
||||
gTestSuite.waitForConnected(firstNetwork),
|
||||
|
||||
// Due to Bug 1168285, after re-enablin wifi, the remembered network
|
||||
// will not be connected automatically. Leave "auto connect test"
|
||||
// covered by test_wifi_auto_connect.js.
|
||||
//gTestSuite.waitForRilDataConnected(false),
|
||||
//gTestSuite.waitForConnected(firstNetwork),
|
||||
|
||||
// 2) Stop wifi tethering.
|
||||
gTestSuite.requestTetheringEnabled(false)
|
||||
|
@ -55,5 +66,9 @@ gTestSuite.doTestTethering(function() {
|
|||
})
|
||||
// Remove wlan0 from default route by disabling wifi. Otherwise,
|
||||
// it will cause the subsequent test cases loading page error.
|
||||
.then(() => gTestSuite.requestWifiEnabled(false));
|
||||
.then(() => gTestSuite.requestWifiEnabled(false))
|
||||
|
||||
// Kill running hostapd.
|
||||
.then(gTestSuite.killAllHostapd)
|
||||
.then(() => gTestSuite.verifyNumOfProcesses('hostapd', 0));
|
||||
});
|
Загрузка…
Ссылка в новой задаче