macos_test.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:pyu2f 作者: google 项目源码 文件源码
def testCallReadSuccess(self, thread, iokit, cf, GetDeviceIntProperty):  # pylint: disable=invalid-name
    init_mock_iokit(iokit)
    init_mock_cf(cf)
    init_mock_get_int_property(GetDeviceIntProperty)

    device = macos.MacOsHidDevice('fakepath')

    # Call callback for IN report
    report = (ctypes.c_uint8 * 64)()
    report[:] = range(64)[:]
    q = device.read_queue
    macos.HidReadCallback(q, None, None, None, 0, report, 64)

    # Device read should return the callback data
    read_result = device.Read()
    self.assertEquals(read_result, range(64), 'Read data should match data '
                      'passed into the callback')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号