Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: build/android/pylib/device/device_utils_test.py

Issue 354863003: [Android] Switch to DeviceUtils versions of GoHome, ForceStop, etc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """ 5 """
6 Unit tests for the contents of device_utils.py (mostly DeviceUtils). 6 Unit tests for the contents of device_utils.py (mostly DeviceUtils).
7 """ 7 """
8 8
9 # pylint: disable=C0321 9 # pylint: disable=C0321
10 # pylint: disable=W0212 10 # pylint: disable=W0212
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 def testBroadcastIntent_withExtra_noValue(self): 675 def testBroadcastIntent_withExtra_noValue(self):
676 test_intent = intent.Intent(action='test.package.with.an.INTENT', 676 test_intent = intent.Intent(action='test.package.with.an.INTENT',
677 extras={'foo': None}) 677 extras={'foo': None})
678 with self.assertOldImplCalls( 678 with self.assertOldImplCalls(
679 "adb -s 0123456789abcdef shell 'am broadcast " 679 "adb -s 0123456789abcdef shell 'am broadcast "
680 "-a test.package.with.an.INTENT " 680 "-a test.package.with.an.INTENT "
681 "-e foo'", 681 "-e foo'",
682 'Broadcasting: Intent { act=test.package.with.an.INTENT } '): 682 'Broadcasting: Intent { act=test.package.with.an.INTENT } '):
683 self.device.BroadcastIntent(test_intent) 683 self.device.BroadcastIntent(test_intent)
684 684
685 def testGoHome(self):
686 with self.assertOldImplCalls(
687 "adb -s 0123456789abcdef shell 'am start "
688 "-W "
689 "-a android.intent.action.MAIN "
690 "-c android.intent.category.HOME'",
691 'Starting: Intent { act=android.intent.action.MAIN }\r\n'):
692 self.device.GoHome()
693
694 def testForceStop(self):
695 with self.assertOldImplCalls(
696 "adb -s 0123456789abcdef shell 'am force-stop this.is.a.test.package'",
697 ''):
698 self.device.ForceStop('this.is.a.test.package')
699
700 def testClearApplicationState_packageExists(self):
701 with self.assertOldImplCalls(
702 "adb -s 0123456789abcdef shell 'pm path this.package.does.not.exist'",
703 ''):
704 self.device.ClearApplicationState('this.package.does.not.exist')
705
706 def testClearApplicationState_packageDoesntExist(self):
707 with self.assertOldImplCallsSequence([
708 ("adb -s 0123456789abcdef shell 'pm path this.package.exists'",
709 'package:/data/app/this.package.exists.apk'),
710 ("adb -s 0123456789abcdef shell 'pm clear this.package.exists'",
711 'Success\r\n')]):
712 self.device.ClearApplicationState('this.package.exists')
713
714 def testSendKeyEvent(self):
715 with self.assertOldImplCalls(
716 "adb -s 0123456789abcdef shell 'input keyevent 66'",
717 ''):
718 self.device.SendKeyEvent(66)
719
685 720
686 if __name__ == '__main__': 721 if __name__ == '__main__':
687 unittest.main(verbosity=2) 722 unittest.main(verbosity=2)
688 723
OLDNEW
« no previous file with comments | « build/android/pylib/device/device_utils.py ('k') | build/android/pylib/gtest/test_package_apk.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698