1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/general/test_consoleAPI.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,61 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 + <title>window.console test</title> 1.8 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.9 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> 1.10 +</head> 1.11 + 1.12 +<body id="body"> 1.13 + 1.14 +<script type="application/javascript;version=1.8"> 1.15 + 1.16 +function doTest() { 1.17 + ok(window.console, "console exists"); 1.18 + 1.19 + try { 1.20 + ok(!console.foo, "random property doesn't throw"); 1.21 + } catch (ex) { 1.22 + ok(false, "random property threw: " + ex); 1.23 + } 1.24 + 1.25 + var expectedProps = { 1.26 + "log": "function", 1.27 + "info": "function", 1.28 + "warn": "function", 1.29 + "error": "function", 1.30 + "exception": "function", 1.31 + "debug": "function", 1.32 + "trace": "function", 1.33 + "dir": "function", 1.34 + "group": "function", 1.35 + "groupCollapsed": "function", 1.36 + "groupEnd": "function", 1.37 + "time": "function", 1.38 + "timeEnd": "function", 1.39 + "profile": "function", 1.40 + "profileEnd": "function", 1.41 + "assert": "function", 1.42 + "count": "function", 1.43 + "__noSuchMethod__": "function" 1.44 + }; 1.45 + 1.46 + var foundProps = 0; 1.47 + for (var prop in console) { 1.48 + foundProps++; 1.49 + is(typeof(console[prop]), expectedProps[prop], "expect console prop " + prop + " exists"); 1.50 + } 1.51 + is(foundProps, Object.keys(expectedProps).length, "found correct number of properties"); 1.52 + 1.53 + SimpleTest.finish(); 1.54 +} 1.55 + 1.56 +SimpleTest.waitForExplicitFinish(); 1.57 +addLoadEvent(doTest); 1.58 + 1.59 +</script> 1.60 + 1.61 +<p id="display"></p> 1.62 + 1.63 +</body> 1.64 +</html>