Skip to content

Commit b754b92

Browse files
committed
on the way to use html5 doctype for all our tests
1 parent 035be05 commit b754b92

22 files changed

+290
-276
lines changed

src/test/java/org/htmlunit/javascript/background/JavaScriptJobManagerTest.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ private void assertMaxTestRunTime(final long maxRunTimeMilliseconds) {
5858
*/
5959
@Test
6060
public void setClearTimeoutUsesManager() throws Exception {
61-
final String content = "<html>\n"
61+
final String content = DOCTYPE_HTML
62+
+ "<html>\n"
6263
+ "<head>\n"
6364
+ " <title>test</title>\n"
6465
+ " <script>\n"
@@ -95,7 +96,8 @@ public void setClearTimeoutUsesManager() throws Exception {
9596
*/
9697
@Test
9798
public void setClearIntervalUsesManager() throws Exception {
98-
final String content = "<html>\n"
99+
final String content = DOCTYPE_HTML
100+
+ "<html>\n"
99101
+ "<head>\n"
100102
+ " <title>test</title>\n"
101103
+ " <script>\n"
@@ -138,20 +140,23 @@ public void setClearIntervalUsesManager() throws Exception {
138140
*/
139141
@Test
140142
public void navigationStopThreadsInChildWindows() throws Exception {
141-
final String firstContent = "<html><head><title>First</title></head><body>\n"
143+
final String firstContent = DOCTYPE_HTML
144+
+ "<html><head><title>First</title></head><body>\n"
142145
+ "<iframe id='iframe1' src='"
143146
+ URL_SECOND
144147
+ "'></iframe>\n"
145148
+ "<a href='"
146149
+ URL_THIRD.toExternalForm()
147150
+ "' id='clickme'>click me</a>\n"
148151
+ "</body></html>";
149-
final String secondContent = "<html><head><title>Second</title></head><body>\n"
152+
final String secondContent = DOCTYPE_HTML
153+
+ "<html><head><title>Second</title></head><body>\n"
150154
+ "<script>\n"
151155
+ "setInterval('', 30000);\n"
152156
+ "</script>\n"
153157
+ "</body></html>";
154-
final String thirdContent = "<html><head><title>Third</title></head><body></body></html>";
158+
final String thirdContent = DOCTYPE_HTML
159+
+ "<html><head><title>Third</title></head><body></body></html>";
155160

156161
final MockWebConnection webConnection = getMockWebConnection();
157162
webConnection.setResponse(URL_SECOND, secondContent);
@@ -179,7 +184,8 @@ public void navigationStopThreadsInChildWindows() throws Exception {
179184
*/
180185
@Test
181186
public void interruptAllWithRecursiveSetTimeout() throws Exception {
182-
final String content = "<html>\n"
187+
final String content = DOCTYPE_HTML
188+
+ "<html>\n"
183189
+ "<head>\n"
184190
+ " <title>test</title>\n"
185191
+ " <script>\n"

src/test/java/org/htmlunit/javascript/background/MemoryLeakTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ protected void windowLeaks() throws Exception {
6666
detector.register("w", client.getCurrentWindow());
6767

6868
final MockWebConnection conn = new MockWebConnection();
69-
conn.setResponse(URL_FIRST, "<html><body><script>setInterval('alert(1)',5000)</script></body></html>");
69+
conn.setResponse(URL_FIRST,
70+
DOCTYPE_HTML + "<html><body><script>setInterval('alert(1)',5000)</script></body></html>");
7071
client.setWebConnection(conn);
7172

7273
client.getPage(URL_FIRST);

src/test/java/org/htmlunit/javascript/configuration/JavaScriptConfigurationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ public void clonedAndModified() throws Exception {
317317
private static void test(final BrowserVersion browserVersion) throws IOException {
318318
try (WebClient webClient = new WebClient(browserVersion)) {
319319
final MockWebConnection conn = new MockWebConnection();
320-
conn.setDefaultResponse("<html><body onload='document.body.firstChild'></body></html>");
320+
conn.setDefaultResponse(DOCTYPE_HTML + "<html><body onload='document.body.firstChild'></body></html>");
321321
webClient.setWebConnection(conn);
322322

323323
webClient.getPage("http://localhost/");

src/test/java/org/htmlunit/javascript/host/arrays/ArrayBufferTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public class ArrayBufferTest extends WebDriverTestCase {
3636
@Test
3737
@Alerts("0")
3838
public void ctorLengthZero() throws Exception {
39-
final String html
40-
= "<html><head>\n"
39+
final String html = DOCTYPE_HTML
40+
+ "<html><head>\n"
4141
+ "<script>\n"
4242
+ LOG_TITLE_FUNCTION
4343
+ "function test() {\n"
@@ -56,8 +56,8 @@ public void ctorLengthZero() throws Exception {
5656
@Test
5757
@Alerts("RangeError")
5858
public void ctorLengthNegative() throws Exception {
59-
final String html
60-
= "<html><head>\n"
59+
final String html = DOCTYPE_HTML
60+
+ "<html><head>\n"
6161
+ "<script>\n"
6262
+ LOG_TITLE_FUNCTION
6363
+ "function test() {\n"
@@ -78,8 +78,8 @@ public void ctorLengthNegative() throws Exception {
7878
@Test
7979
@Alerts("5")
8080
public void byteLength() throws Exception {
81-
final String html
82-
= "<html><head>\n"
81+
final String html = DOCTYPE_HTML
82+
+ "<html><head>\n"
8383
+ "<script>\n"
8484
+ LOG_TITLE_FUNCTION
8585
+ "function test() {\n"
@@ -98,8 +98,8 @@ public void byteLength() throws Exception {
9898
@Test
9999
@Alerts({"1234", "1234", "6789", "1234"})
100100
public void slice() throws Exception {
101-
final String html
102-
= "<html><head>\n"
101+
final String html = DOCTYPE_HTML
102+
+ "<html><head>\n"
103103
+ "<script>\n"
104104
+ LOG_TITLE_FUNCTION
105105
+ "function test() {\n"
@@ -238,8 +238,8 @@ public void sliceInvalidEndIndexNull() throws Exception {
238238
}
239239

240240
private void sliceInvalidIndex(final String index) throws Exception {
241-
final String html
242-
= "<html><head>\n"
241+
final String html = DOCTYPE_HTML
242+
+ "<html><head>\n"
243243
+ "<script>\n"
244244
+ LOG_TITLE_FUNCTION
245245
+ "function test() {\n"
@@ -267,8 +267,8 @@ private void sliceInvalidIndex(final String index) throws Exception {
267267
@Test
268268
@Alerts("0")
269269
public void nullConstructor() throws Exception {
270-
final String html
271-
= "<html><head>\n"
270+
final String html = DOCTYPE_HTML
271+
+ "<html><head>\n"
272272
+ "<script>\n"
273273
+ LOG_TITLE_FUNCTION
274274
+ "function test() {\n"

src/test/java/org/htmlunit/javascript/host/arrays/ArrayBufferViewTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public class ArrayBufferViewTest extends WebDriverTestCase {
3636
@Test
3737
@Alerts({"18", "93", "42"})
3838
public void set_int8() throws Exception {
39-
final String html
40-
= "<html><head>\n"
39+
final String html = DOCTYPE_HTML
40+
+ "<html><head>\n"
4141
+ "<script>\n"
4242
+ LOG_TITLE_FUNCTION
4343
+ "function test() {\n"
@@ -59,8 +59,8 @@ public void set_int8() throws Exception {
5959
@Test
6060
@Alerts("10")
6161
public void set_empty() throws Exception {
62-
final String html
63-
= "<html><head>\n"
62+
final String html = DOCTYPE_HTML
63+
+ "<html><head>\n"
6464
+ "<script>\n"
6565
+ LOG_TITLE_FUNCTION
6666
+ "function test() {\n"
@@ -80,8 +80,8 @@ public void set_empty() throws Exception {
8080
@Test
8181
@Alerts({"3", "2", "3", "-1"})
8282
public void subarray_int8() throws Exception {
83-
final String html
84-
= "<html><head>\n"
83+
final String html = DOCTYPE_HTML
84+
+ "<html><head>\n"
8585
+ "<script>\n"
8686
+ LOG_TITLE_FUNCTION
8787
+ "function test() {\n"
@@ -105,8 +105,8 @@ public void subarray_int8() throws Exception {
105105
@Test
106106
@Alerts({"8", "0", "0", "0", "10", "1", "2", "2", "2"})
107107
public void ctorInvalidValuesInt() throws Exception {
108-
final String html
109-
= "<html><head>\n"
108+
final String html = DOCTYPE_HTML
109+
+ "<html><head>\n"
110110
+ "<script>\n"
111111
+ LOG_TITLE_FUNCTION
112112
+ "function test() {\n"
@@ -128,8 +128,8 @@ public void ctorInvalidValuesInt() throws Exception {
128128
@Test
129129
@Alerts({"7", "0", "NaN", "NaN", "10", "1", "2.5", "2.75"})
130130
public void ctorInvalidValuesFloat() throws Exception {
131-
final String html
132-
= "<html><head>\n"
131+
final String html = DOCTYPE_HTML
132+
+ "<html><head>\n"
133133
+ "<script>\n"
134134
+ LOG_TITLE_FUNCTION
135135
+ "function test() {\n"

src/test/java/org/htmlunit/javascript/host/arrays/DataViewTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public class DataViewTest extends WebDriverTestCase {
3636
@Test
3737
@Alerts({"22", "3.1415927410125732"})
3838
public void arrayConstruction() throws Exception {
39-
final String html
40-
= "<html><head>\n"
39+
final String html = DOCTYPE_HTML
40+
+ "<html><head>\n"
4141
+ "<script>\n"
4242
+ LOG_TITLE_FUNCTION
4343
+ "function test() {\n"
@@ -64,8 +64,8 @@ public void arrayConstruction() throws Exception {
6464
"0", "0", "0", "0", "64", "9",
6565
"33", "-5", "84", "68", "45", "24"})
6666
public void endian() throws Exception {
67-
final String html
68-
= "<html><head>\n"
67+
final String html = DOCTYPE_HTML
68+
+ "<html><head>\n"
6969
+ "<script>\n"
7070
+ LOG_TITLE_FUNCTION
7171
+ "function test() {\n"
@@ -94,8 +94,8 @@ public void endian() throws Exception {
9494
@Test
9595
@Alerts({"1234", "0", "4", "-46", "0", "0", "0"})
9696
public void uint16() throws Exception {
97-
final String html
98-
= "<html><head>\n"
97+
final String html = DOCTYPE_HTML
98+
+ "<html><head>\n"
9999
+ "<script>\n"
100100
+ LOG_TITLE_FUNCTION
101101
+ "function test() {\n"
@@ -120,8 +120,8 @@ public void uint16() throws Exception {
120120
@Test
121121
@Alerts("TypeError")
122122
public void nullConstructor() throws Exception {
123-
final String html
124-
= "<html><head>\n"
123+
final String html = DOCTYPE_HTML
124+
+ "<html><head>\n"
125125
+ "<script>\n"
126126
+ LOG_TITLE_FUNCTION
127127
+ "function test() {\n"

src/test/java/org/htmlunit/javascript/host/arrays/Float32ArrayTest.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public class Float32ArrayTest extends WebDriverTestCase {
3737
@Test
3838
@Alerts({"63", "-76", "-106", "73", "79", "97", "60", "-53"})
3939
public void bufferConstructor() throws Exception {
40-
final String html
41-
= "<html><head>\n"
40+
final String html = DOCTYPE_HTML
41+
+ "<html><head>\n"
4242
+ "<script>\n"
4343
+ LOG_TITLE_FUNCTION
4444
+ "function test() {\n"
@@ -61,8 +61,8 @@ public void bufferConstructor() throws Exception {
6161
@Test
6262
@Alerts({"undefined", "1234567.875", "undefined", "undefined"})
6363
public void index() throws Exception {
64-
final String html
65-
= "<html><head>\n"
64+
final String html = DOCTYPE_HTML
65+
+ "<html><head>\n"
6666
+ "<script>\n"
6767
+ LOG_TITLE_FUNCTION
6868
+ "function test() {\n"
@@ -84,8 +84,8 @@ public void index() throws Exception {
8484
@Test
8585
@Alerts({"false", "true", "false", "false"})
8686
public void in() throws Exception {
87-
final String html
88-
= "<html><head>\n"
87+
final String html = DOCTYPE_HTML
88+
+ "<html><head>\n"
8989
+ "<script>\n"
9090
+ LOG_TITLE_FUNCTION
9191
+ "function test() {\n"
@@ -107,8 +107,8 @@ public void in() throws Exception {
107107
@Test
108108
@Alerts({"undefined", "6", "NaN", "0", "NaN", "Infinity", "-Infinity", "4", "undefined"})
109109
public void undefinedValueInArray() throws Exception {
110-
final String html
111-
= "<html><head>\n"
110+
final String html = DOCTYPE_HTML
111+
+ "<html><head>\n"
112112
+ "<script>\n"
113113
+ LOG_TITLE_FUNCTION
114114
+ "function test() {\n"
@@ -142,8 +142,8 @@ public void undefinedValueInArray() throws Exception {
142142
@Test
143143
@Alerts({"NaN", "1", "0", "17"})
144144
public void specialValueInArray() throws Exception {
145-
final String html
146-
= "<html><head>\n"
145+
final String html = DOCTYPE_HTML
146+
+ "<html><head>\n"
147147
+ "<script>\n"
148148
+ LOG_TITLE_FUNCTION
149149
+ "function test() {\n"
@@ -170,8 +170,8 @@ public void specialValueInArray() throws Exception {
170170
@Test
171171
@Alerts("0")
172172
public void nullConstructor() throws Exception {
173-
final String html
174-
= "<html><head>\n"
173+
final String html = DOCTYPE_HTML
174+
+ "<html><head>\n"
175175
+ "<script>\n"
176176
+ LOG_TITLE_FUNCTION
177177
+ "function test() {\n"
@@ -192,8 +192,8 @@ public void nullConstructor() throws Exception {
192192
@Test
193193
@Alerts({"", "0", "1", "1,3", "1,3,4,7,11,0,123"})
194194
public void asString() throws Exception {
195-
final String html
196-
= "<html><head>\n"
195+
final String html = DOCTYPE_HTML
196+
+ "<html><head>\n"
197197
+ "<script>\n"
198198
+ LOG_TITLE_FUNCTION
199199
+ "function test() {\n"
@@ -224,8 +224,8 @@ public void asString() throws Exception {
224224
@Test
225225
@Alerts("Float32Array")
226226
public void name() throws Exception {
227-
final String html
228-
= "<html><head>\n"
227+
final String html = DOCTYPE_HTML
228+
+ "<html><head>\n"
229229
+ "<script>\n"
230230
+ LOG_TITLE_FUNCTION
231231
+ "function test() {\n"

0 commit comments

Comments
 (0)