This repository has been archived by the owner on Aug 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1000040 - Part 3: Test cases. r=vchang, f=vyang
- Loading branch information
Showing
13 changed files
with
824 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[DEFAULT] | ||
b2g = true | ||
browser = false | ||
qemu = true | ||
|
||
[test_ethernet_add_interface.js] | ||
[test_ethernet_remove_interface.js] | ||
[test_ethernet_enable.js] | ||
[test_ethernet_disable.js] | ||
[test_ethernet_connect_with_dhcp.js] | ||
[test_ethernet_connect_with_static_ip.js] | ||
[test_ethernet_reconnect_with_dhcp.js] | ||
[test_ethernet_reconnect_with_static_ip.js] | ||
[test_ethernet_ip_mode_change.js] | ||
[test_ethernet_disconnect.js] |
16 changes: 16 additions & 0 deletions
16
dom/network/tests/marionette/test_ethernet_add_interface.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
MARIONETTE_TIMEOUT = 60000; | ||
MARIONETTE_HEAD_JS = 'head.js'; | ||
|
||
const ETHERNET_INTERFACE_NAME = "eth1"; | ||
|
||
gTestSuite.doTest(function() { | ||
return Promise.resolve() | ||
.then(() => gTestSuite.checkInterfaceExist(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.checkInterfaceListLength(0)) | ||
.then(() => gTestSuite.addInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.checkInterfaceListLength(1)) | ||
.then(() => gTestSuite.removeInterface(ETHERNET_INTERFACE_NAME)); | ||
}); |
26 changes: 26 additions & 0 deletions
26
dom/network/tests/marionette/test_ethernet_connect_with_dhcp.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
MARIONETTE_TIMEOUT = 60000; | ||
MARIONETTE_HEAD_JS = 'head.js'; | ||
|
||
const ETHERNET_INTERFACE_NAME = "eth1"; | ||
|
||
function checkDhcpResult(ifname) { | ||
return gTestSuite.getDhcpIpAddr(ifname) | ||
.then(ip => gTestSuite.checkInterfaceIpAddr(ifname, ip)) | ||
.then(() => gTestSuite.getDhcpGateway(ifname)) | ||
.then(gateway => gTestSuite.waitForDefaultRouteSet(ifname, gateway)); | ||
} | ||
|
||
gTestSuite.doTest(function() { | ||
return Promise.resolve() | ||
.then(() => gTestSuite.checkInterfaceExist(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.addInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.enableInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.makeInterfaceConnect(ETHERNET_INTERFACE_NAME)) | ||
.then(() => checkDhcpResult(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.makeInterfaceDisconnect(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.disableInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.removeInterface(ETHERNET_INTERFACE_NAME)); | ||
}); |
33 changes: 33 additions & 0 deletions
33
dom/network/tests/marionette/test_ethernet_connect_with_static_ip.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
MARIONETTE_TIMEOUT = 60000; | ||
MARIONETTE_HEAD_JS = 'head.js'; | ||
|
||
const ETHERNET_INTERFACE_NAME = "eth1"; | ||
|
||
let staticConfig = { | ||
ip: "1.2.3.4", | ||
gateway: "1.2.3.5", | ||
prefixLength: 24, | ||
dnses: ["1.2.3.6"], | ||
ipMode: "static" | ||
}; | ||
|
||
function checkStaticResult(ifname) { | ||
return gTestSuite.checkInterfaceIpAddr(ifname, staticConfig.ip) | ||
.then(() => gTestSuite.checkDefaultRoute(ifname, staticConfig.gateway)); | ||
} | ||
|
||
gTestSuite.doTest(function() { | ||
return Promise.resolve() | ||
.then(() => gTestSuite.checkInterfaceExist(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.addInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.enableInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.updateInterfaceConfig(ETHERNET_INTERFACE_NAME, staticConfig)) | ||
.then(() => gTestSuite.makeInterfaceConnect(ETHERNET_INTERFACE_NAME)) | ||
.then(() => checkStaticResult(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.makeInterfaceDisconnect(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.disableInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.removeInterface(ETHERNET_INTERFACE_NAME)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
MARIONETTE_TIMEOUT = 60000; | ||
MARIONETTE_HEAD_JS = 'head.js'; | ||
|
||
const ETHERNET_INTERFACE_NAME = "eth1"; | ||
|
||
gTestSuite.doTest(function() { | ||
return Promise.resolve() | ||
.then(() => gTestSuite.checkInterfaceExist(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.addInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.enableInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.disableInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.checkInterfaceIsEnabled(ETHERNET_INTERFACE_NAME, false)) | ||
.then(() => gTestSuite.removeInterface(ETHERNET_INTERFACE_NAME)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
MARIONETTE_TIMEOUT = 60000; | ||
MARIONETTE_HEAD_JS = 'head.js'; | ||
|
||
const ETHERNET_INTERFACE_NAME = "eth1"; | ||
const INTERFACE_IP_NONE = "0.0.0.0"; | ||
|
||
function checkIpAddrIsReset(ifname) { | ||
return gTestSuite.checkInterfaceIpAddr(ifname, INTERFACE_IP_NONE) | ||
.then(() => gTestSuite.checkDefaultRoute(ifname)); | ||
} | ||
|
||
gTestSuite.doTest(function() { | ||
return Promise.resolve() | ||
.then(() => gTestSuite.checkInterfaceExist(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.addInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.enableInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.makeInterfaceConnect(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.makeInterfaceDisconnect(ETHERNET_INTERFACE_NAME)) | ||
.then(() => checkIpAddrIsReset(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.disableInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.removeInterface(ETHERNET_INTERFACE_NAME)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
MARIONETTE_TIMEOUT = 60000; | ||
MARIONETTE_HEAD_JS = 'head.js'; | ||
|
||
const ETHERNET_INTERFACE_NAME = "eth1"; | ||
|
||
gTestSuite.doTest(function() { | ||
return Promise.resolve() | ||
.then(() => gTestSuite.checkInterfaceExist(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.addInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.enableInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.checkInterfaceIsEnabled(ETHERNET_INTERFACE_NAME, true)) | ||
.then(() => gTestSuite.disableInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.removeInterface(ETHERNET_INTERFACE_NAME)); | ||
}); |
43 changes: 43 additions & 0 deletions
43
dom/network/tests/marionette/test_ethernet_ip_mode_change.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
MARIONETTE_TIMEOUT = 60000; | ||
MARIONETTE_HEAD_JS = 'head.js'; | ||
|
||
const ETHERNET_INTERFACE_NAME = "eth1"; | ||
|
||
let staticConfig = { | ||
ip: "1.2.3.4", | ||
gateway: "1.2.3.5", | ||
prefixLength: 24, | ||
dnses: ["1.2.3.6"], | ||
ipMode: "static" | ||
}; | ||
|
||
function checkStaticResult(ifname) { | ||
return gTestSuite.checkInterfaceIpAddr(ifname, staticConfig.ip) | ||
.then(() => gTestSuite.waitForDefaultRouteSet(ifname, staticConfig.gateway)); | ||
} | ||
|
||
function checkDhcpResult(ifname) { | ||
return gTestSuite.getDhcpIpAddr(ifname) | ||
.then(ip => gTestSuite.checkInterfaceIpAddr(ifname, ip)) | ||
.then(() => gTestSuite.getDhcpGateway(ifname)) | ||
.then(gateway => gTestSuite.waitForDefaultRouteSet(ifname, gateway)); | ||
} | ||
|
||
gTestSuite.doTest(function() { | ||
return Promise.resolve() | ||
.then(() => gTestSuite.checkInterfaceExist(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.addInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.enableInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.makeInterfaceConnect(ETHERNET_INTERFACE_NAME)) | ||
.then(() => checkDhcpResult(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.updateInterfaceConfig(ETHERNET_INTERFACE_NAME, staticConfig)) | ||
.then(() => checkStaticResult(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.updateInterfaceConfig(ETHERNET_INTERFACE_NAME, { ipMode: "dhcp"})) | ||
.then(() => checkDhcpResult(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.makeInterfaceDisconnect(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.disableInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.removeInterface(ETHERNET_INTERFACE_NAME)); | ||
}); |
28 changes: 28 additions & 0 deletions
28
dom/network/tests/marionette/test_ethernet_reconnect_with_dhcp.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
MARIONETTE_TIMEOUT = 60000; | ||
MARIONETTE_HEAD_JS = 'head.js'; | ||
|
||
const ETHERNET_INTERFACE_NAME = "eth1"; | ||
|
||
function checkDhcpResult(ifname) { | ||
return gTestSuite.getDhcpIpAddr(ifname) | ||
.then(ip => gTestSuite.checkInterfaceIpAddr(ifname, ip)) | ||
.then(() => gTestSuite.getDhcpGateway(ifname)) | ||
.then(gateway => gTestSuite.waitForDefaultRouteSet(ifname, gateway)); | ||
} | ||
|
||
gTestSuite.doTest(function() { | ||
return Promise.resolve() | ||
.then(() => gTestSuite.checkInterfaceExist(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.addInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.enableInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.makeInterfaceConnect(ETHERNET_INTERFACE_NAME)) | ||
.then(() => checkDhcpResult(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.makeInterfaceDisconnect(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.makeInterfaceConnect(ETHERNET_INTERFACE_NAME)) | ||
.then(() => checkDhcpResult(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.disableInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.removeInterface(ETHERNET_INTERFACE_NAME)); | ||
}); |
36 changes: 36 additions & 0 deletions
36
dom/network/tests/marionette/test_ethernet_reconnect_with_static_ip.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
MARIONETTE_TIMEOUT = 60000; | ||
MARIONETTE_HEAD_JS = 'head.js'; | ||
|
||
const ETHERNET_INTERFACE_NAME = "eth1"; | ||
|
||
let staticConfig = { | ||
ip: "1.2.3.4", | ||
gateway: "1.2.3.5", | ||
prefixLength: 24, | ||
dnses: ["1.2.3.6"], | ||
ipMode: "static" | ||
}; | ||
|
||
function checkStaticResult(ifname) { | ||
return gTestSuite.checkInterfaceIpAddr(ifname, staticConfig.ip) | ||
.then(() => gTestSuite.checkDefaultRoute(ifname, staticConfig.gateway)); | ||
} | ||
|
||
gTestSuite.doTest(function() { | ||
return Promise.resolve() | ||
.then(() => gTestSuite.checkInterfaceExist(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.addInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.enableInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.updateInterfaceConfig(ETHERNET_INTERFACE_NAME, staticConfig)) | ||
.then(() => gTestSuite.makeInterfaceConnect(ETHERNET_INTERFACE_NAME)) | ||
.then(() => checkStaticResult(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.makeInterfaceDisconnect(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.makeInterfaceConnect(ETHERNET_INTERFACE_NAME)) | ||
.then(() => checkStaticResult(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.makeInterfaceDisconnect(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.disableInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.removeInterface(ETHERNET_INTERFACE_NAME)); | ||
}); |
16 changes: 16 additions & 0 deletions
16
dom/network/tests/marionette/test_ethernet_remove_interface.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
MARIONETTE_TIMEOUT = 60000; | ||
MARIONETTE_HEAD_JS = 'head.js'; | ||
|
||
const ETHERNET_INTERFACE_NAME = "eth1"; | ||
|
||
gTestSuite.doTest(function() { | ||
return Promise.resolve() | ||
.then(() => gTestSuite.checkInterfaceExist(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.addInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.checkInterfaceListLength(1)) | ||
.then(() => gTestSuite.removeInterface(ETHERNET_INTERFACE_NAME)) | ||
.then(() => gTestSuite.checkInterfaceListLength(0)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters