FileFilter.java revision 07a76ca0095b4e0a2484157f648c3e99ba36bdc6
1/* 2 * Copyright (C) 2007 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.dumprendertree; 18 19import java.util.HashSet; 20import java.util.Hashtable; 21import android.util.*; 22 23public class FileFilter { 24 25 public static boolean ignoreTest(String file) { 26 // treat files like directories for the time being. 27 for (int i = 0; i < ignoreTestList.length; i ++) { 28 if (file.endsWith(ignoreTestList[i])) { 29 Log.e("FileFilter", "File path in IgnoreTest: " + file); 30 return true; 31 } 32 } 33 for (int i = 0; i < ignoreTestDirs.length; i++) { 34 if (file.endsWith(ignoreTestDirs[i])) { 35 Log.e("FileFilter", "File path in ignore list: " + file); 36 return true; 37 } 38 } 39 40 return false; 41 } 42 43 public static boolean ignoreResults(String file) { 44 int index = file.indexOf("fast"); 45 if (index != -1) { 46 String sub = file.substring(index); 47 if (ignoreResultList.contains(sub)) 48 return true; 49 } 50 return false; 51 52 } 53 54 public static String isKnownBug(String file) { 55 int index = file.indexOf("fast"); 56 if (index != -1) { 57 String sub = file.substring(index); 58 // Log.e("FileFilter", "Looking for:"+sub); 59 if (bugList.containsKey(sub)) 60 return bugList.get(sub); 61 } 62 return null; 63 } 64 65 final static HashSet<String> ignoreResultList = new HashSet<String>(); 66 final static Hashtable<String, String> bugList = 67 new Hashtable<String, String>(); 68 69 static { 70 fillIgnoreResultSet(); 71 fillBugTable(); 72 } 73 74 static final String[] ignoreTestDirs = { 75 ".", // ignore hidden directories and files 76 "resources", // ignore resource directories 77 "AppleScript", // AppleScript not supported 78 ".svn", // don't run anything under .svn folder 79 "profiler", // profiler is not supported 80 "svg", // svg is not supported 81 "platform", // platform specific 82 "http/wml", 83 }; 84 85 static final String [] ignoreTestList = { 86 // RegExp is exponatal 87 "fast/regex/test1.html", 88 "fast/regex/slow.html", 89 // RegExp is too large, causing OOM 90 "fast/js/regexp-charclass-crash.html", 91 // The Android browser has no notion of private browsing. 92 "storage/private-browsing-readonly.html", 93 "storage/domstorage/localstorage/private-browsing-affects-storage.html", 94 "storage/domstorage/sessionstorage/private-browsing-affects-storage.html", 95 // Android layout tests are stored in "layout_tests". The following two 96 // tests expect "LayoutTests" in their output. 97 "storage/domstorage/localstorage/iframe-events.html", 98 "storage/domstorage/sessionstorage/iframe-events.html", 99 // We do not support multi touch events. 100 "fast/events/touch/basic-multi-touch-events.html", 101 // below tests (failed or crashes) are filtered out temporarily due to prioritizing 102 "editing/selection/move-left-right.html", 103 }; 104 105 static void fillIgnoreResultSet() { 106 // need test plugin 107 ignoreResultList.add("fast/dom/Window/Plug-ins.html"); 108 // pixel depth 109 ignoreResultList.add("fast/dom/Window/window-screen-properties.html"); 110 // missing space in textrun, ok as text is wrapped. ignore. #714933 111 ignoreResultList.add("fast/events/onload-webkit-before-webcore.html"); 112 // missing support for textInputController.makeAttributedString() 113 ignoreResultList.add("fast/forms/attributed-strings.html"); 114 // charset convert. #516936 ignore, won't fix 115 ignoreResultList.add("fast/forms/form-data-encoding-2.html"); 116 // charset convert. #516936 ignore, won't fix 117 ignoreResultList.add("fast/forms/form-data-encoding.html"); 118 // execCommand "insertText" not supported 119 ignoreResultList.add("fast/forms/input-appearance-maxlength.html"); 120 // Copy&Paste commands not supported 121 ignoreResultList.add("fast/forms/input-truncate-newline.html"); 122 ignoreResultList.add("fast/forms/textarea-paste-newline.html"); 123 // requires eventSender.mouseMoveTo, mouseDown & mouseUp and 124 // abs. position of mouse to select a word. ignore, won't fix #716583 125 ignoreResultList.add("fast/forms/onselect-textarea.html"); 126 // requires eventSender.mouseMoveTo, mouseDown & mouseUp and 127 // abs. position of mouse to select a word. ignore, won't fix #716583 128 ignoreResultList.add("fast/forms/onselect-textfield.html"); 129 // not implemented queryCommandEnabled:BackColor, Undo & Redo 130 ignoreResultList.add("fast/forms/plaintext-mode-1.html"); 131 // Our text areas are a little thinner than Apples. Also RTL test failes 132 ignoreResultList.add("fast/forms/textarea-appearance-wrap.html"); 133 // Our text areas are a little thinner than Apples 134 ignoreResultList.add("fast/forms/textarea-hard-linewrap.html"); 135 // screen width&height are different 136 ignoreResultList.add("fast/frames/frameElement-widthheight.html"); 137 ignoreResultList.add("fast/frames/frame-js-url-clientWidth.html"); 138 // requires JS test API, textInputController 139 ignoreResultList.add("fast/text/attributed-substring-from-range.html"); 140 ignoreResultList.add("fast/text/attributed-substring-from-range-001.html"); 141 // will not fix #619707 142 ignoreResultList.add("fast/css/case-transform.html"); 143 // different platform defaults for font and different screen size 144 ignoreResultList.add("fast/css/computed-style.html"); 145 // different screen size result in extra spaces in Apple compared to us 146 ignoreResultList.add("fast/dom/Element/offsetLeft-offsetTop-body-quirk.html"); 147 // xslt and xpath elements missing from property list 148 ignoreResultList.add("fast/dom/Window/window-properties.html"); 149 // requires textInputController.characterIndexForPoint 150 ignoreResultList.add("fast/dom/character-index-for-point.html"); 151 // requires xpath support 152 ignoreResultList.add("fast/dom/gc-9.html"); 153 // requires xslt and xpath support 154 ignoreResultList.add("fast/dom/global-constructors.html"); 155 // dynamic plugins not supported 156 ignoreResultList.add("fast/dom/object-embed-plugin-scripting.html"); 157 ignoreResultList.add("fast/js/navigator-mimeTypes-length.html"); 158 // there is extra spacing in the file due to multiple input boxes 159 // fitting on one line on Apple, ours are wrapped. Space at line ends 160 // are stripped. 161 ignoreResultList.add("fast/dom/tabindex-clamp.html"); 162 163 // requires eventSender.mouseDown(),mouseUp() 164 ignoreResultList.add("fast/dom/Window/window-xy-properties.html"); 165 ignoreResultList.add("fast/events/window-events-bubble.html"); 166 ignoreResultList.add("fast/events/window-events-bubble2.html"); 167 ignoreResultList.add("fast/events/window-events-capture.html"); 168 ignoreResultList.add("fast/forms/select-empty-list.html"); 169 ignoreResultList.add("fast/replaced/image-map.html"); 170 ignoreResultList.add("fast/events/capture-on-target.html"); 171 ignoreResultList.add("fast/events/dblclick-addEventListener.html"); 172 ignoreResultList.add("fast/events/drag-in-frames.html"); 173 ignoreResultList.add("fast/events/drag-outside-window.html"); 174 ignoreResultList.add("fast/events/event-sender-mouse-click.html"); 175 ignoreResultList.add("fast/events/event-view-toString.html"); 176 ignoreResultList.add("fast/events/frame-click-focus.html"); 177 ignoreResultList.add("fast/events/input-image-scrolled-x-y.html"); 178 ignoreResultList.add("fast/events/anchor-image-scrolled-x-y.html"); 179 ignoreResultList.add("fast/events/mouseclick-target-and-positioning.html"); 180 ignoreResultList.add("fast/events/mouseover-mouseout.html"); 181 ignoreResultList.add("fast/events/mouseover-mouseout2.html"); 182 ignoreResultList.add("fast/events/mouseup-outside-button.html"); 183 ignoreResultList.add("fast/events/mouseup-outside-document.html"); 184 ignoreResultList.add("fast/events/onclick-list-marker.html"); 185 ignoreResultList.add("fast/events/ondragenter.html"); 186 ignoreResultList.add("fast/forms/drag-into-textarea.html"); 187 ignoreResultList.add("fast/forms/input-select-on-click.html"); 188 ignoreResultList.add("fast/forms/listbox-onchange.html"); 189 ignoreResultList.add("fast/forms/search-cancel-button-mouseup.html"); 190 ignoreResultList.add("fast/forms/textarea-scrolled-endline-caret.html"); 191 192 // there is extra spacing in the file due to multiple frame boxes 193 // fitting on one line on Apple, ours are wrapped. Space at line ends 194 // are stripped. 195 ignoreResultList.add("fast/events/iframe-object-onload.html"); 196 // eventSender.mouseDown(), mouseUp() and objc API missing 197 ignoreResultList.add("fast/events/mouseup-outside-document.html"); 198 ignoreResultList.add("fast/events/objc-keyboard-event-creation.html"); 199 ignoreResultList.add("fast/events/objc-event-api.html"); 200 // not capturing the console messages 201 ignoreResultList.add("fast/forms/selected-index-assert.html"); 202 ignoreResultList.add("fast/parser/script-tag-with-trailing-slash.html"); 203 // there is extra spacing as the text areas and input boxes fit next 204 // to each other on Apple, but are wrapped on our screen. 205 ignoreResultList.add("fast/forms/selection-functions.html"); 206 // Text selection done differently on our platform. When a inputbox 207 // gets focus, the entire block is selected. 208 ignoreResultList.add("fast/forms/textarea-initial-caret-position.html"); 209 ignoreResultList.add("fast/forms/textarea-no-scroll-on-blur.html"); 210 // Requires LayoutTests to exist at /tmp/LayoutTests 211 ignoreResultList.add("fast/loader/local-JavaScript-from-local.html"); 212 ignoreResultList.add("fast/loader/local-iFrame-source-from-local.html"); 213 // extra spacing because iFrames rendered next to each other on Apple 214 ignoreResultList.add("fast/loader/opaque-base-url.html"); 215 ignoreResultList.add("fast/text/plain-text-line-breaks.html"); 216 } 217 218 static void fillBugTable() { 219 bugList.put("fast/forms/focus-control-to-page.html", "716638"); 220 bugList.put("fast/html/tab-order.html", "719289"); 221 bugList.put("fast/dom/attribute-namespaces-get-set.html", "733229"); 222 bugList.put("fast/dom/set-innerHTML.html", "733823"); 223 bugList.put("fast/dom/xmlhttprequest-get.html", "733846"); 224 bugList.put("fast/encoding/css-charset-default.html", "733856"); 225 bugList.put("fast/encoding/default-xhtml-encoding.html", "733882"); 226 bugList.put("fast/encoding/meta-in-xhtml.html", "733882"); 227 bugList.put("fast/events/frame-tab-focus.html", "734308"); 228 bugList.put("fast/events/option-tab.html", "734308"); 229 bugList.put("fast/forms/focus2.html", "735111"); 230 bugList.put("fast/forms/listbox-selection.html", "735116"); 231 bugList.put("fast/forms/search-event-delay.html", "735120"); 232 bugList.put("fast/frames/iframe-window-focus.html", "735140"); 233 bugList.put("fast/innerHTML/004.html", "733882"); 234 bugList.put("fast/js/string-capitalization.html", "516936"); 235 bugList.put("fast/js/string-concatenate-outofmemory.html","735152"); 236 bugList.put("fast/parser/external-entities.html", "735176"); 237 bugList.put("fast/overflow/scroll-vertical-not-horizontal.html", "735196"); 238 bugList.put("fast/events/arrow-navigation.html", "735233"); 239 bugList.put("fast/forms/select-type-ahead-non-latin.html", "735244"); 240 } 241 242} 243