79
79
const struct ril_msg msg;
82
struct oem_hook_raw_test {
83
const unsigned char *data;
85
const struct ril_msg msg;
82
88
/* Invalid RIL_REQUEST_DATA_REGISTRATION_STATE: buffer too small */
83
89
static const struct ril_msg reply_data_reg_state_invalid_1 = {
1461
* The following structure contains test data for a valid
1462
* RIL_REQUEST_OEM_HOOK_RAW reply with parameter {4,0x11111111}
1464
static const guchar reply_oem_hook_raw_valid_parcel1[] = {
1465
0x04, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11
1468
static const struct oem_hook_raw_test reply_oem_hook_raw_valid_1 = {
1469
.data = reply_oem_hook_raw_valid_parcel1 + sizeof(int32_t),
1470
.size = (int) (sizeof(reply_oem_hook_raw_valid_parcel1)
1473
.buf = (gchar *) reply_oem_hook_raw_valid_parcel1,
1474
.buf_len = sizeof(reply_oem_hook_raw_valid_parcel1),
1475
.unsolicited = FALSE,
1476
.req = RIL_REQUEST_OEM_HOOK_RAW,
1478
.error = RIL_E_SUCCESS,
1483
* The following structure contains test data for a valid
1484
* RIL_REQUEST_OEM_HOOK_RAW reply with parameter {-1}
1486
static const guchar reply_oem_hook_raw_valid_parcel2[] = {
1487
0xFF, 0xFF, 0xFF, 0xFF
1490
static const struct oem_hook_raw_test reply_oem_hook_raw_valid_2 = {
1494
.buf = (gchar *) reply_oem_hook_raw_valid_parcel2,
1495
.buf_len = sizeof(reply_oem_hook_raw_valid_parcel2),
1496
.unsolicited = FALSE,
1497
.req = RIL_REQUEST_OEM_HOOK_RAW,
1499
.error = RIL_E_SUCCESS,
1454
1503
static void test_reply_reg_state_invalid(gconstpointer data)
1456
1505
struct reply_reg_state *reply = g_ril_reply_parse_reg_state(NULL, data);
1669
1718
g_free(retries);
1721
static void test_reply_oem_hook_raw_valid(gconstpointer data)
1723
const struct oem_hook_raw_test *test = data;
1724
struct reply_oem_hook *reply =
1725
g_ril_reply_oem_hook_raw(NULL, &test->msg);
1727
g_assert(reply->length == test->size);
1728
if (reply->length >= 0)
1729
g_assert(!memcmp(reply->data, test->data, test->size));
1731
g_assert(reply->data == NULL);
1674
1736
int main(int argc, char **argv)
1958
2020
&reply_enter_sim_pin_valid_2,
1959
2021
test_reply_enter_sim_pin_valid);
2023
g_test_add_data_func("/testgrilreply/oem: "
2024
"valid OEM_HOOK_RAW Test 1",
2025
&reply_oem_hook_raw_valid_1,
2026
test_reply_oem_hook_raw_valid);
2028
g_test_add_data_func("/testgrilreply/oem: "
2029
"valid OEM_HOOK_RAW Test 2",
2030
&reply_oem_hook_raw_valid_2,
2031
test_reply_oem_hook_raw_valid);
1963
2035
return g_test_run();