#define VIEW_ID "login"
+static GMainLoop *g_mainloop = NULL;
+static const char *g_app_id = "org.tizen.autofill-test";
+static bool g_connected = false;
+
namespace {
//LCOV_EXCL_START
}
//LCOV_EXCL_STOP
+static void connect_status_changed_cb(autofill_h ah, autofill_connection_status_e status, void* user_data)
+{
+ if (status == AUTOFILL_CONNECTION_STATUS_CONNECTED)
+ g_connected = true;
+
+ if (g_mainloop) {
+ g_main_loop_quit(g_mainloop);
+ g_mainloop = NULL;
+ }
+}
+
class AutofillClientTest : public testing::Test {
public:
autofill_h af_h = NULL;
}
/**
+ * @testcase utc_autofill_cancel_fill_request_p
+ * @since_tizen 5.5
+ * @description Positive UTC of the function that cancels fill request without autofill item.
+ */
+TEST_F(AutofillClientTest, utc_autofill_cancel_fill_request_p)
+{
+ int ret = AUTOFILL_ERROR_NONE;
+ autofill_view_info_h vi_h;
+
+ ret = autofill_connect(af_h, connect_status_changed_cb, NULL);
+ EXPECT_EQ(ret, AUTOFILL_ERROR_NONE);
+
+ g_mainloop = g_main_loop_new(NULL, false);
+ g_main_loop_run(g_mainloop);
+
+ autofill_view_info_create(&vi_h);
+ if (g_app_id)
+ autofill_view_info_set_app_id(vi_h, g_app_id);
+
+ autofill_view_info_set_view_id(vi_h, VIEW_ID);
+
+ ret = autofill_cancel_fill_request(af_h, vi_h);
+
+ autofill_view_info_destroy(vi_h);
+
+ EXPECT_EQ(ret, AUTOFILL_ERROR_NONE);
+}
+
+/**
+ * @testcase utc_autofill_cancel_fill_request_p2
+ * @since_tizen 5.5
+ * @description Positive UTC of the function that cancels fill request with autofill item.
+ */
+TEST_F(AutofillClientTest, utc_autofill_cancel_fill_request_p2)
+{
+ int ret = AUTOFILL_ERROR_NONE;
+ autofill_view_info_h vi_h;
+
+ ret = autofill_connect(af_h, connect_status_changed_cb, NULL);
+ EXPECT_EQ(ret, AUTOFILL_ERROR_NONE);
+
+ g_mainloop = g_main_loop_new(NULL, false);
+ g_main_loop_run(g_mainloop);
+
+ autofill_view_info_create(&vi_h);
+ if (g_app_id)
+ autofill_view_info_set_app_id(vi_h, g_app_id);
+
+ autofill_view_info_set_view_id(vi_h, VIEW_ID);
+
+ // create autofill item
+ autofill_item_h ai_h;
+ autofill_item_create(&ai_h);
+ autofill_item_set_autofill_hint(ai_h, AUTOFILL_HINT_NAME);
+ autofill_item_set_id(ai_h, "id");
+ autofill_item_set_label(ai_h, "label");
+ autofill_item_set_sensitive_data(ai_h, false);
+
+ autofill_view_info_add_item(vi_h, ai_h);
+
+ ret = autofill_cancel_fill_request(af_h, vi_h);
+
+ autofill_view_info_destroy(vi_h);
+
+ EXPECT_EQ(ret, AUTOFILL_ERROR_NONE);
+}
+
+/**
* @testcase utc_autofill_fill_response_set_received_cb_p
* @since_tizen 5.5
* @description Positive UTC of the function that sets fill response received callback.