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

Side by Side Diff: LayoutTests/dom/svg/level3/xpath/XPathResult_snapshotItem_ORDERED_NODE_SNAPSHOT_TYPE_order.js

Issue 756123002: Remove tabs and trailing whitspace in LayoutTests/dom/.../*.js (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years 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
1
2 /* 1 /*
3 Copyright © 2001-2004 World Wide Web Consortium, 2 Copyright © 2001-2004 World Wide Web Consortium,
4 (Massachusetts Institute of Technology, European Research Consortium 3 (Massachusetts Institute of Technology, European Research Consortium
5 for Informatics and Mathematics, Keio University). All 4 for Informatics and Mathematics, Keio University). All
6 Rights Reserved. This work is distributed under the W3C® Software License [1] i n the 5 Rights Reserved. This work is distributed under the W3C® Software License [1] i n the
7 hope that it will be useful, but WITHOUT ANY WARRANTY; without even 6 hope that it will be useful, but WITHOUT ANY WARRANTY; without even
8 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 7 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 8
10 [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 9 [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
11 */ 10 */
12 11
13
14 // expose test function names 12 // expose test function names
15 function exposeTestFunctionNames() 13 function exposeTestFunctionNames()
16 { 14 {
17 return ['XPathResult_snapshotItem_ORDERED_NODE_SNAPSHOT_TYPE_order']; 15 return ['XPathResult_snapshotItem_ORDERED_NODE_SNAPSHOT_TYPE_order'];
18 } 16 }
19 17
20 var docsLoaded = -1000000; 18 var docsLoaded = -1000000;
21 var builder = null; 19 var builder = null;
22 20
23 // 21 //
24 // This function is called by the testing framework before 22 // This function is called by the testing framework before
25 // running the test suite. 23 // running the test suite.
26 // 24 //
27 // If there are no configuration exceptions, asynchronous 25 // If there are no configuration exceptions, asynchronous
28 // document loading is started. Otherwise, the status 26 // document loading is started. Otherwise, the status
29 // is set to complete and the exception is immediately 27 // is set to complete and the exception is immediately
30 // raised when entering the body of the test. 28 // raised when entering the body of the test.
31 // 29 //
32 function setUpPage() { 30 function setUpPage() {
33 setUpPageStatus = 'running'; 31 setUpPageStatus = 'running';
34 try { 32 try {
35 // 33 //
36 // creates test document builder, may throw exception 34 // creates test document builder, may throw exception
37 // 35 //
38 builder = createConfiguredBuilder(); 36 builder = createConfiguredBuilder();
39 37
40 docsLoaded = 0; 38 docsLoaded = 0;
41 39
42 var docRef = null; 40 var docRef = null;
43 if (typeof(this.doc) != 'undefined') { 41 if (typeof(this.doc) != 'undefined') {
44 docRef = this.doc; 42 docRef = this.doc;
45 } 43 }
46 docsLoaded += preload(docRef, "doc", "staff"); 44 docsLoaded += preload(docRef, "doc", "staff");
47 45
48 if (docsLoaded == 1) { 46 if (docsLoaded == 1) {
49 setUpPageStatus = 'complete'; 47 setUpPageStatus = 'complete';
50 } 48 }
51 } catch(ex) { 49 } catch(ex) {
52 » catchInitializationError(builder, ex); 50 catchInitializationError(builder, ex);
53 setUpPageStatus = 'complete'; 51 setUpPageStatus = 'complete';
54 } 52 }
55 } 53 }
56 54
57
58
59 // 55 //
60 // This method is called on the completion of 56 // This method is called on the completion of
61 // each asychronous load started in setUpTests. 57 // each asychronous load started in setUpTests.
62 // 58 //
63 // When every synchronous loaded document has completed, 59 // When every synchronous loaded document has completed,
64 // the page status is changed which allows the 60 // the page status is changed which allows the
65 // body of the test to be executed. 61 // body of the test to be executed.
66 function loadComplete() { 62 function loadComplete() {
67 if (++docsLoaded == 1) { 63 if (++docsLoaded == 1) {
68 setUpPageStatus = 'complete'; 64 setUpPageStatus = 'complete';
69 } 65 }
70 } 66 }
71 67
72
73 /** 68 /**
74 * 69 *
75 Create an XPathResult ORDERED_NODE_SNAPSHOT_TYPE XPathResultType for 70 Create an XPathResult ORDERED_NODE_SNAPSHOT_TYPE XPathResultType for
76 expression /staff/employee/employeeId/text() checking that: 71 expression /staff/employee/employeeId/text() checking that:
77 XPathResult.snapshotItem(0..3) are in document order. 72 XPathResult.snapshotItem(0..3) are in document order.
78 73
79 * @author Bob Clary 74 * @author Bob Clary
80 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult -snapshot-length 75 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult -snapshot-length
81 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult -snapshotItem 76 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult -snapshotItem
82 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult 77 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult
83 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult Type 78 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult Type
84 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvalua tor-createNSResolver 79 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvalua tor-createNSResolver
85 */ 80 */
86 function XPathResult_snapshotItem_ORDERED_NODE_SNAPSHOT_TYPE_order() { 81 function XPathResult_snapshotItem_ORDERED_NODE_SNAPSHOT_TYPE_order() {
87 var success; 82 var success;
88 if(checkInitialization(builder, "XPathResult_snapshotItem_ORDERED_NODE_SNAPS HOT_TYPE_order") != null) return; 83 if(checkInitialization(builder, "XPathResult_snapshotItem_ORDERED_NODE_SNAPS HOT_TYPE_order") != null) return;
(...skipping 14 matching lines...) Expand all
103 var inresult = null; 98 var inresult = null;
104 99
105 var outresult = null; 100 var outresult = null;
106 101
107 var expression = "/staff/employee/employeeId/text()"; 102 var expression = "/staff/employee/employeeId/text()";
108 var xpathType = ORDERED_NODE_SNAPSHOT_TYPE; 103 var xpathType = ORDERED_NODE_SNAPSHOT_TYPE;
109 var snapshotItem; 104 var snapshotItem;
110 var snapshotLength; 105 var snapshotLength;
111 var index; 106 var index;
112 var text; 107 var text;
113 108
114 var docRef = null; 109 var docRef = null;
115 if (typeof(this.doc) != 'undefined') { 110 if (typeof(this.doc) != 'undefined') {
116 docRef = this.doc; 111 docRef = this.doc;
117 } 112 }
118 doc = load(docRef, "doc", "staff"); 113 doc = load(docRef, "doc", "staff");
119 evaluator = createXPathEvaluator(doc); 114 evaluator = createXPathEvaluator(doc);
120 resolver = evaluator.createNSResolver(doc); 115 resolver = evaluator.createNSResolver(doc);
121 contextNode = doc; 116 contextNode = doc;
122 outresult = evaluator.evaluate(expression,contextNode,resolver,xpathType,inresul t); 117 outresult = evaluator.evaluate(expression,contextNode,resolver,xpathType,inresul t);
123 index = 0; 118 index = 0;
124 119
125 while( 120 while(
126
127 (index < 4)
128 121
129 » ) { 122 (index < 4)
130 » snapshotItem = outresult.snapshotItem(index); 123
124 ) {
125 snapshotItem = outresult.snapshotItem(index);
131 text = snapshotItem.data; 126 text = snapshotItem.data;
132 127
133 128 if(
134 » if( 129 (0 == index)
135 » (0 == index) 130 ) {
136 » ) { 131 assertEquals("first","EMP0001",text);
137 » assertEquals("first","EMP0001",text);
138
139 » }
140 »
141 » if(
142 » (1 == index)
143 » ) {
144 » assertEquals("second","EMP0002",text);
145
146 » }
147 »
148 » if(
149 » (2 == index)
150 » ) {
151 » assertEquals("third","EMP0003",text);
152
153 » }
154 »
155 » if(
156 » (3 == index)
157 » ) {
158 » assertEquals("fourth","EMP0004",text);
159
160 » }
161 » index += 1;
162 132
163 » } 133 }
134
135 if(
136 (1 == index)
137 ) {
138 assertEquals("second","EMP0002",text);
139
140 }
141
142 if(
143 (2 == index)
144 ) {
145 assertEquals("third","EMP0003",text);
146
147 }
148
149 if(
150 (3 == index)
151 ) {
152 assertEquals("fourth","EMP0004",text);
153
154 }
155 index += 1;
156
157 }
164 158
165 } 159 }
166 160
167
168
169
170 function runTest() { 161 function runTest() {
171 XPathResult_snapshotItem_ORDERED_NODE_SNAPSHOT_TYPE_order(); 162 XPathResult_snapshotItem_ORDERED_NODE_SNAPSHOT_TYPE_order();
172 } 163 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698