langtools/test/com/sun/javadoc/JavascriptWinTitle/JavascriptWinTitle.java
author ysuenaga
Fri, 04 Mar 2016 18:13:04 +0900
changeset 37314 341fa2e9011f
parent 33920 bd731341c405
permissions -rw-r--r--
8151181: Add JSnap to jhsdb Reviewed-by: dsamersoff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 24399
diff changeset
     2
 * Copyright (c) 2002, 2015, 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
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 30730
diff changeset
    26
 * @bug 4645058 4747738 4855054 8024756 8141492
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
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    30
 * @library ../lib
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 24399
diff changeset
    31
 * @modules jdk.javadoc
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    32
 * @build JavadocTester
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
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    36
public class JavascriptWinTitle extends JavadocTester {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    38
    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
    39
        JavascriptWinTitle tester = new JavascriptWinTitle();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    40
        tester.runTests();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    43
    @Test
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    44
    void test() {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    45
        javadoc("-d", "out",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    46
                "-doctitle", "Document Title",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    47
                "-windowtitle", "Window Title",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    48
                "-overview", testSrc("overview.html"),
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    49
                "-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
    50
                "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    51
                "p1", "p2");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    52
        checkExit(Exit.OK);
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    53
        checkOutput("overview-summary.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    54
                "<script type=\"text/javascript\">",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    55
                "<body>");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    57
        // Test that "onload" is not present in BODY tag:
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    58
        checkOutput("p1/package-summary.html", true, "<body>");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    59
        checkOutput("overview-frame.html", true, "<body>");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    60
        checkOutput("allclasses-frame.html", true, "<body>");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    61
        checkOutput("p1/package-frame.html", true, "<body>");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    63
        // 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
    64
        checkOutput("p1/C.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    65
                "<script type=\"text/javascript\"><!--\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    66
                + "    try {\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    67
                + "        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
    68
                + "            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
    69
                + "        }\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    70
                + "    }\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    71
                + "    catch(err) {\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 23971
diff changeset
    72
                + "    }\n"
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 30730
diff changeset
    73
                + "//-->\n");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
}