1 /*
2 * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 4645058 4747738 4855054
27 * @summary Javascript IE load error when linked by -linkoffline
28 * Window title shouldn't change when loading left frames (javascript)
29 * @author dkramer
30 * @run main JavascriptWinTitle
31 */
32
33
34 import com.sun.javadoc.*;
35 import java.util.*;
36 import java.io.*;
37
38
39 /**
40 * Runs javadoc and runs regression tests on the resulting HTML.
41 * It reads each file, complete with newlines, into a string to easily
42 * find strings that contain newlines.
43 */
44 public class JavascriptWinTitle {
45
46 private static final String BUGID = "4645058";
98 TMPDEST_DIR1 + "overview-summary.html" },
99
100 // Test onload is present:
101 { "<body>",
102 TMPDEST_DIR1 + FS + "p1" + FS + "package-summary.html" },
103
104 // Test that "onload" is not present in BODY tag:
105 { "<body>",
106 TMPDEST_DIR1 + "overview-frame.html" },
107
108 // Test that "onload" is not present in BODY tag:
109 { "<body>",
110 TMPDEST_DIR1 + "allclasses-frame.html" },
111
112 // Test that "onload" is not present in BODY tag:
113 { "<body>",
114 TMPDEST_DIR1 + FS + "p1" + FS + "package-frame.html" },
115
116 // Test that win title javascript is followed by NOSCRIPT code.
117 {"<script type=\"text/javascript\"><!--" + LS +
118 " if (location.href.indexOf('is-external=true') == -1) {" + LS +
119 " parent.document.title=\"C (Window Title)\";" + LS +
120 " }" + LS + "//-->" + LS + "</script>",
121 TMPDEST_DIR1 + FS + "p1" + FS + "C.html"
122 }
123
124 };
125
126 public static void runTestsOnHTML(String[][] testArray) {
127
128 for (int i = 0; i < testArray.length; i++) {
129
130 subtestNum += 1;
131
132 // Read contents of file into a string
133 String fileString = readFileToString(testArray[i][1]);
134
135 // Get string to find
136 String stringToFind = testArray[i][0];
137
138 // Find string in file's contents
139 if (findString(fileString, stringToFind) == -1) {
|
1 /*
2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 4645058 4747738 4855054 8024756
27 * @summary Javascript IE load error when linked by -linkoffline
28 * Window title shouldn't change when loading left frames (javascript)
29 * @author dkramer
30 * @run main JavascriptWinTitle
31 */
32
33
34 import com.sun.javadoc.*;
35 import java.util.*;
36 import java.io.*;
37
38
39 /**
40 * Runs javadoc and runs regression tests on the resulting HTML.
41 * It reads each file, complete with newlines, into a string to easily
42 * find strings that contain newlines.
43 */
44 public class JavascriptWinTitle {
45
46 private static final String BUGID = "4645058";
98 TMPDEST_DIR1 + "overview-summary.html" },
99
100 // Test onload is present:
101 { "<body>",
102 TMPDEST_DIR1 + FS + "p1" + FS + "package-summary.html" },
103
104 // Test that "onload" is not present in BODY tag:
105 { "<body>",
106 TMPDEST_DIR1 + "overview-frame.html" },
107
108 // Test that "onload" is not present in BODY tag:
109 { "<body>",
110 TMPDEST_DIR1 + "allclasses-frame.html" },
111
112 // Test that "onload" is not present in BODY tag:
113 { "<body>",
114 TMPDEST_DIR1 + FS + "p1" + FS + "package-frame.html" },
115
116 // Test that win title javascript is followed by NOSCRIPT code.
117 {"<script type=\"text/javascript\"><!--" + LS +
118 " try {" + LS +
119 " if (location.href.indexOf('is-external=true') == -1) {" + LS +
120 " parent.document.title=\"C (Window Title)\";" + LS +
121 " }" + LS +
122 " }" + LS +
123 " catch(err) {" + LS +
124 " }" + LS + "//-->" + LS + "</script>",
125 TMPDEST_DIR1 + FS + "p1" + FS + "C.html"
126 }
127
128 };
129
130 public static void runTestsOnHTML(String[][] testArray) {
131
132 for (int i = 0; i < testArray.length; i++) {
133
134 subtestNum += 1;
135
136 // Read contents of file into a string
137 String fileString = readFileToString(testArray[i][1]);
138
139 // Get string to find
140 String stringToFind = testArray[i][0];
141
142 // Find string in file's contents
143 if (findString(fileString, stringToFind) == -1) {
|