blob: 262ca0da0fc14163e710a88369d9e13763304fc3 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<script type="text/javascript">
shouldBeDefined("navigator.webkitStartActivity");
shouldThrow("var intent = new WebKitIntent()", "'TypeError: Not enough arguments'");;
shouldThrow("new WebKitIntent('a')", "'Error: SYNTAX_ERR: DOM Exception 12'");
shouldThrow("new WebKitIntent('','','')", "'Error: SYNTAX_ERR: DOM Exception 12'");
shouldThrow("new WebKitIntent('','b','c')", "'Error: SYNTAX_ERR: DOM Exception 12'");
shouldThrow("new WebKitIntent('','','c')", "'Error: SYNTAX_ERR: DOM Exception 12'");
shouldThrow("new WebKitIntent('a','','c')", "'Error: SYNTAX_ERR: DOM Exception 12'");
var intent1 = new WebKitIntent('a', 'b');
shouldBeEqualToString("intent1.action", "a");
shouldBeEqualToString("intent1.type", "b");
shouldBeUndefined("intent1.data");
intent1.action = "abc";
shouldBeEqualToString("intent1.action", "a");
var intent2 = new WebKitIntent("a", "b", "c");
shouldBeEqualToString('intent2.action', "a");
shouldBeEqualToString('intent2.type', "b");
shouldBeEqualToString('intent2.data', "c");
var intent3 = new WebKitIntent("a", "b", {"c": "d"});
shouldBeEqualToString('intent3.action', "a");
shouldBeEqualToString('intent3.type', "b");
shouldBeEqualToString('intent3.data.c', "d");
var intent4 = new WebKitIntent("a", "b", ["c", "d"]);
shouldBeEqualToString('intent4.action', "a");
shouldBeEqualToString('intent4.type', "b");
shouldBeTrue('intent4.data instanceof Array');
shouldEvaluateTo('intent4.data.length', 2);
shouldBeEqualToString('intent4.data[0]', "c");
shouldBeEqualToString('intent4.data[1]', "d");
var intent5 = new WebKitIntent("a", "b", 4);
shouldEvaluateTo('intent5.data', 4);
var intent6 = new WebKitIntent('a', 'b', 4.5);
shouldEvaluateTo('intent6.data', 4.5);
var intent7 = new WebKitIntent('a', 'b', true);
shouldBeTrue('intent7.data');
var intent8 = new WebKitIntent('a', 'b', null);
shouldBeNull('intent8.data');
var intent9 = new WebKitIntent('a', 'b', {});
shouldEvaluateTo('intent9.data', {});
shouldThrow('navigator.webkitStartActivity(intent1)', "'Error: INVALID_ACCESS_ERR: DOM Exception 15'");
</script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>