|
1 from sut import MockAgent |
|
2 import mozdevice |
|
3 import mozlog |
|
4 import unittest |
|
5 |
|
6 class LaunchTest(unittest.TestCase): |
|
7 |
|
8 def test_nouserserial(self): |
|
9 a = MockAgent(self, commands = [("ps", |
|
10 "10029 549 com.android.launcher\n" |
|
11 "10066 1198 com.twitter.android"), |
|
12 ("info sutuserinfo", ""), |
|
13 ("exec am start -W -n " |
|
14 "org.mozilla.fennec/.App -a " |
|
15 "android.intent.action.VIEW", |
|
16 "OK\nreturn code [0]")]) |
|
17 d = mozdevice.DroidSUT("127.0.0.1", port=a.port, logLevel=mozlog.DEBUG) |
|
18 d.launchFennec("org.mozilla.fennec") |
|
19 a.wait() |
|
20 |
|
21 def test_userserial(self): |
|
22 a = MockAgent(self, commands = [("ps", |
|
23 "10029 549 com.android.launcher\n" |
|
24 "10066 1198 com.twitter.android"), |
|
25 ("info sutuserinfo", "User Serial:0"), |
|
26 ("exec am start --user 0 -W -n " |
|
27 "org.mozilla.fennec/.App -a " |
|
28 "android.intent.action.VIEW", |
|
29 "OK\nreturn code [0]")]) |
|
30 d = mozdevice.DroidSUT("127.0.0.1", port=a.port, logLevel=mozlog.DEBUG) |
|
31 d.launchFennec("org.mozilla.fennec") |
|
32 a.wait() |
|
33 |
|
34 if __name__ == '__main__': |
|
35 unittest.main() |