FileFilter.java revision f53833b7283b810f9ada3abd9b6cfe21165e2931
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    final static HashSet<String> ignoreResultList = new HashSet<String>();
55
56    static {
57        fillIgnoreResultSet();
58    }
59
60    static final String[] ignoreTestDirs = {
61        ".", // ignore hidden directories and files
62        "resources", // ignore resource directories
63        "AppleScript", // AppleScript not supported
64        ".svn", // don't run anything under .svn folder
65        "profiler",  // profiler is not supported
66        "svg",  // svg is not supported
67        "platform",  // platform specific
68        "http/wml",
69    };
70
71    static final String [] ignoreTestList = {
72        "editing/selection/move-left-right.html",
73        "fast/js/regexp-charclass-crash.html", // RegExp is too large, causing OOM
74        "fast/regex/test1.html", // RegExp is exponential
75        "fast/regex/slow.html", // RegExp is exponential
76        "storage/domstorage/localstorage/private-browsing-affects-storage.html", // No notion of private browsing.
77        "storage/domstorage/sessionstorage/private-browsing-affects-storage.html", // No notion of private browsing.
78        "storage/private-browsing-readonly.html", // No notion of private browsing.
79    };
80
81    static void fillIgnoreResultSet() {
82        ignoreResultList.add("fast/css/case-transform.html"); // will not fix #619707
83        ignoreResultList.add("fast/dom/Element/offsetLeft-offsetTop-body-quirk.html"); // different screen size result in extra spaces in Apple compared to us
84        ignoreResultList.add("fast/dom/Window/Plug-ins.html"); // need test plugin
85        ignoreResultList.add("fast/dom/Window/window-properties.html"); // xslt and xpath elements missing from property list
86        ignoreResultList.add("fast/dom/Window/window-screen-properties.html"); // pixel depth
87        ignoreResultList.add("fast/dom/Window/window-xy-properties.html"); // requires eventSender.mouseDown(),mouseUp()
88        ignoreResultList.add("fast/dom/attribute-namespaces-get-set.html"); // http://b/733229
89        ignoreResultList.add("fast/dom/gc-9.html"); // requires xpath support
90        ignoreResultList.add("fast/dom/global-constructors.html"); // requires xslt and xpath support
91        ignoreResultList.add("fast/dom/object-embed-plugin-scripting.html"); // dynamic plugins not supported
92        ignoreResultList.add("fast/dom/tabindex-clamp.html"); // there is extra spacing in the file due to multiple input boxes fitting on one line on Apple, ours are wrapped. Space at line ends are stripped.
93        ignoreResultList.add("fast/events/anchor-image-scrolled-x-y.html"); // requires eventSender.mouseDown(),mouseUp()
94        ignoreResultList.add("fast/events/arrow-navigation.html"); // http://b/735233
95        ignoreResultList.add("fast/events/capture-on-target.html"); // requires eventSender.mouseDown(),mouseUp()
96        ignoreResultList.add("fast/events/dblclick-addEventListener.html"); // requires eventSender.mouseDown(),mouseUp()
97        ignoreResultList.add("fast/events/drag-in-frames.html"); // requires eventSender.mouseDown(),mouseUp()
98        ignoreResultList.add("fast/events/drag-outside-window.html"); // requires eventSender.mouseDown(),mouseUp()
99        ignoreResultList.add("fast/events/event-view-toString.html"); // requires eventSender.mouseDown(),mouseUp()
100        ignoreResultList.add("fast/events/frame-click-focus.html"); // requires eventSender.mouseDown(),mouseUp()
101        ignoreResultList.add("fast/events/frame-tab-focus.html"); // http://b/734308
102        ignoreResultList.add("fast/events/iframe-object-onload.html"); // there is extra spacing in the file due to multiple frame boxes fitting on one line on Apple, ours are wrapped. Space at line ends are stripped.
103        ignoreResultList.add("fast/events/input-image-scrolled-x-y.html"); // requires eventSender.mouseDown(),mouseUp()
104        ignoreResultList.add("fast/events/mouseclick-target-and-positioning.html"); // requires eventSender.mouseDown(),mouseUp()
105        ignoreResultList.add("fast/events/mouseover-mouseout.html"); // requires eventSender.mouseDown(),mouseUp()
106        ignoreResultList.add("fast/events/mouseover-mouseout2.html"); // requires eventSender.mouseDown(),mouseUp()
107        ignoreResultList.add("fast/events/mouseup-outside-button.html"); // requires eventSender.mouseDown(),mouseUp()
108        ignoreResultList.add("fast/events/mouseup-outside-document.html"); // requires eventSender.mouseDown(),mouseUp()
109        ignoreResultList.add("fast/events/onclick-list-marker.html"); // requires eventSender.mouseDown(),mouseUp()
110        ignoreResultList.add("fast/events/ondragenter.html"); // requires eventSender.mouseDown(),mouseUp()
111        ignoreResultList.add("fast/events/onload-webkit-before-webcore.html"); // missing space in textrun, ok as text is wrapped. ignore. #714933
112        ignoreResultList.add("fast/events/option-tab.html"); // http://b/734308
113        ignoreResultList.add("fast/events/window-events-bubble.html"); // requires eventSender.mouseDown(),mouseUp()
114        ignoreResultList.add("fast/events/window-events-bubble2.html"); // requires eventSender.mouseDown(),mouseUp()
115        ignoreResultList.add("fast/events/window-events-capture.html"); // requires eventSender.mouseDown(),mouseUp()
116        ignoreResultList.add("fast/forms/drag-into-textarea.html"); // requires eventSender.mouseDown(),mouseUp()
117        ignoreResultList.add("fast/forms/focus-control-to-page.html"); // http://b/716638
118        ignoreResultList.add("fast/forms/focus2.html"); // http://b/735111
119        ignoreResultList.add("fast/forms/form-data-encoding-2.html"); // charset convert. #516936 ignore, won't fix
120        ignoreResultList.add("fast/forms/form-data-encoding.html"); // charset convert. #516936 ignore, won't fix
121        ignoreResultList.add("fast/forms/input-appearance-maxlength.html"); // execCommand "insertText" not supported
122        ignoreResultList.add("fast/forms/input-select-on-click.html"); // requires eventSender.mouseDown(),mouseUp()
123        ignoreResultList.add("fast/forms/listbox-onchange.html"); // requires eventSender.mouseDown(),mouseUp()
124        ignoreResultList.add("fast/forms/listbox-selection.html"); // http://b/735116
125        ignoreResultList.add("fast/forms/onselect-textarea.html"); // requires eventSender.mouseMoveTo, mouseDown & mouseUp and abs. position of mouse to select a word. ignore, won't fix #716583
126        ignoreResultList.add("fast/forms/onselect-textfield.html"); // requires eventSender.mouseMoveTo, mouseDown & mouseUp and abs. position of mouse to select a word. ignore, won't fix #716583
127        ignoreResultList.add("fast/forms/plaintext-mode-1.html"); // not implemented queryCommandEnabled:BackColor, Undo & Redo
128        ignoreResultList.add("fast/forms/search-cancel-button-mouseup.html"); // requires eventSender.mouseDown(),mouseUp()
129        ignoreResultList.add("fast/forms/search-event-delay.html"); // http://b/735120
130        ignoreResultList.add("fast/forms/select-empty-list.html"); // requires eventSender.mouseDown(),mouseUp()
131        ignoreResultList.add("fast/forms/select-type-ahead-non-latin.html"); // http://b/735244
132        ignoreResultList.add("fast/forms/selected-index-assert.html"); // not capturing the console messages
133        ignoreResultList.add("fast/forms/selection-functions.html"); // there is extra spacing as the text areas and input boxes fit next to each other on Apple, but are wrapped on our screen.
134        ignoreResultList.add("fast/forms/textarea-appearance-wrap.html"); // Our text areas are a little thinner than Apples. Also RTL test failes
135        ignoreResultList.add("fast/forms/textarea-initial-caret-position.html"); // Text selection done differently on our platform. When a inputbox gets focus, the entire block is selected.
136        ignoreResultList.add("fast/forms/textarea-no-scroll-on-blur.html"); // Text selection done differently on our platform. When a inputbox gets focus, the entire block is selected.
137        ignoreResultList.add("fast/forms/textarea-paste-newline.html"); // Copy&Paste commands not supported
138        ignoreResultList.add("fast/forms/textarea-scrolled-endline-caret.html"); // requires eventSender.mouseDown(),mouseUp()
139        ignoreResultList.add("fast/frames/iframe-window-focus.html"); // http://b/735140
140        ignoreResultList.add("fast/frames/frameElement-widthheight.html"); // screen width&height are different
141        ignoreResultList.add("fast/frames/frame-js-url-clientWidth.html"); // screen width&height are different
142        ignoreResultList.add("fast/html/tab-order.html"); // http://b/719289
143        ignoreResultList.add("fast/js/navigator-mimeTypes-length.html"); // dynamic plugins not supported
144        ignoreResultList.add("fast/js/string-capitalization.html"); // http://b/516936
145        ignoreResultList.add("fast/loader/local-JavaScript-from-local.html"); // Requires LayoutTests to exist at /tmp/LayoutTests
146        ignoreResultList.add("fast/loader/local-iFrame-source-from-local.html"); // Requires LayoutTests to exist at /tmp/LayoutTests
147        ignoreResultList.add("fast/loader/opaque-base-url.html"); // extra spacing because iFrames rendered next to each other on Apple
148        ignoreResultList.add("fast/overflow/scroll-vertical-not-horizontal.html"); // http://b/735196
149        ignoreResultList.add("fast/parser/script-tag-with-trailing-slash.html"); // not capturing the console messages
150        ignoreResultList.add("fast/replaced/image-map.html"); // requires eventSender.mouseDown(),mouseUp()
151        ignoreResultList.add("fast/text/plain-text-line-breaks.html"); // extra spacing because iFrames rendered next to each other on Apple
152    }
153
154}
155