/** * @brief Initialize the store library and all it's required submodules. * @return 1 or greater on success, 0 otherwise. */ int store_init(void) { if (++_store_init_count != 1) return _store_init_count; if (!eina_init()) { fprintf(stderr, "Store can not initialize Eina\n"); return --_store_init_count; } _store_log_dom_global = eina_log_domain_register("store", EINA_COLOR_RED); if (_store_log_dom_global < 0) { EINA_LOG_ERR("Store can not create a general log domain"); goto shutdown_eina; } if (!ecore_init()) { ERR("Can not initialize Ecore"); goto unregister_log_domain; } if (!ecore_con_init()) { ERR("Can not initialize Ecore_Con"); goto shutdown_ecore; } if (!ecore_con_url_init()) { ERR("Can not initialize Ecore_Con_Url"); goto shutdown_ecore_con; } if (!ecore_con_url_pipeline_get()) ecore_con_url_pipeline_set(EINA_TRUE); return _store_init_count; shutdown_ecore_con: ecore_con_shutdown(); shutdown_ecore: ecore_shutdown(); unregister_log_domain: eina_log_domain_unregister(_store_log_dom_global); _store_log_dom_global = -1; shutdown_eina: eina_shutdown(); return --_store_init_count; }
END_TEST #endif #ifdef ECORE_CON_HTTP_TEST_URL START_TEST(ecore_con_test_ecore_con_url_post) { Ecore_Con_Url *ec_url; url_test *info; int ret; char link[] = ECORE_CON_HTTP_TEST_URL; char url_data[] = "test"; char *username = NULL, *password = NULL; char url[4096]; ret = eina_init(); fail_if(ret != 1); ret = ecore_con_url_init(); fail_if(ret != 1); fail_unless(_parse_url(link, url, &username, &password, NULL, NULL)); fprintf (stderr, "HTTP: \n url = %s \n username = %s \n password = %s \n", url, username, password); ecore_con_url_pipeline_set(EINA_TRUE); fail_unless (ecore_con_url_pipeline_get()); ec_url = ecore_con_url_custom_new(url, "POST"); fail_unless (ec_url); ecore_con_url_additional_header_add(ec_url, "User-Agent", "blablabla"); ecore_con_url_verbose_set(ec_url, EINA_TRUE); ecore_con_url_httpauth_set(ec_url, username, password, EINA_FALSE); ecore_con_url_time(ec_url, ECORE_CON_URL_TIME_IFMODSINCE, 0); fail_unless(ecore_con_url_post(ec_url, url_data, 4, NULL)); ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _url_compl_cb, info); ret = ecore_con_url_shutdown(); fail_if(ret != 0); ret = eina_shutdown(); }