10
|
1 |
/*
|
|
2 |
* Copyright 2004-2007 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 |
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 |
* have any questions.
|
|
22 |
*/
|
|
23 |
|
|
24 |
/*
|
|
25 |
* @test
|
|
26 |
* @bug 4665566 4855876
|
|
27 |
* @summary Verify that the output has the right javascript.
|
|
28 |
* @author jamieh
|
|
29 |
* @library ../lib/
|
|
30 |
* @build JavadocTester
|
|
31 |
* @build TestJavascript
|
|
32 |
* @run main TestJavascript
|
|
33 |
*/
|
|
34 |
|
|
35 |
public class TestJavascript extends JavadocTester {
|
|
36 |
|
|
37 |
//Test information.
|
|
38 |
private static final String BUG_ID = "4665566-4855876";
|
|
39 |
|
|
40 |
//Javadoc arguments.
|
|
41 |
private static final String[] ARGS = new String[] {
|
|
42 |
"-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg", SRC_DIR + FS + "TestJavascript.java"
|
|
43 |
};
|
|
44 |
|
|
45 |
//Input for string search tests.
|
|
46 |
private static final String[][] TEST = {
|
|
47 |
{BUG_ID + FS + "pkg" + FS + "C.html",
|
|
48 |
"<A HREF=\"../index.html?pkg/C.html\" target=\"_top\"><B>FRAMES</B></A>"},
|
|
49 |
{BUG_ID + FS + "TestJavascript.html",
|
|
50 |
"<A HREF=\"index.html?TestJavascript.html\" target=\"_top\"><B>FRAMES</B></A>"},
|
|
51 |
{BUG_ID + FS + "index.html",
|
|
52 |
"<SCRIPT type=\"text/javascript\">" + NL +
|
|
53 |
" targetPage = \"\" + window.location.search;" + NL +
|
|
54 |
" if (targetPage != \"\" && targetPage != \"undefined\")" + NL +
|
|
55 |
" targetPage = targetPage.substring(1);" + NL +
|
|
56 |
" if (targetPage.indexOf(\":\") != -1)" + NL +
|
|
57 |
" targetPage = \"undefined\";" + NL +
|
|
58 |
" function loadFrames() {" + NL +
|
|
59 |
" if (targetPage != \"\" && targetPage != \"undefined\")" + NL +
|
|
60 |
" top.classFrame.location = top.targetPage;" + NL +
|
|
61 |
" }" + NL +
|
|
62 |
"</SCRIPT>"},
|
|
63 |
|
|
64 |
//Make sure title javascript only runs if is-external is not true
|
|
65 |
{BUG_ID + FS + "pkg" + FS + "C.html",
|
|
66 |
" if (location.href.indexOf('is-external=true') == -1) {" + NL +
|
|
67 |
" parent.document.title=\"C\";" + NL +
|
|
68 |
" }"},
|
|
69 |
};
|
|
70 |
|
|
71 |
private static final String[][] NEGATED_TEST = NO_TEST;
|
|
72 |
|
|
73 |
/**
|
|
74 |
* The entry point of the test.
|
|
75 |
* @param args the array of command line arguments.
|
|
76 |
*/
|
|
77 |
public static void main(String[] args) {
|
|
78 |
TestJavascript tester = new TestJavascript();
|
|
79 |
run(tester, ARGS, TEST, NEGATED_TEST);
|
|
80 |
tester.printSummary();
|
|
81 |
}
|
|
82 |
|
|
83 |
/**
|
|
84 |
* {@inheritDoc}
|
|
85 |
*/
|
|
86 |
public String getBugId() {
|
|
87 |
return BUG_ID;
|
|
88 |
}
|
|
89 |
|
|
90 |
/**
|
|
91 |
* {@inheritDoc}
|
|
92 |
*/
|
|
93 |
public String getBugName() {
|
|
94 |
return getClass().getName();
|
|
95 |
}
|
|
96 |
}
|