Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: LayoutTests/perf/document-contains.html

Issue 51383002: Delete perf tests that are WontFixed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: try again Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../resources/magnitude-perf.js"></script>
3 <body>
4 <script>
5
6 var doc, node, expected;
7
8 function appendDeepTree(magnitude)
9 {
10 for (var i = 0; i < magnitude; i++) {
11 node = node.appendChild(doc.createElement('div'));
12 }
13 }
14
15
16 // Tests that contains is O(1) for document where the test |node| is in the docu ment.
17
18 function setup1(magnitude)
19 {
20 node = document.body;
21 doc = document;
22 expected = true;
23 appendDeepTree(magnitude);
24 }
25
26 // Tests that contains is O(1) for document when the test |node| is not in the d ocument.
27
28 function setup2(magnitude)
29 {
30 node = document.createElement('div'); // Not added to the document
31 doc = document;
32 expected = false;
33 appendDeepTree(magnitude);
34 }
35
36 // Tests that contains is O(1) for document when the test |node| is in a differe nt document.
37
38 function setup3(magnitude)
39 {
40 var iframe = document.body.appendChild(document.createElement('iframe'));
41 doc = iframe.contentDocument;
42 node = doc.body; // Different document.
43 expected = false;
44 appendDeepTree(magnitude);
45 }
46
47 function test(magnitude)
48 {
49 var actual = document.contains(node);
50 if (actual !== expected)
51 throw 'Unexpected return value: ' + actual + ', expected: ' + expected;
52 }
53
54 Magnitude.description('Tests that document.contains is O(1).');
55 Magnitude.tolerance = 0.50;
56 Magnitude.trim = 2;
57 Magnitude.run(setup1, test, Magnitude.CONSTANT);
58 Magnitude.run(setup2, test, Magnitude.CONSTANT);
59 Magnitude.run(setup3, test, Magnitude.CONSTANT);
60
61 </script>
62 </body>
OLDNEW
« no previous file with comments | « LayoutTests/perf/clone-with-focus-expected.txt ('k') | LayoutTests/perf/document-contains-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698