test/langtools/jdk/javadoc/doclet/JavascriptWinTitle/JavascriptWinTitle.java
author jjg
Tue, 05 Mar 2019 10:35:29 -0800
changeset 54002 fb9541185457
parent 53097 2e82ca64b25d
child 54350 4f9772f4403d
permissions -rw-r--r--
8219946: Set class on body elements Reviewed-by: hannesw
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
54002
fb9541185457 8219946: Set class on body elements
jjg
parents: 53097
diff changeset
     2
 * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    21
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
 * @test
51861
f7d40158eb2f 8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents: 50293
diff changeset
    26
 * @bug 4645058 4747738 4855054 8024756 8141492 8196202 8205593
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
 * @summary  Javascript IE load error when linked by -linkoffline
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
 *           Window title shouldn't change when loading left frames (javascript)
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
 * @author dkramer
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 51861
diff changeset
    30
 * @library ../../lib
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    31
 * @modules jdk.javadoc/jdk.javadoc.internal.tool
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 51861
diff changeset
    32
 * @build javadoc.tester.*
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
 * @run main JavascriptWinTitle
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 51861
diff changeset
    36
import javadoc.tester.JavadocTester;
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 51861
diff changeset
    37
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    38
public class JavascriptWinTitle extends JavadocTester {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    40
    public static void main(String... args) throws Exception {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    41
        JavascriptWinTitle tester = new JavascriptWinTitle();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    42
        tester.runTests();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    45
    @Test
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 51861
diff changeset
    46
    public void test() {
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    47
        javadoc("-d", "out",
51861
f7d40158eb2f 8205593: Javadoc -link makes broken links if module name matches package name
pmuthuswamy
parents: 50293
diff changeset
    48
                "-source", "8",
50293
edfb87b2520e 8196202: Javadoc should not generate frames by default
jjg
parents: 47216
diff changeset
    49
                "--frames",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    50
                "-doctitle", "Document Title",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    51
                "-windowtitle", "Window Title",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    52
                "-overview", testSrc("overview.html"),
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    53
                "-linkoffline", "http://java.sun.com/j2se/1.4/docs/api", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    54
                "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    55
                "p1", "p2");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    56
        checkExit(Exit.OK);
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    57
        checkOutput("overview-summary.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    58
                "<script type=\"text/javascript\">",
54002
fb9541185457 8219946: Set class on body elements
jjg
parents: 53097
diff changeset
    59
                "<body class=\"package-index\">");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    61
        // Test that "onload" is not present in BODY tag:
54002
fb9541185457 8219946: Set class on body elements
jjg
parents: 53097
diff changeset
    62
        checkOutput("p1/package-summary.html", true, "<body class=\"package-declaration\">");
fb9541185457 8219946: Set class on body elements
jjg
parents: 53097
diff changeset
    63
        checkOutput("overview-frame.html", true, "<body class=\"package-index-frame\">");
fb9541185457 8219946: Set class on body elements
jjg
parents: 53097
diff changeset
    64
        checkOutput("allclasses-frame.html", true, "<body class=\"all-classes-frame\">");
fb9541185457 8219946: Set class on body elements
jjg
parents: 53097
diff changeset
    65
        checkOutput("p1/package-frame.html", true, "<body class=\"package-frame\">");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    67
        // Test that win title javascript is followed by NOSCRIPT code.
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    68
        checkOutput("p1/C.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    69
                "<script type=\"text/javascript\"><!--\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    70
                + "    try {\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    71
                + "        if (location.href.indexOf('is-external=true') == -1) {\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    72
                + "            parent.document.title=\"C (Window Title)\";\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    73
                + "        }\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    74
                + "    }\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    75
                + "    catch(err) {\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    76
                + "    }\n"
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 30730
diff changeset
    77
                + "//-->\n");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
}