def test_swith_between_webapps(self):
     setUp()
     testapp = TestApp(device, ConstPath + "/../iterative.apk",
                       "org.xwalk.iterative", "IterativeActivity")
     switchapp = TestApp(device, ConstPath + "/../switchapp.apk",
                         "org.xwalk.switchapp", "SwitchappActivity")
     try:
         if not testapp.isInstalled():
             testapp.install()
         if not switchapp.isInstalled():
             switchapp.install()
         testapp.launch()
         # Pause and Resume 50 times
         for i in range(50):
             time.sleep(2)
             # swtich to other webapp
             self.assertTrue(testapp.switchTo(switchapp))
             time.sleep(2)
             # swtich back
             self.assertTrue(testapp.switch())
         testapp.stop()
         switchapp.stop()
     except Exception as e:
         print "Error: %s" % e
         testapp.stop()
         switchapp.stop()
         self.assertTrue(False)
 def test_swith_between_webapps(self):
     setUp()
     testapp = TestApp(device, ConstPath + "/../iterative.apk", "org.xwalk.iterative", "IterativeActivity")
     switchapp = TestApp(device, ConstPath + "/../switchapp.apk", "org.xwalk.switchapp", "SwitchappActivity")
     try:
         if not testapp.isInstalled():
             testapp.install()
         if not switchapp.isInstalled():
             switchapp.install()
         testapp.launch()
         # Pause and Resume 50 times
         for i in range(50):
             time.sleep(2)
             # swtich to other webapp
             self.assertTrue(testapp.switchTo(switchapp))
             time.sleep(2)
             # swtich back
             self.assertTrue(testapp.switch())
         testapp.stop()
         switchapp.stop()
     except Exception as e:
         print "Error: %s" % e
         testapp.stop()
         switchapp.stop()
         self.assertTrue(False)
    def test_app_repeatedly_in_lowbattery(self):
        setUp()
        testapp = TestApp(device, ConstPath + "/../testapp/lowresourcetest.apk",
                                "org.xwalk.lowresourcetest", "LowresourcetestActivity")
        if testapp.isInstalled():
            testapp.uninstall()

        for i in range(20):
            if testapp.install() and testapp.launch():
                switchresult = False
                for i in range(2):
                    time.sleep(1)
                    # swtich app
                    switchresult = testapp.switch()

                if switchresult:
                    time.sleep(1)
                    if testapp.stop() and testapp.uninstall():
                        time.sleep(1)
                    else:
                        testapp.uninstall()
                        self.assertTrue(False)
                else:
                    testapp.uninstall()
                    self.assertTrue(False)
            else:
                testapp.uninstall()
                self.assertTrue(False)

            testapp.uninstall()
            self.assertTrue(True)
    def test_app_repeatedly_in_lowbattery(self):
        setUp()
        testapp = TestApp(device,
                          ConstPath + "/../testapp/lowresourcetest.apk",
                          "org.xwalk.lowresourcetest",
                          "LowresourcetestActivity")
        if testapp.isInstalled():
            testapp.uninstall()

        for i in range(20):
            if testapp.install() and testapp.launch():
                switchresult = False
                for i in range(2):
                    time.sleep(1)
                    # swtich app
                    switchresult = testapp.switch()

                if switchresult:
                    time.sleep(1)
                    if testapp.stop() and testapp.uninstall():
                        time.sleep(1)
                    else:
                        testapp.uninstall()
                        self.assertTrue(False)
                else:
                    testapp.uninstall()
                    self.assertTrue(False)
            else:
                testapp.uninstall()
                self.assertTrue(False)

            testapp.uninstall()
            self.assertTrue(True)
 def test_pause_resume_webapp_repeatedly(self):
     setUp()
     testapp = TestApp(device, ConstPath + "/../iterative.apk",
                             "org.xwalk.iterative", "IterativeActivity")
     try:
         if not testapp.isInstalled():
             testapp.install()
         testapp.launch()
         # Pause and Resume 50 times
         for i in range(50):
             time.sleep(2)
             # swtich to back
             self.assertTrue(testapp.switch())
             time.sleep(2)
             # swtich to front
             self.assertTrue(testapp.switch())
         testapp.stop()
     except Exception as e:
         print "Error: %s" % e
         testapp.stop()
         self.assertTrue(False)
 def test_pause_resume_webapp_repeatedly(self):
     setUp()
     testapp = TestApp(device, ConstPath + "/../iterative.apk",
                       "org.xwalk.iterative", "IterativeActivity")
     try:
         if not testapp.isInstalled():
             testapp.install()
         testapp.launch()
         # Pause and Resume 50 times
         for i in range(50):
             time.sleep(2)
             # swtich to back
             self.assertTrue(testapp.switch())
             time.sleep(2)
             # swtich to front
             self.assertTrue(testapp.switch())
         testapp.stop()
     except Exception as e:
         print "Error: %s" % e
         testapp.stop()
         self.assertTrue(False)
    def test_app_repeatedly_in_lowdisk(self):
        setUp()

        if makeLowDisk():
            testapp = TestApp(device,
                              ConstPath + "/../testapp/lowresourcetest.apk",
                              "org.xwalk.lowresourcetest",
                              "LowresourcetestActivity")
            if testapp.isInstalled():
                testapp.uninstall()

            for i in range(20):
                if testapp.install() and testapp.launch():
                    switchresult = False
                    for i in range(2):
                        time.sleep(1)
                        # swtich app
                        switchresult = testapp.switch()

                    if switchresult:
                        time.sleep(1)
                        if testapp.stop() and testapp.uninstall():
                            time.sleep(1)
                        else:
                            testapp.uninstall()
                            cleanWork()
                            self.assertTrue(False)
                    else:
                        testapp.uninstall()
                        cleanWork()
                        self.assertTrue(False)
                else:
                    testapp.uninstall()
                    cleanWork()
                    self.assertTrue(False)

            testapp.uninstall()
            cleanWork()
            self.assertTrue(True)
        else:
            print "-->> Test envrionment fail to set up"
            cleanWork()
            self.assertTrue(False)
    def test_app_repeatedly_in_lowmemory(self):
        setUp()
        testapp = TestApp(device, ConstPath + "/../testapp/lowresourcetest.apk",
                                "org.xwalk.lowresourcetest", "LowresourcetestActivity")
        if testapp.isInstalled():
            testapp.uninstall()

        for i in range(20):
            self.assertTrue(testapp.install());
            self.assertTrue(testapp.launch());
            time.sleep(1)
            # swtich to background
            self.assertTrue(testapp.switch());
            time.sleep(1)
            # swtich to front
            self.assertTrue(testapp.switch());
            time.sleep(1)
            self.assertTrue(testapp.stop());
            self.assertTrue(testapp.uninstall());
    def test_app_repeatedly_in_lowdisk(self):
        setUp()

        if makeLowDisk():
            testapp = TestApp(device, ConstPath + "/../testapp/lowresourcetest.apk",
                                    "org.xwalk.lowresourcetest", "LowresourcetestActivity")
            if testapp.isInstalled():
                testapp.uninstall()

            for i in range(20):
                if testapp.install() and testapp.launch():
                    switchresult = False
                    for i in range(2):
                        time.sleep(1)
                        # swtich app
                        switchresult = testapp.switch()

                    if switchresult:
                        time.sleep(1)
                        if testapp.stop() and testapp.uninstall():
                            time.sleep(1)
                        else:
                            testapp.uninstall()
                            cleanWork()
                            self.assertTrue(False)
                    else:
                        testapp.uninstall()
                        cleanWork()
                        self.assertTrue(False)
                else:
                    testapp.uninstall()
                    cleanWork()
                    self.assertTrue(False)

            testapp.uninstall()
            cleanWork()
            self.assertTrue(True)
        else:
            print "-->> Test envrionment fail to set up"
            cleanWork()
            self.assertTrue(False)
Пример #10
0
    def test_app_repeatedly_in_lowmemory(self):
        setUp()
        testapp = TestApp(device,
                          ConstPath + "/../testapp/lowresourcetest.apk",
                          "org.xwalk.lowresourcetest",
                          "LowresourcetestActivity")
        if testapp.isInstalled():
            testapp.uninstall()

        for i in range(20):
            self.assertTrue(testapp.install())
            self.assertTrue(testapp.launch())
            time.sleep(1)
            # swtich to background
            self.assertTrue(testapp.switch())
            time.sleep(1)
            # swtich to front
            self.assertTrue(testapp.switch())
            time.sleep(1)
            self.assertTrue(testapp.stop())
            self.assertTrue(testapp.uninstall())