testing/mozbase/mozdevice/tests/sut_kill.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/testing/mozbase/mozdevice/tests/sut_kill.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,24 @@
     1.4 +#!/usr/bin/env python
     1.5 +
     1.6 +import mozdevice
     1.7 +import mozlog
     1.8 +import unittest
     1.9 +from sut import MockAgent
    1.10 +
    1.11 +
    1.12 +class TestKill(unittest.TestCase):
    1.13 +
    1.14 +    def test_killprocess(self):
    1.15 +        commands = [("ps", "1000    1486    com.android.settings\n"
    1.16 +                           "10016   420 com.android.location.fused\n"
    1.17 +                           "10023   335 com.android.systemui\n"),
    1.18 +                    ("kill com.android.settings",
    1.19 +                     "Successfully killed com.android.settings\n")]
    1.20 +        m = MockAgent(self, commands=commands)
    1.21 +        d = mozdevice.DroidSUT("127.0.0.1", port=m.port, logLevel=mozlog.DEBUG)
    1.22 +        # No error raised means success
    1.23 +        self.assertEqual(None,  d.killProcess("com.android.settings"))
    1.24 +
    1.25 +
    1.26 +if __name__ == '__main__':
    1.27 +    unittest.main()

mercurial