Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 <!--This test should be updated each time new functionality is added to SimpleTest-->
2 <!DOCTYPE HTML>
3 <html>
4 <head>
5 <title>Profiling test suite for SimpleTest</title>
6 <script type="text/javascript">
7 var start = new Date();
8 </script>
9 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
11 <script type="text/javascript">
12 var loadTime = new Date();
13 </script>
14 </head>
15 <body>
16 <input id="textB"/>
17 <script class="testbody" type="text/javascript">
18 info("Profile::SimpleTestLoadTime: " + (loadTime - start));
19 var startTime = new Date();
20 SimpleTest.waitForExplicitFinish();
21 function starttest() {
22 SimpleTest.waitForFocus(
23 function() {
24 //test log
25 info("Logging some info")
27 //basic usage
28 ok(true, "test ok", "This should be true");
29 is(0, 0, "is() test failed");
30 isnot(0, 1, "isnot() test failed");
32 //todo tests
33 todo(false, "test todo", "todo() test should not pass");
34 todo_is(false, true, "test todo_is");
35 todo_isnot(true, true, "test todo_isnot");
37 //misc
38 is(typeof(SimpleTest.testPluginIsOOP()), "boolean", 'testPluginIsOOP should be bool');
39 SimpleTest.requestLongerTimeout(1);
41 //note: this test may alter runtimes as it waits
42 var check = false;
43 $('textB').focus();
44 SimpleTest.waitForClipboard("a",
45 function () {
46 SpecialPowers.clipboardCopyString("a");
47 },
48 function () {
49 check = true;
50 },
51 function () {
52 check = false;
53 }
54 );
55 is(check, true, "waitForClipboard should work");
57 //use helper functions
58 var div1 = createEl('div', {'id': 'somediv', 'display': 'block'}, "I am a div");
59 document.body.appendChild(div1);
60 var divObj = this.getElement('somediv');
61 is(divObj, div1, 'createEl did not create element as expected');
62 is($('somediv'), divObj, '$ helper did not get element as expected');
63 is(computedStyle(divObj, 'display'), 'block', 'computedStyle did not get right display value');
64 document.body.removeChild(div1);
66 /* note: expectChildProcessCrash is not being tested here, as it causes wildly variable
67 * run times. It is currently being tested in:
68 * dom/plugins/test/test_hanging.html and dom/plugins/test/test_crashing.html
69 */
71 //note: this also adds a short wait period
72 SimpleTest.executeSoon(
73 function () {
74 //finish() calls a slew of SimpleTest functions
75 SimpleTest.finish();
76 //call this after finish so we can make sure it works and doesn't hang our process
77 var endTime = new Date();
78 info("Profile::SimpleTestRunTime: " + (endTime-startTime));
79 //expect and throw exception here. Otherwise, any code that follows the throw call will never be executed
80 SimpleTest.expectUncaughtException();
81 //make sure we catch this error
82 throw "i am an uncaught exception"
83 }
84 );
85 }
86 );
87 };
88 //use addLoadEvent
89 addLoadEvent(
90 function() {
91 starttest();
92 }
93 );
94 </script>
95 </body>
96 </html>