Beispiel #1
0
class LockTypeUnlockMoreThan30times(UIATestBase):
    def setUp(self):
        self._test_name = __name__
        self.securityImpl = SecurityImpl()
        self.def_passwd = "qwer123"
        self.incorrect_passwd = "qwer"
        self.incorrect_passwd_long = "abcdefg123456"
        self.def_pin = 1234
        self.incorrect_pin = 1111
        self.incorrect_pin_long = 1234567890
        if 1 == 1:
            raise Exception(
                "Debug case on going, skip it, next time run this case")
        print
        print "[Setup]: %s" % self._test_name
        self.securityImpl.start_RPCServer()
        super(LockTypeUnlockMoreThan30times, self).setUp()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(LockTypeUnlockMoreThan30times, self).tearDown()

    def test_brute_force_password_more_than_30times(self):
        print "[RunTest]: %s" % self.__str__()
        self.securityImpl.logger.info("")
        # 1. Password
        print "[Test_type]------Test lock type with <Password> lock type------"
        self.securityImpl.set_screen_lock_type_all("Password", self.def_passwd)
        self.securityImpl.action_screen_lock_security("Unlock")
        try:
            self.securityImpl.resume_unlock_screen_lock_type_all(
                "Password", 32, self.def_passwd, self.incorrect_passwd_long,
                self.def_pin, self.incorrect_pin_long)
            self.securityImpl.remove_resume_screen_lock_type_all(
                "Password", self.def_passwd)
        except Exception, e:
            print e
            if "RPC server not started" in e:
                self.securityImpl.check_RPC_server_not_start(self.def_passwd)
                self.securityImpl.remove_resume_screen_lock_type_all(
                    "Password", self.def_passwd)
            raise Exception(e)
class ScreenLockUpdateWrongPasswd(UIATestBase):

    # HP desc: need use user image
    def setUp(self):
        self._test_name = __name__
        self.securityImpl = SecurityImpl()
        self.def_passwd = "qwer123"
        self.incorrect_passwd = "qwer"
        self.incorrect_passwd_long = "abcdefg123456"
        self.def_pin = 1234
        self.incorrect_pin = 1111
        self.incorrect_pin_long = 1234567890
        print
        print "[Setup]: %s" % self._test_name
        super(ScreenLockUpdateWrongPasswd, self).setUp()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(ScreenLockUpdateWrongPasswd, self).tearDown()

    def test_screen_lock_update_wrong_password_pin_pattern(self):
        print "[RunTest]: %s" % self.__str__()
        self.securityImpl.logger.info("")
        # 1. Password
        print "[Test_type]------Test lock type with <Password> lock type------"
        self.securityImpl.set_screen_lock_type_all("Password", self.def_passwd)
        self.securityImpl.action_screen_lock_security("Unlock")
        self.securityImpl.resume_unlock_screen_lock_type_all(
            "Password", 12, self.def_passwd, self.incorrect_passwd_long,
            self.def_pin, self.incorrect_pin_long)
        self.securityImpl.remove_resume_screen_lock_type_all(
            "Password", self.def_passwd)

        print "[RunTest]: %s" % self.__str__()
        self.securityImpl.logger.info("")
        # 2. PIN
        print "[Test_type]------Test lock type with <PIN> lock type------"
        self.securityImpl.set_screen_lock_type_all("PIN", self.def_passwd,
                                                   self.def_pin)
        self.securityImpl.action_screen_lock_security("Unlock")
        self.securityImpl.resume_unlock_screen_lock_type_all(
            "PIN", 12, self.def_passwd, self.incorrect_passwd_long,
            self.def_pin, self.incorrect_pin_long)
        self.securityImpl.remove_resume_screen_lock_type_all(
            "PIN", self.def_passwd, self.def_pin)

        print "[RunTest]: %s" % self.__str__()
        self.securityImpl.logger.info("")
        # 3. Pattern
        time.sleep(3)
        print "[Test_type]------Test lock type with <Pattern> lock type------"
        self.securityImpl.set_screen_lock_type_all("Pattern")
        self.securityImpl.action_screen_lock_security("Unlock")
        self.securityImpl.resume_unlock_screen_lock_type_all(
            "Pattern", 12, "incorrect_pattern")
        self.securityImpl.remove_resume_screen_lock_type_all("Pattern")
Beispiel #3
0
class ScreenLockPasswdPinPatternUpdate(UIATestBase):

    # HP desc: need use user image
    def setUp(self):
        self._test_name = __name__
        self.securityImpl = SecurityImpl()
        print
        self.def_passwd = "qwer123"
        self.def_pin = 1234
        self.def_pattern = 14789
        print "[Setup]: %s" % self._test_name
        super(ScreenLockPasswdPinPatternUpdate, self).setUp()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(ScreenLockPasswdPinPatternUpdate, self).tearDown()

    def test_screen_lock_with_password_pin_pattern_update(self):
        for loop in range(10):
            self.securityImpl.logger.info(
                "------<Start Test>loop input %d/10 password_pin_pattern update"
                % (loop + 1))
            print "[RunTest]: %s" % self.__str__()
            self.securityImpl.logger.info("")
            # 1. Password
            print "[Test_type]------Set lock type with <Password> lock type------"
            time.sleep(3)
            self.securityImpl.set_screen_lock_type_all("Password",
                                                       self.def_passwd)
            self.securityImpl.action_screen_lock_security("Unlock")
            self.securityImpl.unlock_screen_lock_type_all(
                "Password", 5, self.def_passwd, self.def_passwd)
            self.securityImpl.remove_screen_lock_type_all(
                "Password", self.def_passwd)
            # 2. PIN
            print "[Test_type]------Set lock type with <PIN> lock type------"
            time.sleep(3)
            self.securityImpl.set_screen_lock_type_all("PIN", self.def_passwd,
                                                       self.def_pin)
            self.securityImpl.action_screen_lock_security("Unlock")
            self.securityImpl.unlock_screen_lock_type_all(
                "PIN", 5, self.def_passwd, self.def_passwd, self.def_pin,
                self.def_pin)
            self.securityImpl.remove_screen_lock_type_all(
                "PIN", self.def_passwd, self.def_pin)
            # 3. Pattern
            time.sleep(3)
            print "[Test_type]------Set lock type with <Pattern> lock type------"
            self.securityImpl.set_screen_lock_type_all("Pattern")
            self.securityImpl.action_screen_lock_security("Unlock")
            self.securityImpl.unlock_screen_lock_type_all("Pattern", 5)
            self.securityImpl.remove_screen_lock_type_all("Pattern")
Beispiel #4
0
class GatekeeperdKilledWithScreenLock(UIATestBase):
    def setUp(self):
        self._test_name = __name__
        self.securityImpl = SecurityImpl()
        print
        self.def_passwd = "qwer123"
        self.def_pin = 1234
        self.def_pattern = 14789
        print "[Setup]: %s" % self._test_name
        super(GatekeeperdKilledWithScreenLock, self).setUp()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(GatekeeperdKilledWithScreenLock, self).tearDown()


    def test_gatekeeperd_killed_with_screen_lock_update(self):
        print "[RunTest]: %s" % self.__str__()
        self.securityImpl.logger.info("")
        # 1. Password
        print "[Test_type]------Set lock type with <Password> lock type------"
        time.sleep(3)
        self.securityImpl.set_screen_lock_type_all("Password", self.def_passwd)
        self.securityImpl.action_screen_lock_security("Unlock")
        self.securityImpl.unlock_screen_lock_type_all("Password", 10, self.def_passwd, self.def_passwd)
        try:
            self.securityImpl.check_gatekeeperd_running()
        finally:
            self.securityImpl.remove_screen_lock_type_all("Password", self.def_passwd)
        # 2. PIN
        print "[Test_type]------Set lock type with <PIN> lock type------"
        time.sleep(3)
        self.securityImpl.set_screen_lock_type_all("PIN", self.def_passwd, self.def_pin)
        self.securityImpl.action_screen_lock_security("Unlock")
        self.securityImpl.unlock_screen_lock_type_all("PIN", 10,self.def_passwd,self.def_passwd,self.def_pin,self.def_pin)
        try:
            self.securityImpl.check_gatekeeperd_running()
        finally:
            self.securityImpl.remove_screen_lock_type_all("PIN", self.def_passwd, self.def_pin)
        # 3. Pattern
        time.sleep(3)
        print "[Test_type]------Set lock type with <Pattern> lock type------"
        self.securityImpl.set_screen_lock_type_all("Pattern")
        self.securityImpl.action_screen_lock_security("Unlock")
        self.securityImpl.unlock_screen_lock_type_all("Pattern", 10)
        try:
            self.securityImpl.check_gatekeeperd_running()
        finally:
            self.securityImpl.remove_screen_lock_type_all("Pattern")
class ScreenLockTypeAtBootTime(UIATestBase):
    def setUp(self):
        self._test_name = __name__
        self.securityImpl = SecurityImpl()
        self.def_passwd = "qwer123"
        self.incorrect_passwd = "qwer"
        self.incorrect_passwd_long = "abcdefg123456"
        self.def_pin = 1234
        self.incorrect_pin = 1111
        self.incorrect_pin_long = 1234567890
        self.securityImpl.start_RPCServer()
        print
        print "[Setup]: %s" % self._test_name
        self.securityImpl.run_check_disk_encryption_type()
        super(ScreenLockTypeAtBootTime, self).setUp()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(ScreenLockTypeAtBootTime, self).tearDown()

    def test_boot_with_screen_lock_password(self):
        print "[RunTest]: %s" % self.__str__()
        self.securityImpl.logger.info("")
        self.securityImpl.set_screen_lock_type_all("Password", self.def_passwd)
        self.securityImpl.action_screen_lock_security("Reboot")
        self.securityImpl.unlock_screen_lock_type_all("Password", 10, self.def_passwd, self.incorrect_passwd_long,
                                                      self.def_pin, self.incorrect_pin_long)
        self.securityImpl.remove_screen_lock_type_all("Password", self.def_passwd)

    def test_boot_with_screen_lock_pin(self):
        print "[RunTest]: %s" % self.__str__()
        self.securityImpl.logger.info("")
        self.securityImpl.set_screen_lock_type_all("PIN", self.def_passwd, self.def_pin)
        self.securityImpl.action_screen_lock_security("Reboot")
        self.securityImpl.unlock_screen_lock_type_all("PIN", 10, self.def_passwd, self.incorrect_passwd_long,
                                                      self.def_pin, self.incorrect_pin_long)
        self.securityImpl.remove_screen_lock_type_all("PIN", self.def_passwd, self.def_pin)

    def test_boot_with_screen_lock_pattern(self):
        print "[RunTest]: %s" % self.__str__()
        self.securityImpl.logger.info("")
        self.securityImpl.set_screen_lock_type_all("Pattern")
        self.securityImpl.action_screen_lock_security("Reboot")
        self.securityImpl.unlock_screen_lock_type_all("Pattern", 10, "incorrect_pattern")
        self.securityImpl.remove_screen_lock_type_all("Pattern")
class DataPartitionAccess(UIATestBase):
    def setUp(self):
        self._test_name = __name__
        self.securityImpl = SecurityImpl()
        self.def_passwd = "qwer123"
        self.incorrect_passwd = "qwer"
        self.incorrect_passwd_long = "abcdefg123456"
        self.def_pin = 1234
        self.incorrect_pin = 1111
        self.incorrect_pin_long = 1234567890
        self.init_dut = InitFlashDevices()
        self.securityImpl.start_RPCServer()
        print
        print "[Setup]: %s" % self._test_name
        self.securityImpl.run_check_disk_encryption_type()
        super(DataPartitionAccess, self).setUp()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(DataPartitionAccess, self).tearDown()

    def test_data_partition_access_incorrect_key_more_than_30_times(self):
        # HP desc: need use user image
        # after 30 times, dut will be wiped forcely
        print "[RunTest]: %s" % self.__str__()
        self.securityImpl.logger.info("")
        self.securityImpl.set_screen_lock_type_all("Password", self.def_passwd)
        for i in range(3):
            self.securityImpl.action_screen_lock_security("Reboot")
            if self.securityImpl.check_screen_unlock_need_reboot_at_boot("Password", 10, self.incorrect_passwd_long) is True:
                self.securityImpl.logger.info("------<Check Test> each 10 times wrong check, AOS requires a reboot")
            else:
                print "[Retry]------ Unlock screen password"
                self.securityImpl.reboot_require_unlock_screen_passwd_pin_to_mos(self.def_passwd)
                self.securityImpl.remove_screen_lock_password(self.def_passwd)
                assert False, "[Debug]---Unlock screen lock password is Failed"
        time.sleep(20)
        self.securityImpl.logger.info('After 30 times, dut has been wiped forcely')
        self.init_dut.init_main()
        self.securityImpl.remove_screen_lock_type_all("Password", self.def_passwd)

        print "[RunTest]: %s" % self.__str__()
        self.securityImpl.logger.info("")
        self.securityImpl.set_screen_lock_type_all("PIN", self.def_passwd, self.def_pin)
        for i in range(3):
            self.securityImpl.action_screen_lock_security("Reboot")
            if self.securityImpl.check_screen_unlock_need_reboot_at_boot("PIN", 10, self.def_passwd,self.incorrect_pin_long) is True:
                self.securityImpl.logger.info("------<Check Test> each 10 times wrong check, AOS requires a reboot")
            else:
                print "[Retry]------ Unlock screen PIN"
                self.securityImpl.reboot_require_unlock_screen_passwd_pin_to_mos(self.def_pin)
                self.securityImpl.remove_screen_lock_pin(self.def_pin)
                assert False, "[Debug]---Unlock screen lock PIN is Failed"
        time.sleep(20)
        self.securityImpl.logger.info('After 30 times, dut has been wiped forcely')
        self.init_dut.init_main()
        self.securityImpl.remove_screen_lock_type_all("PIN", self.def_passwd, self.def_pin)

        print "[RunTest]: %s" % self.__str__()
        self.securityImpl.logger.info("")
        self.securityImpl.set_screen_lock_type_all("Pattern")
        for i in range(2):
            self.securityImpl.action_screen_lock_security("Reboot")
            if self.securityImpl.unlock_screen_lock_incorrect_pattern(10) is True:
                self.securityImpl.logger.info("------<Check Test> each 10 times wrong check, AOS requires a reboot")
            else:
                print "[Retry]------ Unlock screen Pattern"
                self.securityImpl.reboot_unlock_reusme_unlock_pattern()
                self.securityImpl.remove_screen_lock_pattern()
                assert False, "[Debug]---Unlock screen lock Pattern is Failed"
        self.securityImpl.action_screen_lock_security("Reboot")
        self.securityImpl.unlock_screen_lock_incorrect_pattern(10)
        time.sleep(30)
        self.securityImpl.logger.info('After 30 times, dut has been wiped forcely')
        self.init_dut.init_main()
        self.securityImpl.remove_screen_lock_type_all("Pattern")
class ScreenLockToNoPassword(UIATestBase):

    # HP desc: need use user image
    def setUp(self):
        self._test_name = __name__
        self.securityImpl = SecurityImpl()
        print
        self.def_passwd = "qwer123"
        self.def_pin = 1234
        self.def_pattern = 14789
        print "[Setup]: %s" % self._test_name
        super(ScreenLockToNoPassword, self).setUp()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        super(ScreenLockToNoPassword, self).tearDown()

    def test_screen_lock_to_no_password(self):
        print "[RunTest]: %s" % self.__str__()
        self.securityImpl.logger.info("")
        # 1. Password
        print "[Test_type]------Set lock type with <Password> lock type------"
        time.sleep(3)
        self.securityImpl.set_screen_lock_type_all("Password", self.def_passwd)
        self.securityImpl.action_screen_lock_security("Unlock")
        self.securityImpl.unlock_screen_lock_type_all("Password", 5, self.def_passwd, self.def_passwd)
        self.securityImpl.remove_screen_lock_type_all("Password", self.def_passwd)
        self.securityImpl.choose_screen_lock("None")
        self.securityImpl.action_screen_lock_security("Unlock")
        self.securityImpl.boot_up_completed_skip_boot_ui()
        self.securityImpl.check_unlock_no_passwd_pin_pattern()
        # 2. PIN
        print "[Test_type]------Set lock type with <PIN> lock type------"
        time.sleep(3)
        self.securityImpl.set_screen_lock_type_all("PIN", self.def_passwd, self.def_pin)
        self.securityImpl.action_screen_lock_security("Unlock")
        self.securityImpl.unlock_screen_lock_type_all("PIN", 5,self.def_passwd,self.def_passwd,self.def_pin,self.def_pin)
        self.securityImpl.remove_screen_lock_type_all("PIN", self.def_passwd, self.def_pin)
        self.securityImpl.choose_screen_lock("None")
        self.securityImpl.action_screen_lock_security("Unlock")
        self.securityImpl.boot_up_completed_skip_boot_ui()
        self.securityImpl.check_unlock_no_passwd_pin_pattern()
        # 3. Pattern
        time.sleep(3)
        print "[Test_type]------Set lock type with <Pattern> lock type------"
        self.securityImpl.set_screen_lock_type_all("Pattern")
        self.securityImpl.action_screen_lock_security("Unlock")
        self.securityImpl.unlock_screen_lock_type_all("Pattern", 5)
        self.securityImpl.remove_screen_lock_type_all("Pattern")
        self.securityImpl.choose_screen_lock("None")
        self.securityImpl.action_screen_lock_security("Unlock")
        self.securityImpl.boot_up_completed_skip_boot_ui()
        self.securityImpl.check_unlock_no_passwd_pin_pattern()