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

Side by Side Diff: LayoutTests/dom/svg/level3/xpath/XPathEvaluator_evaluate_WRONG_DOCUMENT_ERR.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 ['XPathEvaluator_evaluate_WRONG_DOCUMENT_ERR']; 15 return ['XPathEvaluator_evaluate_WRONG_DOCUMENT_ERR'];
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 doc1Ref = null; 40 var doc1Ref = null;
43 if (typeof(this.doc1) != 'undefined') { 41 if (typeof(this.doc1) != 'undefined') {
44 doc1Ref = this.doc1; 42 doc1Ref = this.doc1;
45 } 43 }
46 docsLoaded += preload(doc1Ref, "doc1", "staffNS"); 44 docsLoaded += preload(doc1Ref, "doc1", "staffNS");
47 45
48 var doc2Ref = null; 46 var doc2Ref = null;
49 if (typeof(this.doc2) != 'undefined') { 47 if (typeof(this.doc2) != 'undefined') {
50 doc2Ref = this.doc2; 48 doc2Ref = this.doc2;
51 } 49 }
52 docsLoaded += preload(doc2Ref, "doc2", "staff"); 50 docsLoaded += preload(doc2Ref, "doc2", "staff");
53 51
54 if (docsLoaded == 2) { 52 if (docsLoaded == 2) {
55 setUpPageStatus = 'complete'; 53 setUpPageStatus = 'complete';
56 } 54 }
57 } catch(ex) { 55 } catch(ex) {
58 » catchInitializationError(builder, ex); 56 catchInitializationError(builder, ex);
59 setUpPageStatus = 'complete'; 57 setUpPageStatus = 'complete';
60 } 58 }
61 } 59 }
62 60
63
64
65 // 61 //
66 // This method is called on the completion of 62 // This method is called on the completion of
67 // each asychronous load started in setUpTests. 63 // each asychronous load started in setUpTests.
68 // 64 //
69 // When every synchronous loaded document has completed, 65 // When every synchronous loaded document has completed,
70 // the page status is changed which allows the 66 // the page status is changed which allows the
71 // body of the test to be executed. 67 // body of the test to be executed.
72 function loadComplete() { 68 function loadComplete() {
73 if (++docsLoaded == 2) { 69 if (++docsLoaded == 2) {
74 setUpPageStatus = 'complete'; 70 setUpPageStatus = 'complete';
75 } 71 }
76 } 72 }
77 73
74 /**
75 *
76 Test if XPathEvaluator.evaluate properly throws WRONG_DOCUMENT_ERROR
78 77
79 /**
80 *
81 Test if XPathEvaluator.evaluate properly throws WRONG_DOCUMENT_ERROR
82
83 * @author Philippe Le Hégaret 78 * @author Philippe Le Hégaret
84 * @author Bob Clary 79 * @author Bob Clary
85 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvalua tor-evaluate 80 * @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvalua tor-evaluate
86 */ 81 */
87 function XPathEvaluator_evaluate_WRONG_DOCUMENT_ERR() { 82 function XPathEvaluator_evaluate_WRONG_DOCUMENT_ERR() {
88 var success; 83 var success;
89 if(checkInitialization(builder, "XPathEvaluator_evaluate_WRONG_DOCUMENT_ERR" ) != null) return; 84 if(checkInitialization(builder, "XPathEvaluator_evaluate_WRONG_DOCUMENT_ERR" ) != null) return;
90 var doc1; 85 var doc1;
91 var doc2; 86 var doc2;
92 var xpEvaluator; 87 var xpEvaluator;
93 var root; 88 var root;
94 var result; 89 var result;
95 var nullNSResolver = null; 90 var nullNSResolver = null;
96 91
97 var nullResult = null; 92 var nullResult = null;
98 93
99
100 var doc1Ref = null; 94 var doc1Ref = null;
101 if (typeof(this.doc1) != 'undefined') { 95 if (typeof(this.doc1) != 'undefined') {
102 doc1Ref = this.doc1; 96 doc1Ref = this.doc1;
103 } 97 }
104 doc1 = load(doc1Ref, "doc1", "staffNS"); 98 doc1 = load(doc1Ref, "doc1", "staffNS");
105 99
106 var doc2Ref = null; 100 var doc2Ref = null;
107 if (typeof(this.doc2) != 'undefined') { 101 if (typeof(this.doc2) != 'undefined') {
108 doc2Ref = this.doc2; 102 doc2Ref = this.doc2;
109 } 103 }
110 doc2 = load(doc2Ref, "doc2", "staff"); 104 doc2 = load(doc2Ref, "doc2", "staff");
111 xpEvaluator = createXPathEvaluator(doc1); 105 xpEvaluator = createXPathEvaluator(doc1);
112 root = doc2.documentElement; 106 root = doc2.documentElement;
113 107
114 108 {
115 » { 109 success = false;
116 » » success = false; 110 try {
117 » » try {
118 result = xpEvaluator.evaluate("//foo:bar",root,nullNSResolver,0,null Result); 111 result = xpEvaluator.evaluate("//foo:bar",root,nullNSResolver,0,null Result);
119 } 112 }
120 » » catch(ex) { 113 catch(ex) {
121 success = (typeof(ex.code) != 'undefined' && ex.code == 4); 114 success = (typeof(ex.code) != 'undefined' && ex.code == 4);
122 » » } 115 }
123 » » assertTrue("throw_WRONG_DOCUMENT_ERR",success); 116 assertTrue("throw_WRONG_DOCUMENT_ERR",success);
124 » } 117 }
125 118
126 } 119 }
127 120
128
129
130
131 function runTest() { 121 function runTest() {
132 XPathEvaluator_evaluate_WRONG_DOCUMENT_ERR(); 122 XPathEvaluator_evaluate_WRONG_DOCUMENT_ERR();
133 } 123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698