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

Side by Side Diff: LayoutTests/dom/svg/level3/xpath/XPathResult_resultType.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_resultType']; 15 return ['XPathResult_resultType'];
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 for the expression /staff/employee 70 Create an XPathResult for the expression /staff/employee
76 for each type of XPathResultType, checking that the resultType 71 for each type of XPathResultType, checking that the resultType
77 of the XPathResult matches the requested type. 72 of the XPathResult matches the requested type.
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 Type 75 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult Type
81 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult 76 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult
82 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvalua tor-createNSResolver 77 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvalua tor-createNSResolver
83 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvalua tor-evaluate 78 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvalua tor-evaluate
84 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult -resultType 79 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult -resultType
85 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathExcept ion 80 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathExcept ion
86 */ 81 */
87 function XPathResult_resultType() { 82 function XPathResult_resultType() {
88 var success; 83 var success;
(...skipping 25 matching lines...) Expand all
114 nodeTypeList[1] = 1; 109 nodeTypeList[1] = 1;
115 nodeTypeList[2] = 2; 110 nodeTypeList[2] = 2;
116 nodeTypeList[3] = 3; 111 nodeTypeList[3] = 3;
117 nodeTypeList[4] = 4; 112 nodeTypeList[4] = 4;
118 nodeTypeList[5] = 5; 113 nodeTypeList[5] = 5;
119 nodeTypeList[6] = 6; 114 nodeTypeList[6] = 6;
120 nodeTypeList[7] = 7; 115 nodeTypeList[7] = 7;
121 nodeTypeList[8] = 8; 116 nodeTypeList[8] = 8;
122 nodeTypeList[9] = 9; 117 nodeTypeList[9] = 9;
123 118
124
125 var docRef = null; 119 var docRef = null;
126 if (typeof(this.doc) != 'undefined') { 120 if (typeof(this.doc) != 'undefined') {
127 docRef = this.doc; 121 docRef = this.doc;
128 } 122 }
129 doc = load(docRef, "doc", "staff"); 123 doc = load(docRef, "doc", "staff");
130 evaluator = createXPathEvaluator(doc); 124 evaluator = createXPathEvaluator(doc);
131 resolver = evaluator.createNSResolver(doc); 125 resolver = evaluator.createNSResolver(doc);
132 contextNode = doc; 126 contextNode = doc;
133 for(var indexN65737 = 0;indexN65737 < nodeTypeList.length; indexN65737++) { 127 for(var indexN65737 = 0;indexN65737 < nodeTypeList.length; indexN65737++) {
134 inNodeType = nodeTypeList[indexN65737]; 128 inNodeType = nodeTypeList[indexN65737];
135 outresult = evaluator.evaluate(expression,contextNode,resolver,inNodeType, inresult); 129 outresult = evaluator.evaluate(expression,contextNode,resolver,inNodeType, inresult);
136 outNodeType = outresult.resultType; 130 outNodeType = outresult.resultType;
137 131
138 132 if(
139 » if( 133 (inNodeType == ANY_TYPE)
140 » (inNodeType == ANY_TYPE) 134 ) {
141 » ) { 135 assertEquals("ANY_TYPE_resulttype",UNORDERED_NODE_ITERATOR_TYPE,outNodeType) ;
142 » assertEquals("ANY_TYPE_resulttype",UNORDERED_NODE_ITERATOR_TYPE,outNodeT ype); 136
143 137 }
144 » } 138
145 » 139 if(
146 » if( 140 (inNodeType == NUMBER_TYPE)
147 » (inNodeType == NUMBER_TYPE) 141 ) {
148 » ) { 142 assertEquals("NUMBER_TYPE_resulttype",NUMBER_TYPE,outNodeType);
149 » assertEquals("NUMBER_TYPE_resulttype",NUMBER_TYPE,outNodeType); 143
150 144 }
151 » } 145
152 » 146 if(
153 » if( 147 (inNodeType == STRING_TYPE)
154 » (inNodeType == STRING_TYPE) 148 ) {
155 » ) { 149 assertEquals("STRING_TYPE_resulttype",STRING_TYPE,outNodeType);
156 » assertEquals("STRING_TYPE_resulttype",STRING_TYPE,outNodeType); 150
157 151 }
158 » } 152
159 » 153 if(
160 » if( 154 (inNodeType == BOOLEAN_TYPE)
161 » (inNodeType == BOOLEAN_TYPE) 155 ) {
162 » ) { 156 assertEquals("BOOLEAN_TYPE_resulttype",BOOLEAN_TYPE,outNodeType);
163 » assertEquals("BOOLEAN_TYPE_resulttype",BOOLEAN_TYPE,outNodeType); 157
164 158 }
165 » } 159
166 » 160 if(
167 » if( 161 (inNodeType == UNORDERED_NODE_ITERATOR_TYPE)
168 » (inNodeType == UNORDERED_NODE_ITERATOR_TYPE) 162 ) {
169 » ) { 163 assertEquals("UNORDERED_NODE_ITERATOR_TYPE_resulttype",UNORDERED_NODE_ITERAT OR_TYPE,outNodeType);
170 » assertEquals("UNORDERED_NODE_ITERATOR_TYPE_resulttype",UNORDERED_NODE_IT ERATOR_TYPE,outNodeType); 164
171 165 }
172 » } 166
173 » 167 if(
174 » if( 168 (inNodeType == ORDERED_NODE_ITERATOR_TYPE)
175 » (inNodeType == ORDERED_NODE_ITERATOR_TYPE) 169 ) {
176 » ) { 170 assertEquals("ORDERED_NODE_ITERATOR_TYPE_resulttype",ORDERED_NODE_ITERATOR_T YPE,outNodeType);
177 » assertEquals("ORDERED_NODE_ITERATOR_TYPE_resulttype",ORDERED_NODE_ITERAT OR_TYPE,outNodeType); 171
178 172 }
179 » } 173
180 » 174 if(
181 » if( 175 (inNodeType == UNORDERED_NODE_SNAPSHOT_TYPE)
182 » (inNodeType == UNORDERED_NODE_SNAPSHOT_TYPE) 176 ) {
183 » ) { 177 assertEquals("UNORDERED_NODE_SNAPSHOT_TYPE_resulttype",UNORDERED_NODE_SNAPSH OT_TYPE,outNodeType);
184 » assertEquals("UNORDERED_NODE_SNAPSHOT_TYPE_resulttype",UNORDERED_NODE_SN APSHOT_TYPE,outNodeType); 178
185 179 }
186 » } 180
187 » 181 if(
188 » if( 182 (inNodeType == ORDERED_NODE_SNAPSHOT_TYPE)
189 » (inNodeType == ORDERED_NODE_SNAPSHOT_TYPE) 183 ) {
190 » ) { 184 assertEquals("ORDERED_NODE_SNAPSHOT_TYPE_resulttype",ORDERED_NODE_SNAPSHOT_T YPE,outNodeType);
191 » assertEquals("ORDERED_NODE_SNAPSHOT_TYPE_resulttype",ORDERED_NODE_SNAPSH OT_TYPE,outNodeType); 185
192 186 }
193 » } 187
194 » 188 if(
195 » if( 189 (inNodeType == ANY_UNORDERED_NODE_TYPE)
196 » (inNodeType == ANY_UNORDERED_NODE_TYPE) 190 ) {
197 » ) { 191 assertEquals("ANY_UNORDERED_NODE_TYPE_resulttype",ANY_UNORDERED_NODE_TYPE,ou tNodeType);
198 » assertEquals("ANY_UNORDERED_NODE_TYPE_resulttype",ANY_UNORDERED_NODE_TYP E,outNodeType); 192
199 193 }
200 » } 194
201 » 195 if(
202 » if( 196 (inNodeType == FIRST_ORDERED_NODE_TYPE)
203 » (inNodeType == FIRST_ORDERED_NODE_TYPE) 197 ) {
204 » ) { 198 assertEquals("FIRST_ORDERED_NODE_TYPE_resulttype",FIRST_ORDERED_NODE_TYPE,ou tNodeType);
205 » assertEquals("FIRST_ORDERED_NODE_TYPE_resulttype",FIRST_ORDERED_NODE_TYP E,outNodeType); 199
206 200 }
207 » } 201
208 » 202 }
209 » } 203
210
211 } 204 }
212 205
213
214
215
216 function runTest() { 206 function runTest() {
217 XPathResult_resultType(); 207 XPathResult_resultType();
218 } 208 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698