1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/testing/mochitest/tests/Harness_sanity/test_sanitySimpletest.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,96 @@ 1.4 +<!--This test should be updated each time new functionality is added to SimpleTest--> 1.5 +<!DOCTYPE HTML> 1.6 +<html> 1.7 +<head> 1.8 + <title>Profiling test suite for SimpleTest</title> 1.9 + <script type="text/javascript"> 1.10 + var start = new Date(); 1.11 + </script> 1.12 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.14 + <script type="text/javascript"> 1.15 + var loadTime = new Date(); 1.16 + </script> 1.17 +</head> 1.18 +<body> 1.19 +<input id="textB"/> 1.20 +<script class="testbody" type="text/javascript"> 1.21 +info("Profile::SimpleTestLoadTime: " + (loadTime - start)); 1.22 +var startTime = new Date(); 1.23 +SimpleTest.waitForExplicitFinish(); 1.24 +function starttest() { 1.25 + SimpleTest.waitForFocus( 1.26 + function() { 1.27 + //test log 1.28 + info("Logging some info") 1.29 + 1.30 + //basic usage 1.31 + ok(true, "test ok", "This should be true"); 1.32 + is(0, 0, "is() test failed"); 1.33 + isnot(0, 1, "isnot() test failed"); 1.34 + 1.35 + //todo tests 1.36 + todo(false, "test todo", "todo() test should not pass"); 1.37 + todo_is(false, true, "test todo_is"); 1.38 + todo_isnot(true, true, "test todo_isnot"); 1.39 + 1.40 + //misc 1.41 + is(typeof(SimpleTest.testPluginIsOOP()), "boolean", 'testPluginIsOOP should be bool'); 1.42 + SimpleTest.requestLongerTimeout(1); 1.43 + 1.44 + //note: this test may alter runtimes as it waits 1.45 + var check = false; 1.46 + $('textB').focus(); 1.47 + SimpleTest.waitForClipboard("a", 1.48 + function () { 1.49 + SpecialPowers.clipboardCopyString("a"); 1.50 + }, 1.51 + function () { 1.52 + check = true; 1.53 + }, 1.54 + function () { 1.55 + check = false; 1.56 + } 1.57 + ); 1.58 + is(check, true, "waitForClipboard should work"); 1.59 + 1.60 + //use helper functions 1.61 + var div1 = createEl('div', {'id': 'somediv', 'display': 'block'}, "I am a div"); 1.62 + document.body.appendChild(div1); 1.63 + var divObj = this.getElement('somediv'); 1.64 + is(divObj, div1, 'createEl did not create element as expected'); 1.65 + is($('somediv'), divObj, '$ helper did not get element as expected'); 1.66 + is(computedStyle(divObj, 'display'), 'block', 'computedStyle did not get right display value'); 1.67 + document.body.removeChild(div1); 1.68 + 1.69 + /* note: expectChildProcessCrash is not being tested here, as it causes wildly variable 1.70 + * run times. It is currently being tested in: 1.71 + * dom/plugins/test/test_hanging.html and dom/plugins/test/test_crashing.html 1.72 + */ 1.73 + 1.74 + //note: this also adds a short wait period 1.75 + SimpleTest.executeSoon( 1.76 + function () { 1.77 + //finish() calls a slew of SimpleTest functions 1.78 + SimpleTest.finish(); 1.79 + //call this after finish so we can make sure it works and doesn't hang our process 1.80 + var endTime = new Date(); 1.81 + info("Profile::SimpleTestRunTime: " + (endTime-startTime)); 1.82 + //expect and throw exception here. Otherwise, any code that follows the throw call will never be executed 1.83 + SimpleTest.expectUncaughtException(); 1.84 + //make sure we catch this error 1.85 + throw "i am an uncaught exception" 1.86 + } 1.87 + ); 1.88 + } 1.89 + ); 1.90 +}; 1.91 +//use addLoadEvent 1.92 +addLoadEvent( 1.93 + function() { 1.94 + starttest(); 1.95 + } 1.96 +); 1.97 +</script> 1.98 +</body> 1.99 +</html>