diff options
Diffstat (limited to 'tests')
8 files changed, 81 insertions, 60 deletions
diff --git a/tests/BrowserTestPlugin/jni/PluginObject.h b/tests/BrowserTestPlugin/jni/PluginObject.h index a058d4a..037367e 100644 --- a/tests/BrowserTestPlugin/jni/PluginObject.h +++ b/tests/BrowserTestPlugin/jni/PluginObject.h @@ -65,7 +65,7 @@ class SubPlugin { public: SubPlugin(NPP inst) : m_inst(inst) {} virtual ~SubPlugin() {} - virtual int16 handleEvent(const ANPEvent* evt) = 0; + virtual int16_t handleEvent(const ANPEvent* evt) = 0; NPP inst() const { return m_inst; } diff --git a/tests/BrowserTestPlugin/jni/event/EventPlugin.cpp b/tests/BrowserTestPlugin/jni/event/EventPlugin.cpp index 2eff394..91f1b3d 100644 --- a/tests/BrowserTestPlugin/jni/event/EventPlugin.cpp +++ b/tests/BrowserTestPlugin/jni/event/EventPlugin.cpp @@ -138,7 +138,7 @@ void EventPlugin::printToDiv(const char* text, int length) { browser->memfree(beginMem); } -int16 EventPlugin::handleEvent(const ANPEvent* evt) { +int16_t EventPlugin::handleEvent(const ANPEvent* evt) { switch (evt->eventType) { case kDraw_ANPEventType: { diff --git a/tests/BrowserTestPlugin/jni/event/EventPlugin.h b/tests/BrowserTestPlugin/jni/event/EventPlugin.h index 88b7c9d..043be85 100644 --- a/tests/BrowserTestPlugin/jni/event/EventPlugin.h +++ b/tests/BrowserTestPlugin/jni/event/EventPlugin.h @@ -32,7 +32,7 @@ class EventPlugin : public SubPlugin { public: EventPlugin(NPP inst); virtual ~EventPlugin(); - virtual int16 handleEvent(const ANPEvent* evt); + virtual int16_t handleEvent(const ANPEvent* evt); private: void drawPlugin(const ANPBitmap& bitmap, const ANPRectI& clip); diff --git a/tests/BrowserTestPlugin/jni/main.cpp b/tests/BrowserTestPlugin/jni/main.cpp index 402a7e2..511180c 100644 --- a/tests/BrowserTestPlugin/jni/main.cpp +++ b/tests/BrowserTestPlugin/jni/main.cpp @@ -34,19 +34,19 @@ NPNetscapeFuncs* browser; #define EXPORT __attribute__((visibility("default"))) -NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, +NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); NPError NPP_Destroy(NPP instance, NPSavedData** save); NPError NPP_SetWindow(NPP instance, NPWindow* window); NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, - NPBool seekable, uint16* stype); + NPBool seekable, uint16_t* stype); NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason); -int32 NPP_WriteReady(NPP instance, NPStream* stream); -int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, +int32_t NPP_WriteReady(NPP instance, NPStream* stream); +int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer); void NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname); void NPP_Print(NPP instance, NPPrint* platformPrint); -int16 NPP_HandleEvent(NPP instance, void* event); +int16_t NPP_HandleEvent(NPP instance, void* event); void NPP_URLNotify(NPP instance, const char* URL, NPReason reason, void* notifyData); NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value); @@ -129,7 +129,7 @@ const char *NP_GetMIMEDescription(void) return "application/x-browsertestplugin:btp:Android Browser Test Plugin"; } -NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, +NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved) { @@ -188,7 +188,7 @@ NPError NPP_SetWindow(NPP instance, NPWindow* window) return NPERR_NO_ERROR; } -NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype) +NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype) { *stype = NP_ASFILEONLY; return NPERR_NO_ERROR; @@ -199,12 +199,12 @@ NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason) return NPERR_NO_ERROR; } -int32 NPP_WriteReady(NPP instance, NPStream* stream) +int32_t NPP_WriteReady(NPP instance, NPStream* stream) { return 0; } -int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer) +int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer) { return 0; } @@ -217,7 +217,7 @@ void NPP_Print(NPP instance, NPPrint* platformPrint) { } -int16 NPP_HandleEvent(NPP instance, void* event) +int16_t NPP_HandleEvent(NPP instance, void* event) { PluginObject *obj = reinterpret_cast<PluginObject*>(instance->pdata); const ANPEvent* evt = reinterpret_cast<const ANPEvent*>(event); diff --git a/tests/DumpRenderTree/assets/run_layout_tests.py b/tests/DumpRenderTree/assets/run_layout_tests.py index b6e7bf3..ceac5d2 100755 --- a/tests/DumpRenderTree/assets/run_layout_tests.py +++ b/tests/DumpRenderTree/assets/run_layout_tests.py @@ -176,7 +176,7 @@ def main(options, args): # Count crashed tests. crashed_tests = [] - timeout_ms = '30000' + timeout_ms = '15000' if options.time_out_ms: timeout_ms = options.time_out_ms diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java b/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java index 77fd3ed..dc0c23b 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java @@ -73,25 +73,33 @@ public class FileFilter { static final String[] ignoreTestList = { "editing/selection/move-left-right.html", // Causes DumpRenderTree to hang + "fast/js/excessive-comma-usage.html", // Tests huge initializer list, causes OOM. "fast/js/regexp-charclass-crash.html", // RegExp is too large, causing OOM "fast/regex/test1.html", // Causes DumpRenderTree to hang with V8 "fast/regex/slow.html" // Causes DumpRenderTree to hang with V8 }; static void fillIgnoreResultList() { - // This first block of tests are for HTML5 features, for which Android + // This first block of tests are for features for which Android // should pass all tests. They are skipped only temporarily. // TODO: Fix these failing tests and remove them from this list. + ignoreResultList.add("fast/events/touch/basic-multi-touch-events.html"); // Requires multi-touch + ignoreResultList.add("fast/events/touch/touch-target.html"); // Requires multi-touch ignoreResultList.add("http/tests/appcache/empty-manifest.html"); // flaky + ignoreResultList.add("http/tests/appcache/fallback.html"); // http://b/issue?id=2713004 ignoreResultList.add("http/tests/appcache/foreign-iframe-main.html"); // flaky - skips states ignoreResultList.add("http/tests/appcache/manifest-with-empty-file.html"); // flaky ignoreResultList.add("storage/database-lock-after-reload.html"); // Succeeds but DumpRenderTree does not read result correctly ignoreResultList.add("storage/hash-change-with-xhr.html"); // Succeeds but DumpRenderTree does not read result correctly - - // Will always fail - ignoreResultList.add("dom/svg/level3/xpath"); // XPath not supported + ignoreResultList.add("storage/open-database-creation-callback-isolated-world.html"); // Requires layoutTestController.evaluateScriptInIsolatedWorld() + ignoreResultList.add("storage/statement-error-callback-isolated-world.html"); // Requires layoutTestController.evaluateScriptInIsolatedWorld() + ignoreResultList.add("storage/statement-success-callback-isolated-world.html"); // Requires layoutTestController.evaluateScriptInIsolatedWorld() + ignoreResultList.add("storage/transaction-callback-isolated-world.html"); // Requires layoutTestController.evaluateScriptInIsolatedWorld() + ignoreResultList.add("storage/transaction-error-callback-isolated-world.html"); // Requires layoutTestController.evaluateScriptInIsolatedWorld() + + // Expected failures due to unsupported features. + ignoreResultList.add("fast/events/touch/touch-coords-in-zoom-and-scroll.html"); // Requires eventSender.zoomPageIn(),zoomPageOut() ignoreResultList.add("fast/workers"); // workers not supported - ignoreResultList.add("fast/xpath"); // XPath not supported ignoreResultList.add("http/tests/eventsource/workers"); // workers not supported ignoreResultList.add("http/tests/workers"); // workers not supported ignoreResultList.add("http/tests/xmlhttprequest/workers"); // workers not supported @@ -104,12 +112,9 @@ public class FileFilter { ignoreResultList.add("fast/css/case-transform.html"); // will not fix #619707 ignoreResultList.add("fast/dom/Element/offsetLeft-offsetTop-body-quirk.html"); // different screen size result in extra spaces in Apple compared to us ignoreResultList.add("fast/dom/Window/Plug-ins.html"); // need test plugin - ignoreResultList.add("fast/dom/Window/window-properties.html"); // xslt and xpath elements missing from property list ignoreResultList.add("fast/dom/Window/window-screen-properties.html"); // pixel depth ignoreResultList.add("fast/dom/Window/window-xy-properties.html"); // requires eventSender.mouseDown(),mouseUp() ignoreResultList.add("fast/dom/attribute-namespaces-get-set.html"); // http://b/733229 - ignoreResultList.add("fast/dom/gc-9.html"); // requires xpath support - ignoreResultList.add("fast/dom/global-constructors.html"); // requires xslt and xpath support ignoreResultList.add("fast/dom/object-embed-plugin-scripting.html"); // dynamic plugins not supported 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. ignoreResultList.add("fast/events/anchor-image-scrolled-x-y.html"); // requires eventSender.mouseDown(),mouseUp() @@ -172,8 +177,6 @@ public class FileFilter { ignoreResultList.add("fast/replaced/image-map.html"); // requires eventSender.mouseDown(),mouseUp() ignoreResultList.add("fast/text/plain-text-line-breaks.html"); // extra spacing because iFrames rendered next to each other on Apple ignoreResultList.add("profiler"); // profiler is not supported - ignoreResultList.add("svg"); // svg is not supported - } } diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java index 042158a..a2809c3 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java @@ -18,12 +18,9 @@ package com.android.dumprendertree; import com.android.dumprendertree.TestShellActivity.DumpDataType; import com.android.dumprendertree.forwarder.AdbUtils; -import com.android.dumprendertree.forwarder.ForwardServer; import com.android.dumprendertree.forwarder.ForwardService; -import android.app.Instrumentation; import android.content.Intent; -import android.os.Bundle; import android.test.ActivityInstrumentationTestCase2; import android.util.Log; @@ -156,18 +153,11 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh private String mJsEngine; private String mTestPathPrefix; private boolean mFinished; + private int mTestCount; + private int mResumeIndex; public LayoutTestsAutoTest() { - super("com.android.dumprendertree", TestShellActivity.class); - } - - // This function writes the result of the layout test to - // Am status so that it can be picked up from a script. - private void passOrFailCallback(String file, boolean result) { - Instrumentation inst = getInstrumentation(); - Bundle bundle = new Bundle(); - bundle.putBoolean(file, result); - inst.sendStatus(0, bundle); + super(TestShellActivity.class); } private void getTestList() { @@ -188,6 +178,7 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh } catch (Exception e) { Log.e(LOGTAG, "Error while reading test list : " + e.getMessage()); } + mTestCount = mTestList.size(); } private void resumeTestList() { @@ -198,6 +189,7 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh if (mTestList.elementAt(i).equals(line)) { mTestList = new Vector<String>(mTestList.subList(i+1, mTestList.size())); mTestListIgnoreResult = new Vector<Boolean>(mTestListIgnoreResult.subList(i+1, mTestListIgnoreResult.size())); + mResumeIndex = i + 1; break; } } @@ -298,7 +290,7 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh } } - private void runTestAndWaitUntilDone(TestShellActivity activity, String test, int timeout, boolean ignoreResult) { + private void runTestAndWaitUntilDone(TestShellActivity activity, String test, int timeout, boolean ignoreResult, int testIndex) { activity.setCallback(new TestShellCallback() { public void finished() { synchronized (LayoutTestsAutoTest.this) { @@ -334,6 +326,8 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh intent.putExtra(TestShellActivity.TEST_URL, FsUtils.getTestUrl(test)); intent.putExtra(TestShellActivity.RESULT_FILE, resultFile); intent.putExtra(TestShellActivity.TIMEOUT_IN_MILLIS, timeout); + intent.putExtra(TestShellActivity.TEST_COUNT, mTestCount); + intent.putExtra(TestShellActivity.TEST_INDEX, testIndex); activity.startActivity(intent); // Wait until done. @@ -373,8 +367,8 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh // Read settings mTestPathPrefix = (new File(LAYOUT_TESTS_ROOT + runner.mTestPath)).getAbsolutePath(); mRebaselineResults = runner.mRebaseline; - // JSC is the default JavaScript engine. - mJsEngine = runner.mJsEngine == null ? "jsc" : runner.mJsEngine; + // V8 is the default JavaScript engine. + mJsEngine = runner.mJsEngine == null ? "v8" : runner.mJsEngine; int timeout = runner.mTimeoutInMillis; if (timeout <= 0) { @@ -391,7 +385,7 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh resumeTestList(); TestShellActivity activity = getActivity(); - activity.setDefaultDumpDataType(DumpDataType.DUMP_AS_TEXT); + activity.setDefaultDumpDataType(DumpDataType.EXT_REPR); // Run tests. int addr = -1; @@ -408,7 +402,7 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh boolean ignoreResult = mTestListIgnoreResult.elementAt(i); FsUtils.updateTestStatus(TEST_STATUS_FILE, s); // Run tests - runTestAndWaitUntilDone(activity, s, runner.mTimeoutInMillis, ignoreResult); + runTestAndWaitUntilDone(activity, s, runner.mTimeoutInMillis, ignoreResult, i + mResumeIndex); } FsUtils.updateTestStatus(TEST_STATUS_FILE, "#DONE"); diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java index 81d5b08..5b4cf22 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java @@ -34,6 +34,7 @@ import android.os.Handler; import android.os.Message; import android.util.Log; import android.view.ViewGroup; +import android.webkit.ConsoleMessage; import android.webkit.GeolocationPermissions; import android.webkit.HttpAuthHandler; import android.webkit.JsPromptResult; @@ -171,6 +172,9 @@ public class TestShellActivity extends Activity implements LayoutTestController mTimeoutInMillis = intent.getIntExtra(TIMEOUT_IN_MILLIS, 0); mGetDrawtime = intent.getBooleanExtra(GET_DRAW_TIME, false); mSaveImagePath = intent.getStringExtra(SAVE_IMAGE); + mTestCount = intent.getIntExtra(TEST_COUNT, 0); + mTestIndex = intent.getIntExtra(TEST_INDEX, 0); + setTitle("Test " + (mTestIndex + 1) + " of " + mTestCount); Log.v(LOGTAG, " Loading " + mTestUrl); mWebView.loadUrl(mTestUrl); @@ -570,9 +574,7 @@ public class TestShellActivity extends Activity implements LayoutTestController @Override public void onReceivedTitle(WebView view, String title) { - if (title.length() > 30) - title = "..."+title.substring(title.length()-30); - setTitle(title); + setTitle("Test " + (mTestIndex + 1) + " of " + mTestCount + ": "+ title); if (mDumpTitleChanges) { mTitleChanges.append("TITLE CHANGED: "); mTitleChanges.append(title); @@ -675,15 +677,28 @@ public class TestShellActivity extends Activity implements LayoutTestController } @Override - public void onConsoleMessage(String message, int lineNumber, - String sourceID) { + public boolean onConsoleMessage(ConsoleMessage consoleMessage) { + String msg = "CONSOLE MESSAGE: line " + consoleMessage.lineNumber() + ": " + + consoleMessage.message() + "\n"; if (mConsoleMessages == null) { mConsoleMessages = new StringBuffer(); } - String consoleMessage = "CONSOLE MESSAGE: line " - + lineNumber +": "+ message +"\n"; - mConsoleMessages.append(consoleMessage); - Log.v(LOGTAG, "LOG: "+consoleMessage); + mConsoleMessages.append(msg); + Log.v(LOGTAG, "LOG: " + msg); + // the rationale here is that if there's an error of either type, and the test was + // waiting for "notifyDone" signal to finish, then there's no point in waiting + // anymore because the JS execution is already terminated at this point and a + // "notifyDone" will never come out so it's just wasting time till timeout kicks in + if (msg.contains("Uncaught ReferenceError:") || msg.contains("Uncaught TypeError:") + && mWaitUntilDone) { + Log.w(LOGTAG, "Terminating test case on uncaught ReferenceError or TypeError."); + mHandler.postDelayed(new Runnable() { + public void run() { + notifyDone(); + } + }, 500); + } + return true; } @Override @@ -742,6 +757,7 @@ public class TestShellActivity extends Activity implements LayoutTestController mDumpWebKitData = false; mGetDrawtime = false; mSaveImagePath = null; + setDefaultWebSettings(mWebView); } private long[] getDrawWebViewTime(WebView view, int count) { @@ -786,6 +802,19 @@ public class TestShellActivity extends Activity implements LayoutTestController return; } + setDefaultWebSettings(webview); + + webview.setWebChromeClient(mChromeClient); + webview.setWebViewClient(mViewClient); + // Setting a touch interval of -1 effectively disables the optimisation in WebView + // that stops repeated touch events flooding WebCore. The Event Sender only sends a + // single event rather than a stream of events (like what would generally happen in + // a real use of touch events in a WebView) and so if the WebView drops the event, + // the test will fail as the test expects one callback for every touch it synthesizes. + webview.setTouchInterval(-1); + } + + public void setDefaultWebSettings(WebView webview) { WebSettings settings = webview.getSettings(); settings.setAppCacheEnabled(true); settings.setAppCachePath(getApplicationContext().getCacheDir().getPath()); @@ -798,15 +827,6 @@ public class TestShellActivity extends Activity implements LayoutTestController settings.setDatabasePath(getDir("databases",0).getAbsolutePath()); settings.setDomStorageEnabled(true); settings.setWorkersEnabled(false); - - webview.setWebChromeClient(mChromeClient); - webview.setWebViewClient(mViewClient); - // Setting a touch interval of -1 effectively disables the optimisation in WebView - // that stops repeated touch events flooding WebCore. The Event Sender only sends a - // single event rather than a stream of events (like what would generally happen in - // a real use of touch events in a WebView) and so if the WebView drops the event, - // the test will fail as the test expects one callback for every touch it synthesizes. - webview.setTouchInterval(-1); } private WebView mWebView; @@ -823,6 +843,8 @@ public class TestShellActivity extends Activity implements LayoutTestController private String mSaveImagePath; private BufferedReader mTestListReader; private boolean mGetDrawtime; + private int mTestCount; + private int mTestIndex; // States private boolean mTimedOut; @@ -860,6 +882,8 @@ public class TestShellActivity extends Activity implements LayoutTestController static final String UI_AUTO_TEST = "UiAutoTest"; static final String GET_DRAW_TIME = "GetDrawTime"; static final String SAVE_IMAGE = "SaveImage"; + static final String TEST_COUNT = "TestCount"; + static final String TEST_INDEX = "TestIndex"; static final int DRAW_RUNS = 5; static final String DRAW_TIME_LOG = "/sdcard/android/page_draw_time.txt"; |