예제 #1
0
    def test_is_foreground(self):
        settings_app = App(package_name="com.android.settings")
        no_app = App()
        self.device.get_adb().press('HOME')
        time.sleep(2)
        self.assertTrue(self.device.is_foreground(no_app))
        self.assertFalse(self.device.is_foreground(settings_app))

        self.device.start_app(settings_app)
        time.sleep(2)
        self.assertTrue(settings_app)
        self.assertFalse(self.device.is_foreground("com.android.unknown"))
예제 #2
0
__author__ = 'yuanchun'

from droidbot.types import Device, App
from droidbot.app_event import CustomizedEventFactory, AppEventManager, AppEvent


class MyEventFactory(CustomizedEventFactory):
    def gen_event_based_on_state(self, state):
        print state
        return AppEvent.get_random_instance(self.device, self.app)


if __name__ == "__main__":
    d = Device()
    a = App(
        app_path=
        "/home/liyc/experiments/apks/hot_apks_types/Personalization/net.zedge.android.apk"
    )
    event_manager = AppEventManager(device=d,
                                    app=a,
                                    event_policy="none",
                                    event_count=100,
                                    event_interval=3,
                                    event_duration=100)
    event_manager.set_event_factory(MyEventFactory(d, a))
    d.install_app(a)
    event_manager.start()
    d.uninstall_app(a)
예제 #3
0
 def setUp(self):
     self.app = App(app_path="resources/DroidBoxTests.apk")