testing/mozbase/mozdevice/sut_tests/test_ps.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/testing/mozbase/mozdevice/sut_tests/test_ps.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,27 @@
     1.4 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.5 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.7 +
     1.8 +from dmunit import DeviceManagerTestCase
     1.9 +
    1.10 +class ProcessListTestCase(DeviceManagerTestCase):
    1.11 +
    1.12 +    def runTest(self):
    1.13 +        """This tests getting a process list from the device.
    1.14 +        """
    1.15 +        proclist = self.dm.getProcessList()
    1.16 +
    1.17 +        # This returns a process list of the form:
    1.18 +        # [[<procid>, <procname>], [<procid>, <procname>], ...]
    1.19 +        # on android the userID is affixed to the process array:
    1.20 +        # [[<procid>, <procname>, <userid>], ...]
    1.21 +
    1.22 +        self.assertNotEqual(len(proclist), 0)
    1.23 +
    1.24 +        for item in proclist:
    1.25 +            self.assertIsInstance(item[0], int)
    1.26 +            self.assertIsInstance(item[1], str)
    1.27 +            self.assertGreater(len(item[1]), 0)
    1.28 +            if len(item) > 2:
    1.29 +                self.assertIsInstance(item[2], int)
    1.30 +

mercurial