langtools/test/com/sun/javadoc/JavascriptWinTitle/JavascriptWinTitle.java
changeset 23971 f5ff1f5a8dee
parent 20614 994200acf1e4
child 24399 af1a0220d0fa
--- a/langtools/test/com/sun/javadoc/JavascriptWinTitle/JavascriptWinTitle.java	Tue Apr 15 15:55:24 2014 -0700
+++ b/langtools/test/com/sun/javadoc/JavascriptWinTitle/JavascriptWinTitle.java	Wed Apr 16 16:17:09 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,13 +43,12 @@
  */
 public class JavascriptWinTitle {
 
+    protected static final String NL = System.getProperty("line.separator");
+
     private static final String BUGID = "4645058";
     private static final String BUGNAME = "JavascriptWinTitle";
-    private static final String FS = System.getProperty("file.separator");
-    private static final String PS = System.getProperty("path.separator");
-    private static final String LS = System.getProperty("line.separator");
-    private static final String TMPDEST_DIR1 = "." + FS + "docs1" + FS;
-    private static final String TMPDEST_DIR2 = "." + FS + "docs2" + FS;
+    private static final String TMPDEST_DIR1 = "./docs1/";
+    private static final String TMPDEST_DIR2 = "./docs2/";
 
     // Subtest number.  Needed because runResultsOnHTML is run twice,
     // and subtestNum should increment across subtest runs.
@@ -66,7 +65,7 @@
         runJavadoc(new String[] {"-d", TMPDEST_DIR1,
                                  "-doctitle", "Document Title",
                                  "-windowtitle", "Window Title",
-                                 "-overview", (srcdir + FS + "overview.html"),
+                                 "-overview", (srcdir + "/overview.html"),
                                  "-linkoffline",
                                     "http://java.sun.com/j2se/1.4/docs/api", srcdir,
                                  "-sourcepath", srcdir,
@@ -99,7 +98,7 @@
 
             // Test onload is present:
             {  "<body>",
-                     TMPDEST_DIR1 + FS + "p1" + FS + "package-summary.html"  },
+                     TMPDEST_DIR1 + "/p1/package-summary.html"  },
 
             // Test that "onload" is not present in BODY tag:
             {   "<body>",
@@ -111,18 +110,20 @@
 
             // Test that "onload" is not present in BODY tag:
             {   "<body>",
-                     TMPDEST_DIR1 + FS + "p1" + FS + "package-frame.html"  },
+                     TMPDEST_DIR1 + "/p1/package-frame.html"  },
 
             // Test that win title javascript is followed by NOSCRIPT code.
-            {"<script type=\"text/javascript\"><!--" + LS +
-            "    try {" + LS +
-            "        if (location.href.indexOf('is-external=true') == -1) {" + LS +
-            "            parent.document.title=\"C (Window Title)\";" + LS +
-            "        }" + LS +
-            "    }" + LS +
-            "    catch(err) {" + LS +
-            "    }" + LS + "//-->" + LS + "</script>",
-             TMPDEST_DIR1 + FS + "p1" + FS + "C.html"
+            {"<script type=\"text/javascript\"><!--\n" +
+            "    try {\n" +
+            "        if (location.href.indexOf('is-external=true') == -1) {\n" +
+            "            parent.document.title=\"C (Window Title)\";\n" +
+            "        }\n" +
+            "    }\n" +
+            "    catch(err) {\n" +
+            "    }\n" +
+            "//-->\n" +
+            "</script>",
+             TMPDEST_DIR1 + "/p1/C.html"
             }
 
         };
@@ -192,6 +193,6 @@
     }
 
     public static int findString(String fileString, String stringToFind) {
-        return fileString.indexOf(stringToFind);
+        return fileString.replace(NL, "\n").indexOf(stringToFind);
     }
 }