--- /dev/null
+<html>
+<body onload="test();">
+</body>
+<script>
+function test() {
+ if (navigator.registerProtocolHandler) {
+ var str = "navigator.registerProtocolHandler is supported!";
+ console.log(str);
+ document.title = str;
+ // registerProtocolHandler example from Mozilla Developer Network
+ navigator.registerProtocolHandler("web+burger",
+ "http://jmajnert.github.io/tests/customProtocols/?uri=%s",
+ "Burger handler");
+ str = "burger protocol handler registered!";
+ console.log(str);
+ document.title = str;
+ } else {
+ var str = "navigator.registerProtocolHandler is not supported!";
+ console.log(str);
+ document.title = str;
+ }
+}
+</script>
+</html>
class utc_blink_ewk_custom_handlers_data_target_get: public utc_blink_ewk_base {
protected:
+ utc_blink_ewk_custom_handlers_data_target_get() : target_(NULL) {}
+ ~utc_blink_ewk_custom_handlers_data_target_get() { free(target_); }
+
void PostSetUp()
{
evas_object_smart_callback_add(GetEwkWebView(),"protocolhandler,registration,requested", (void(*)(void*, Evas_Object*, void*))custom_handler, this);
ASSERT_TRUE(NULL != owner);
ASSERT_TRUE(NULL != custom_handler_data);
- ASSERT_STREQ("tel", ewk_custom_handlers_data_target_get(custom_handler_data));
+ const char* target = ewk_custom_handlers_data_target_get(custom_handler_data);
+ owner->target_ = (target ? strdup(target) : NULL);
owner->EventLoopStop(Success);
}
+
+protected:
+ char* target_;
+ static const char* const expected_target_;
};
+const char* const utc_blink_ewk_custom_handlers_data_target_get::expected_target_ = "web+burger";
+
/**
* @brief Checking if base_url is returned properly.
*/
TEST_F(utc_blink_ewk_custom_handlers_data_target_get, POS_TEST)
{
- ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), "http://codebits.glennjones.net/registerprotocol/register.html"));
+ ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), "http://jmajnert.github.io/tests/customProtocols/"));
ASSERT_EQ(Success, EventLoopStart());
+ ASSERT_STREQ(expected_target_, target_);
}
/**
class utc_blink_ewk_custom_handlers_data_title_get: public utc_blink_ewk_base {
protected:
+ utc_blink_ewk_custom_handlers_data_title_get() : title_(NULL) {}
+ ~utc_blink_ewk_custom_handlers_data_title_get() {
+ free(title_);
+ }
+
void PostSetUp()
{
evas_object_smart_callback_add(GetEwkWebView(),"protocolhandler,registration,requested", (void(*)(void*, Evas_Object*, void*))custom_handler, this);
ASSERT_TRUE(NULL != owner);
ASSERT_TRUE(NULL != custom_handler_data);
- ASSERT_STREQ("Telephony App", ewk_custom_handlers_data_title_get(custom_handler_data));
+ const char *title = ewk_custom_handlers_data_title_get(custom_handler_data);
+ owner->title_ = (title ? strdup(title) : NULL);
owner->EventLoopStop(Success);
}
+
+protected:
+ char* title_;
+ static const char* const expected_title_;
};
+const char* const utc_blink_ewk_custom_handlers_data_title_get::expected_title_ = "Burger handler";
+
/**
* @brief Checking if base_url is returned properly.
*/
TEST_F(utc_blink_ewk_custom_handlers_data_title_get, POS_TEST)
{
- ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), "http://codebits.glennjones.net/registerprotocol/register.html"));
- ASSERT_EQ(Success, EventLoopStart());
+ ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), "http://jmajnert.github.io/tests/customProtocols/"));
+ ASSERT_EQ(Success, EventLoopStart()) << "\"protocolhandler,registration,requested\" was not fired.";
+ ASSERT_STREQ(expected_title_, title_);
}
/**
class utc_blink_ewk_custom_handlers_data_url_get: public utc_blink_ewk_base {
protected:
+ utc_blink_ewk_custom_handlers_data_url_get() : url_(NULL) {}
+ ~utc_blink_ewk_custom_handlers_data_url_get() { free(url_); }
+
void PostSetUp()
{
evas_object_smart_callback_add(GetEwkWebView(),"protocolhandler,registration,requested", (void(*)(void*, Evas_Object*, void*))custom_handler, this);
ASSERT_TRUE(NULL != owner);
ASSERT_TRUE(NULL != custom_handler_data);
- ASSERT_STREQ("http://codebits.glennjones.net/registerprotocol/register.html?%s", ewk_custom_handlers_data_url_get(custom_handler_data));
+ const char* url = ewk_custom_handlers_data_url_get(custom_handler_data);
+ owner->url_ = (url ? strdup(url) : NULL);
owner->EventLoopStop(Success);
}
+
+protected:
+ char* url_;
+ static const char* const expected_url_;
};
+const char* const utc_blink_ewk_custom_handlers_data_url_get::expected_url_ = "http://jmajnert.github.io/tests/customProtocols/?uri=%s";
+
/**
* @brief Checking if base_url is returned properly.
*/
TEST_F(utc_blink_ewk_custom_handlers_data_url_get, POS_TEST)
{
- ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), "http://codebits.glennjones.net/registerprotocol/register.html"));
+ ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), "http://jmajnert.github.io/tests/customProtocols/"));
ASSERT_EQ(Success, EventLoopStart());
+ ASSERT_STREQ(expected_url_, url_);
}
/**