summaryrefslogtreecommitdiffstats
path: root/testing/mozbase/mozdevice/sut_tests/test_datachannel.py
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/mozbase/mozdevice/sut_tests/test_datachannel.py
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-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 'testing/mozbase/mozdevice/sut_tests/test_datachannel.py')
-rw-r--r--testing/mozbase/mozdevice/sut_tests/test_datachannel.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/testing/mozbase/mozdevice/sut_tests/test_datachannel.py b/testing/mozbase/mozdevice/sut_tests/test_datachannel.py
new file mode 100644
index 000000000..99b71a584
--- /dev/null
+++ b/testing/mozbase/mozdevice/sut_tests/test_datachannel.py
@@ -0,0 +1,53 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import re
+import socket
+from time import strptime
+
+from dmunit import DeviceManagerTestCase, heartbeat_port
+
+
+class DataChannelTestCase(DeviceManagerTestCase):
+
+ runs_on_test_device = False
+
+ def runTest(self):
+ """This tests the heartbeat and the data channel.
+ """
+ ip = self.dm.host
+
+ # Let's connect
+ self._datasock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ # Assume 60 seconds between heartbeats
+ self._datasock.settimeout(float(60 * 2))
+ self._datasock.connect((ip, heartbeat_port))
+ self._connected = True
+
+ # Let's listen
+ numbeats = 0
+ capturedHeader = False
+ while numbeats < 3:
+ data = self._datasock.recv(1024)
+ print data
+ self.assertNotEqual(len(data), 0)
+
+ # Check for the header
+ if not capturedHeader:
+ m = re.match(r"(.*?) trace output", data)
+ self.assertNotEqual(m, None,
+ 'trace output line does not match. The line: ' + str(data))
+ capturedHeader = True
+
+ # Check for standard heartbeat messsage
+ m = re.match(r"(.*?) Thump thump - (.*)", data)
+ if m is None:
+ # This isn't an error, it usually means we've obtained some
+ # unexpected data from the device
+ continue
+
+ # Ensure it matches our format
+ mHeartbeatTime = m.group(1)
+ mHeartbeatTime = strptime(mHeartbeatTime, "%Y%m%d-%H:%M:%S")
+ numbeats = numbeats + 1