test/com/sun/javadoc/testJavascript/TestJavascript.java

Wed, 28 Nov 2012 14:07:26 -0800

author
katleman
date
Wed, 28 Nov 2012 14:07:26 -0800
changeset 1425
20230f8b0eef
parent 942
148d3dc4e1e1
child 1829
c7c6bfe7fc1f
permissions
-rw-r--r--

Merge

     1 /*
     2  * Copyright (c) 2004, 2011, 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  */
    24 /*
    25  * @test
    26  * @bug      4665566 4855876 7025314
    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  */
    35 public class TestJavascript extends JavadocTester {
    37     //Test information.
    38     private static final String BUG_ID = "4665566-4855876";
    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     };
    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\">Frames</a>"},
    49         {BUG_ID + FS + "TestJavascript.html",
    50             "<a href=\"index.html?TestJavascript.html\" target=\"_top\">Frames</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>"},
    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     };
    71     private static final String[][] NEGATED_TEST = NO_TEST;
    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     }
    83     /**
    84      * {@inheritDoc}
    85      */
    86     public String getBugId() {
    87         return BUG_ID;
    88     }
    90     /**
    91      * {@inheritDoc}
    92      */
    93     public String getBugName() {
    94         return getClass().getName();
    95     }
    96 }

mercurial