From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- widget/tests/TestAppShellSteadyState.cpp | 503 ++ widget/tests/TestChromeMargin.cpp | 155 + widget/tests/bug586713_window.xul | 50 + widget/tests/chrome.ini | 100 + widget/tests/chrome_context_menus_win.xul | 101 + widget/tests/empty_window.xul | 4 + widget/tests/mochitest.ini | 12 + widget/tests/moz.build | 15 + widget/tests/native_menus_window.xul | 285 + widget/tests/native_mouse_mac_window.xul | 773 +++ widget/tests/standalone_native_menu_window.xul | 334 + widget/tests/taskbar_previews.xul | 127 + widget/tests/test_assign_event_data.html | 748 +++ widget/tests/test_bug1123480.xul | 79 + widget/tests/test_bug1151186.html | 43 + widget/tests/test_bug343416.xul | 202 + widget/tests/test_bug413277.html | 36 + widget/tests/test_bug428405.xul | 167 + widget/tests/test_bug429954.xul | 44 + widget/tests/test_bug444800.xul | 102 + widget/tests/test_bug466599.xul | 109 + widget/tests/test_bug478536.xul | 34 + widget/tests/test_bug485118.xul | 71 + widget/tests/test_bug517396.xul | 56 + widget/tests/test_bug522217.xul | 36 + widget/tests/test_bug538242.xul | 55 + widget/tests/test_bug565392.html | 70 + widget/tests/test_bug586713.xul | 30 + widget/tests/test_bug593307.xul | 46 + widget/tests/test_bug596600.xul | 177 + widget/tests/test_bug673301.xul | 40 + widget/tests/test_bug760802.xul | 91 + widget/tests/test_chrome_context_menus_win.xul | 27 + widget/tests/test_clipboard.xul | 80 + .../tests/test_composition_text_querycontent.xul | 34 + widget/tests/test_imestate.html | 1529 +++++ .../tests/test_input_events_on_deactive_window.xul | 236 + widget/tests/test_key_event_counts.xul | 90 + widget/tests/test_keycodes.xul | 4361 ++++++++++++ widget/tests/test_mouse_scroll.xul | 28 + widget/tests/test_native_key_bindings_mac.html | 343 + widget/tests/test_native_menus.xul | 30 + widget/tests/test_native_mouse_mac.xul | 30 + widget/tests/test_panel_mouse_coords.xul | 83 + widget/tests/test_picker_no_crash.html | 36 + widget/tests/test_platform_colors.xul | 107 + widget/tests/test_plugin_input_event.html | 74 + widget/tests/test_plugin_scroll_consistency.html | 61 + widget/tests/test_position_on_resize.xul | 94 + widget/tests/test_secure_input.html | 148 + widget/tests/test_sizemode_events.xul | 105 + widget/tests/test_standalone_native_menu.xul | 30 + widget/tests/test_system_status_bar.xul | 57 + widget/tests/test_taskbar_progress.xul | 126 + widget/tests/test_wheeltransaction.xul | 28 + widget/tests/unit/test_macwebapputils.js | 44 + widget/tests/unit/test_taskbar_jumplistitems.js | 261 + widget/tests/unit/xpcshell.ini | 7 + widget/tests/utils.js | 27 + widget/tests/window_bug429954.xul | 45 + widget/tests/window_bug478536.xul | 215 + widget/tests/window_bug522217.xul | 72 + widget/tests/window_bug538242.xul | 3 + widget/tests/window_bug593307_centerscreen.xul | 27 + widget/tests/window_bug593307_offscreen.xul | 34 + .../tests/window_composition_text_querycontent.xul | 6992 ++++++++++++++++++++ widget/tests/window_imestate_iframes.html | 380 ++ widget/tests/window_mouse_scroll_win.html | 1531 +++++ widget/tests/window_picker_no_crash_child.html | 10 + widget/tests/window_state_windows.xul | 87 + widget/tests/window_wheeltransaction.xul | 1560 +++++ 71 files changed, 23727 insertions(+) create mode 100644 widget/tests/TestAppShellSteadyState.cpp create mode 100644 widget/tests/TestChromeMargin.cpp create mode 100644 widget/tests/bug586713_window.xul create mode 100644 widget/tests/chrome.ini create mode 100644 widget/tests/chrome_context_menus_win.xul create mode 100644 widget/tests/empty_window.xul create mode 100644 widget/tests/mochitest.ini create mode 100644 widget/tests/moz.build create mode 100644 widget/tests/native_menus_window.xul create mode 100644 widget/tests/native_mouse_mac_window.xul create mode 100644 widget/tests/standalone_native_menu_window.xul create mode 100644 widget/tests/taskbar_previews.xul create mode 100644 widget/tests/test_assign_event_data.html create mode 100644 widget/tests/test_bug1123480.xul create mode 100644 widget/tests/test_bug1151186.html create mode 100644 widget/tests/test_bug343416.xul create mode 100644 widget/tests/test_bug413277.html create mode 100644 widget/tests/test_bug428405.xul create mode 100644 widget/tests/test_bug429954.xul create mode 100644 widget/tests/test_bug444800.xul create mode 100644 widget/tests/test_bug466599.xul create mode 100644 widget/tests/test_bug478536.xul create mode 100644 widget/tests/test_bug485118.xul create mode 100644 widget/tests/test_bug517396.xul create mode 100644 widget/tests/test_bug522217.xul create mode 100644 widget/tests/test_bug538242.xul create mode 100644 widget/tests/test_bug565392.html create mode 100644 widget/tests/test_bug586713.xul create mode 100644 widget/tests/test_bug593307.xul create mode 100644 widget/tests/test_bug596600.xul create mode 100644 widget/tests/test_bug673301.xul create mode 100644 widget/tests/test_bug760802.xul create mode 100644 widget/tests/test_chrome_context_menus_win.xul create mode 100644 widget/tests/test_clipboard.xul create mode 100644 widget/tests/test_composition_text_querycontent.xul create mode 100644 widget/tests/test_imestate.html create mode 100644 widget/tests/test_input_events_on_deactive_window.xul create mode 100644 widget/tests/test_key_event_counts.xul create mode 100644 widget/tests/test_keycodes.xul create mode 100644 widget/tests/test_mouse_scroll.xul create mode 100644 widget/tests/test_native_key_bindings_mac.html create mode 100644 widget/tests/test_native_menus.xul create mode 100644 widget/tests/test_native_mouse_mac.xul create mode 100644 widget/tests/test_panel_mouse_coords.xul create mode 100644 widget/tests/test_picker_no_crash.html create mode 100644 widget/tests/test_platform_colors.xul create mode 100644 widget/tests/test_plugin_input_event.html create mode 100644 widget/tests/test_plugin_scroll_consistency.html create mode 100644 widget/tests/test_position_on_resize.xul create mode 100644 widget/tests/test_secure_input.html create mode 100644 widget/tests/test_sizemode_events.xul create mode 100644 widget/tests/test_standalone_native_menu.xul create mode 100644 widget/tests/test_system_status_bar.xul create mode 100644 widget/tests/test_taskbar_progress.xul create mode 100644 widget/tests/test_wheeltransaction.xul create mode 100644 widget/tests/unit/test_macwebapputils.js create mode 100644 widget/tests/unit/test_taskbar_jumplistitems.js create mode 100644 widget/tests/unit/xpcshell.ini create mode 100644 widget/tests/utils.js create mode 100644 widget/tests/window_bug429954.xul create mode 100644 widget/tests/window_bug478536.xul create mode 100644 widget/tests/window_bug522217.xul create mode 100644 widget/tests/window_bug538242.xul create mode 100644 widget/tests/window_bug593307_centerscreen.xul create mode 100644 widget/tests/window_bug593307_offscreen.xul create mode 100644 widget/tests/window_composition_text_querycontent.xul create mode 100644 widget/tests/window_imestate_iframes.html create mode 100644 widget/tests/window_mouse_scroll_win.html create mode 100644 widget/tests/window_picker_no_crash_child.html create mode 100644 widget/tests/window_state_windows.xul create mode 100644 widget/tests/window_wheeltransaction.xul (limited to 'widget/tests') diff --git a/widget/tests/TestAppShellSteadyState.cpp b/widget/tests/TestAppShellSteadyState.cpp new file mode 100644 index 000000000..03888fc0a --- /dev/null +++ b/widget/tests/TestAppShellSteadyState.cpp @@ -0,0 +1,503 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +#include "TestHarness.h" + +#include "nsIAppShell.h" +#include "nsIAppShellService.h" +#include "nsIDocument.h" +#include "nsIDOMEvent.h" +#include "nsIDOMEventListener.h" +#include "nsIDOMEventTarget.h" +#include "nsIDOMWindow.h" +#include "nsIDOMWindowUtils.h" +#include "nsIInterfaceRequestor.h" +#include "nsIRunnable.h" +#include "nsIURI.h" +#include "nsIWebBrowserChrome.h" +#include "nsIXULWindow.h" + +#include "nsAppShellCID.h" +#include "nsIInterfaceRequestorUtils.h" +#include "nsNetUtil.h" +#include "nsThreadUtils.h" +#include "mozilla/Attributes.h" + +#ifdef XP_WIN +#include +#endif + +using namespace mozilla; + +typedef void (*TestFunc)(nsIAppShell*); + +bool gStableStateEventHasRun = false; + +class ExitAppShellRunnable : public Runnable +{ + nsCOMPtr mAppShell; + +public: + explicit ExitAppShellRunnable(nsIAppShell* aAppShell) + : mAppShell(aAppShell) + { } + + NS_IMETHOD + Run() override + { + return mAppShell->Exit(); + } +}; + +class StableStateRunnable : public Runnable +{ +public: + NS_IMETHOD + Run() override + { + if (gStableStateEventHasRun) { + fail("StableStateRunnable already ran"); + } + gStableStateEventHasRun = true; + return NS_OK; + } +}; + +class CheckStableStateRunnable : public Runnable +{ + bool mShouldHaveRun; + +public: + explicit CheckStableStateRunnable(bool aShouldHaveRun) + : mShouldHaveRun(aShouldHaveRun) + { } + + NS_IMETHOD + Run() override + { + if (mShouldHaveRun == gStableStateEventHasRun) { + passed("StableStateRunnable state correct (%s)", + mShouldHaveRun ? "true" : "false"); + } else { + fail("StableStateRunnable ran at wrong time"); + } + return NS_OK; + } +}; + +class ScheduleStableStateRunnable : public CheckStableStateRunnable +{ +protected: + nsCOMPtr mAppShell; + +public: + explicit ScheduleStableStateRunnable(nsIAppShell* aAppShell) + : CheckStableStateRunnable(false), mAppShell(aAppShell) + { } + + NS_IMETHOD + Run() override + { + CheckStableStateRunnable::Run(); + + nsCOMPtr runnable = new StableStateRunnable(); + nsresult rv = mAppShell->RunBeforeNextEvent(runnable); + if (NS_FAILED(rv)) { + fail("RunBeforeNextEvent returned failure code %u", rv); + } + + return rv; + } +}; + +class NextTestRunnable : public Runnable +{ + nsCOMPtr mAppShell; + +public: + explicit NextTestRunnable(nsIAppShell* aAppShell) + : mAppShell(aAppShell) + { } + + NS_IMETHOD Run(); +}; + +class ScheduleNestedStableStateRunnable : public ScheduleStableStateRunnable +{ +public: + explicit ScheduleNestedStableStateRunnable(nsIAppShell* aAppShell) + : ScheduleStableStateRunnable(aAppShell) + { } + + NS_IMETHOD + Run() override + { + ScheduleStableStateRunnable::Run(); + + nsCOMPtr runnable = new CheckStableStateRunnable(false); + if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) { + fail("Failed to dispatch check runnable"); + } + + if (NS_FAILED(NS_ProcessPendingEvents(nullptr))) { + fail("Failed to process all pending events"); + } + + runnable = new CheckStableStateRunnable(true); + if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) { + fail("Failed to dispatch check runnable"); + } + + runnable = new NextTestRunnable(mAppShell); + if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) { + fail("Failed to dispatch next test runnable"); + } + + return NS_OK; + } +}; + +class EventListener final : public nsIDOMEventListener +{ + nsCOMPtr mAppShell; + + static nsIDOMWindowUtils* sWindowUtils; + static nsIAppShell* sAppShell; + + ~EventListener() {} + +public: + NS_DECL_ISUPPORTS + + explicit EventListener(nsIAppShell* aAppShell) + : mAppShell(aAppShell) + { } + + NS_IMETHOD + HandleEvent(nsIDOMEvent* aEvent) override + { + nsString type; + if (NS_FAILED(aEvent->GetType(type))) { + fail("Failed to get event type"); + return NS_ERROR_FAILURE; + } + + if (type.EqualsLiteral("load")) { + passed("Got load event"); + + nsCOMPtr target; + if (NS_FAILED(aEvent->GetTarget(getter_AddRefs(target)))) { + fail("Failed to get event type"); + return NS_ERROR_FAILURE; + } + + nsCOMPtr document = do_QueryInterface(target); + if (!document) { + fail("Failed to QI to nsIDocument!"); + return NS_ERROR_FAILURE; + } + + nsCOMPtr window = document->GetWindow(); + if (!window) { + fail("Failed to get window from document!"); + return NS_ERROR_FAILURE; + } + + nsCOMPtr utils = do_GetInterface(window); + if (!utils) { + fail("Failed to get DOMWindowUtils!"); + return NS_ERROR_FAILURE; + } + + if (!ScheduleTimer(utils)) { + return NS_ERROR_FAILURE; + } + + return NS_OK; + } + + if (type.EqualsLiteral("keypress")) { + passed("Got keypress event"); + + nsCOMPtr runnable = new StableStateRunnable(); + nsresult rv = mAppShell->RunBeforeNextEvent(runnable); + if (NS_FAILED(rv)) { + fail("RunBeforeNextEvent returned failure code %u", rv); + return NS_ERROR_FAILURE; + } + + return NS_OK; + } + + fail("Got an unexpected event: %s", NS_ConvertUTF16toUTF8(type).get()); + return NS_OK; + } + +#ifdef XP_WIN + static VOID CALLBACK + TimerCallback(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime) + { + if (sWindowUtils) { + nsCOMPtr utils = dont_AddRef(sWindowUtils); + sWindowUtils = nullptr; + + if (gStableStateEventHasRun) { + fail("StableStateRunnable ran at wrong time"); + } else { + passed("StableStateRunnable state correct (false)"); + } + + int32_t layout = 0x409; // US + int32_t keyCode = 0x41; // VK_A + NS_NAMED_LITERAL_STRING(a, "a"); + + if (NS_FAILED(utils->SendNativeKeyEvent(layout, keyCode, 0, a, a, nullptr))) { + fail("Failed to synthesize native event"); + } + + return; + } + + KillTimer(nullptr, idEvent); + + nsCOMPtr appShell = dont_AddRef(sAppShell); + + if (!gStableStateEventHasRun) { + fail("StableStateRunnable didn't run yet"); + } else { + passed("StableStateRunnable state correct (true)"); + } + + nsCOMPtr runnable = new NextTestRunnable(appShell); + if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) { + fail("Failed to dispatch next test runnable"); + } + + } +#endif + + bool + ScheduleTimer(nsIDOMWindowUtils* aWindowUtils) + { +#ifdef XP_WIN + UINT_PTR timerId = SetTimer(nullptr, 0, 1000, (TIMERPROC)TimerCallback); + if (!timerId) { + fail("SetTimer failed!"); + return false; + } + + nsCOMPtr utils = aWindowUtils; + utils.forget(&sWindowUtils); + + nsCOMPtr appShell = mAppShell; + appShell.forget(&sAppShell); + + return true; +#else + return false; +#endif + } +}; + +nsIDOMWindowUtils* EventListener::sWindowUtils = nullptr; +nsIAppShell* EventListener::sAppShell = nullptr; + +NS_IMPL_ISUPPORTS(EventListener, nsIDOMEventListener) + +already_AddRefed +GetAppShell() +{ + static const char* platforms[] = { + "android", "mac", "gonk", "gtk", "qt", "win" + }; + + NS_NAMED_LITERAL_CSTRING(contractPrefix, "@mozilla.org/widget/appshell/"); + NS_NAMED_LITERAL_CSTRING(contractSuffix, ";1"); + + for (size_t index = 0; index < ArrayLength(platforms); index++) { + nsAutoCString contractID(contractPrefix); + contractID.AppendASCII(platforms[index]); + contractID.Append(contractSuffix); + + nsCOMPtr appShell = do_GetService(contractID.get()); + if (appShell) { + return appShell.forget(); + } + } + + return nullptr; +} + +void +Test1(nsIAppShell* aAppShell) +{ + // Schedule stable state runnable to be run before next event. + + nsCOMPtr runnable = new StableStateRunnable(); + if (NS_FAILED(aAppShell->RunBeforeNextEvent(runnable))) { + fail("RunBeforeNextEvent failed"); + } + + runnable = new CheckStableStateRunnable(true); + if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) { + fail("Failed to dispatch check runnable"); + } + + runnable = new NextTestRunnable(aAppShell); + if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) { + fail("Failed to dispatch next test runnable"); + } +} + +void +Test2(nsIAppShell* aAppShell) +{ + // Schedule stable state runnable to be run before next event from another + // runnable. + + nsCOMPtr runnable = new ScheduleStableStateRunnable(aAppShell); + if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) { + fail("Failed to dispatch schedule runnable"); + } + + runnable = new CheckStableStateRunnable(true); + if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) { + fail("Failed to dispatch check runnable"); + } + + runnable = new NextTestRunnable(aAppShell); + if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) { + fail("Failed to dispatch next test runnable"); + } +} + +void +Test3(nsIAppShell* aAppShell) +{ + // Schedule steadystate runnable to be run before next event with nested loop. + + nsCOMPtr runnable = + new ScheduleNestedStableStateRunnable(aAppShell); + if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) { + fail("Failed to dispatch schedule runnable"); + } +} + +bool +Test4Internal(nsIAppShell* aAppShell) +{ +#ifndef XP_WIN + // Not sure how to test on other platforms. + return false; +#else + nsCOMPtr appService = + do_GetService(NS_APPSHELLSERVICE_CONTRACTID); + if (!appService) { + fail("Failed to get appshell service!"); + return false; + } + + nsCOMPtr uri; + if (NS_FAILED(NS_NewURI(getter_AddRefs(uri), "about:", nullptr))) { + fail("Failed to create new uri"); + return false; + } + + uint32_t flags = nsIWebBrowserChrome::CHROME_DEFAULT; + + nsCOMPtr xulWindow; + if (NS_FAILED(appService->CreateTopLevelWindow(nullptr, uri, flags, 100, 100, nullptr, + getter_AddRefs(xulWindow)))) { + fail("Failed to create new window"); + return false; + } + + nsCOMPtr window = do_GetInterface(xulWindow); + if (!window) { + fail("Can't get dom window!"); + return false; + } + + nsCOMPtr target = do_QueryInterface(window); + if (!target) { + fail("Can't QI to nsIDOMEventTarget!"); + return false; + } + + nsCOMPtr listener = new EventListener(aAppShell); + if (NS_FAILED(target->AddEventListener(NS_LITERAL_STRING("keypress"), + listener, false, false)) || + NS_FAILED(target->AddEventListener(NS_LITERAL_STRING("load"), listener, + false, false))) { + fail("Can't add event listeners!"); + return false; + } + + return true; +#endif +} + +void +Test4(nsIAppShell* aAppShell) +{ + if (!Test4Internal(aAppShell)) { + nsCOMPtr runnable = new NextTestRunnable(aAppShell); + if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) { + fail("Failed to dispatch next test runnable"); + } + } +} + +const TestFunc gTests[] = { + Test1, Test2, Test3, Test4 +}; + +size_t gTestIndex = 0; + +NS_IMETHODIMP +NextTestRunnable::Run() +{ + if (gTestIndex > 0) { + passed("Finished test %u", gTestIndex); + } + + gStableStateEventHasRun = false; + + if (gTestIndex < ArrayLength(gTests)) { + gTests[gTestIndex++](mAppShell); + } + else { + nsCOMPtr exitRunnable = new ExitAppShellRunnable(mAppShell); + + nsresult rv = NS_DispatchToCurrentThread(exitRunnable); + if (NS_FAILED(rv)) { + fail("Failed to dispatch exit runnable!"); + } + } + + return NS_OK; +} + +int main(int argc, char** argv) +{ + ScopedLogging log; + ScopedXPCOM xpcom("TestAppShellSteadyState"); + + if (!xpcom.failed()) { + nsCOMPtr appShell = GetAppShell(); + if (!appShell) { + fail("Couldn't get appshell!"); + } else { + nsCOMPtr runnable = new NextTestRunnable(appShell); + if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) { + fail("Failed to dispatch next test runnable"); + } else if (NS_FAILED(appShell->Run())) { + fail("Failed to run appshell"); + } + } + } + + return gFailCount != 0; +} diff --git a/widget/tests/TestChromeMargin.cpp b/widget/tests/TestChromeMargin.cpp new file mode 100644 index 000000000..22330f467 --- /dev/null +++ b/widget/tests/TestChromeMargin.cpp @@ -0,0 +1,155 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* This tests the margin parsing functionality in nsAttrValue.cpp, which + * is accessible via nsContentUtils, and is used in setting chromemargins + * to widget windows. It's located here due to linking issues in the + * content directory. + */ + +/* This test no longer compiles now that we've removed nsIContentUtils (bug + * 647273). We need to be internal code in order to include nsContentUtils.h, + * but defining MOZILLA_INTERNAL_API is not enough to make us internal. + */ + +#include "TestHarness.h" + +#ifndef MOZILLA_INTERNAL_API +// some of the includes make use of internal string types +#define nsAString_h___ +#define nsString_h___ +#define nsStringFwd_h___ +#define nsReadableUtils_h___ +class nsACString; +class nsAString; +class nsAFlatString; +class nsAFlatCString; +class nsAdoptingString; +class nsAdoptingCString; +class nsXPIDLString; +template class nsReadingIterator; +#endif + +#include "nscore.h" +#include "nsContentUtils.h" + +#ifndef MOZILLA_INTERNAL_API +#undef nsString_h___ +#undef nsAString_h___ +#undef nsReadableUtils_h___ +#endif + +struct DATA { + bool shouldfail; + const char* margins; + int top; + int right; + int bottom; + int left; +}; + +const bool SHOULD_FAIL = true; +const int SHOULD_PASS = false; + +const DATA Data[] = { + { SHOULD_FAIL, "", 1, 2, 3, 4 }, + { SHOULD_FAIL, "1,0,0,0", 1, 2, 3, 4 }, + { SHOULD_FAIL, "1,2,0,0", 1, 2, 3, 4 }, + { SHOULD_FAIL, "1,2,3,0", 1, 2, 3, 4 }, + { SHOULD_FAIL, "4,3,2,1", 1, 2, 3, 4 }, + { SHOULD_FAIL, "azsasdasd", 0, 0, 0, 0 }, + { SHOULD_FAIL, ",azsasdasd", 0, 0, 0, 0 }, + { SHOULD_FAIL, " ", 1, 2, 3, 4 }, + { SHOULD_FAIL, "azsdfsdfsdfsdfsdfsasdasd,asdasdasdasdasdasd,asdadasdasd,asdasdasdasd", 0, 0, 0, 0 }, + { SHOULD_FAIL, "as,as,as,as", 0, 0, 0, 0 }, + { SHOULD_FAIL, "0,0,0", 0, 0, 0, 0 }, + { SHOULD_FAIL, "0,0", 0, 0, 0, 0 }, + { SHOULD_FAIL, "4.6,1,1,1", 0, 0, 0, 0 }, + { SHOULD_FAIL, ",,,,", 0, 0, 0, 0 }, + { SHOULD_FAIL, "1, , , ,", 0, 0, 0, 0 }, + { SHOULD_FAIL, "1, , ,", 0, 0, 0, 0 }, + { SHOULD_FAIL, "@!@%^&^*()", 1, 2, 3, 4 }, + { SHOULD_PASS, "4,3,2,1", 4, 3, 2, 1 }, + { SHOULD_PASS, "-4,-3,-2,-1", -4, -3, -2, -1 }, + { SHOULD_PASS, "10000,3,2,1", 10000, 3, 2, 1 }, + { SHOULD_PASS, "4 , 3 , 2 , 1", 4, 3, 2, 1 }, + { SHOULD_PASS, "4, 3 ,2,1", 4, 3, 2, 1 }, + { SHOULD_FAIL, "4,3,2,10000000000000 --", 4, 3, 2, 10000000000000 }, + { SHOULD_PASS, "4,3,2,1000", 4, 3, 2, 1000 }, + { SHOULD_PASS, "2147483647,3,2,1000", 2147483647, 3, 2, 1000 }, + { SHOULD_PASS, "2147483647,2147483647,2147483647,2147483647", 2147483647, 2147483647, 2147483647, 2147483647 }, + { SHOULD_PASS, "-2147483647,3,2,1000", -2147483647, 3, 2, 1000 }, + { SHOULD_FAIL, "2147483648,3,2,1000", 1, 3, 2, 1000 }, + { 0, nullptr, 0, 0, 0, 0 } +}; + +void DoAttrValueTest() +{ + int idx = -1; + bool didFail = false; + while (Data[++idx].margins) { + nsAutoString str; + str.AssignLiteral(Data[idx].margins); + nsIntMargin values(99,99,99,99); + bool result = nsContentUtils::ParseIntMarginValue(str, values); + + // if the parse fails + if (!result) { + if (Data[idx].shouldfail) + continue; + fail(Data[idx].margins); + didFail = true; + printf("*1\n"); + continue; + } + + if (Data[idx].shouldfail) { + if (Data[idx].top == values.top && + Data[idx].right == values.right && + Data[idx].bottom == values.bottom && + Data[idx].left == values.left) { + // not likely + fail(Data[idx].margins); + didFail = true; + printf("*2\n"); + continue; + } + // good failure, parse failed and that's what we expected. + continue; + } +#if 0 + printf("%d==%d %d==%d %d==%d %d==%d\n", + Data[idx].top, values.top, + Data[idx].right, values.right, + Data[idx].bottom, values.bottom, + Data[idx].left, values.left); +#endif + if (Data[idx].top == values.top && + Data[idx].right == values.right && + Data[idx].bottom == values.bottom && + Data[idx].left == values.left) { + // good parse results + continue; + } + else { + fail(Data[idx].margins); + didFail = true; + printf("*3\n"); + continue; + } + } + + if (!didFail) + passed("nsAttrValue margin parsing tests passed."); +} + +int main(int argc, char** argv) +{ + ScopedXPCOM xpcom(""); + if (xpcom.failed()) + return 1; + DoAttrValueTest(); + return 0; +} diff --git a/widget/tests/bug586713_window.xul b/widget/tests/bug586713_window.xul new file mode 100644 index 000000000..78397afad --- /dev/null +++ b/widget/tests/bug586713_window.xul @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + diff --git a/widget/tests/chrome.ini b/widget/tests/chrome.ini new file mode 100644 index 000000000..00d0d57a9 --- /dev/null +++ b/widget/tests/chrome.ini @@ -0,0 +1,100 @@ +[DEFAULT] +skip-if = os == 'android' +support-files = + empty_window.xul + utils.js + +[test_bug343416.xul] +skip-if = debug +[test_bug429954.xul] +support-files = window_bug429954.xul +[test_bug444800.xul] +subsuite = clipboard +[test_bug478536.xul] +skip-if = true # Bug 561929 +support-files = window_bug478536.xul +[test_bug517396.xul] +[test_bug538242.xul] +support-files = window_bug538242.xul +[test_bug593307.xul] +support-files = window_bug593307_offscreen.xul window_bug593307_centerscreen.xul +[test_bug1151186.html] +skip-if = os == 'linux' && debug #Bug 1176038 +[test_keycodes.xul] +[test_wheeltransaction.xul] +support-files = window_wheeltransaction.xul +[test_imestate.html] +support-files = window_imestate_iframes.html +[test_plugin_scroll_consistency.html] +[test_composition_text_querycontent.xul] +support-files = window_composition_text_querycontent.xul +[test_input_events_on_deactive_window.xul] +[test_position_on_resize.xul] +[test_sizemode_events.xul] +[test_taskbar_progress.xul] +skip-if = toolkit != "cocoa" && toolkit != "windows" +[test_bug760802.xul] +[test_clipboard.xul] +subsuite = clipboard +[test_panel_mouse_coords.xul] +skip-if = toolkit == "windows" # bug 1009955 + +# Cocoa +[test_native_menus.xul] +skip-if = toolkit != "cocoa" +support-files = native_menus_window.xul +[test_native_mouse_mac.xul] +skip-if = toolkit != "cocoa" || os_version == '10.10' # 10.10: bug 1137575 +support-files = native_mouse_mac_window.xul +[test_bug413277.html] +skip-if = toolkit != "cocoa" +[test_bug428405.xul] +skip-if = toolkit != "cocoa" +[test_bug466599.xul] +subsuite = clipboard +skip-if = toolkit != "cocoa" +[test_bug485118.xul] +skip-if = toolkit != "cocoa" +[test_bug522217.xul] +tags = fullscreen +skip-if = toolkit != "cocoa" +support-files = window_bug522217.xul +[test_platform_colors.xul] +#skip-if = toolkit != "cocoa" +skip-if = true # Bug 1207190 +[test_standalone_native_menu.xul] +skip-if = toolkit != "cocoa" +support-files = standalone_native_menu_window.xul +[test_bug586713.xul] +skip-if = toolkit != "cocoa" +support-files = bug586713_window.xul +[test_key_event_counts.xul] +skip-if = toolkit != "cocoa" +[test_bug596600.xul] +skip-if = toolkit != "cocoa" +[test_bug673301.xul] +subsuite = clipboard +skip-if = toolkit != "cocoa" +[test_secure_input.html] +skip-if = toolkit != "cocoa" +[test_native_key_bindings_mac.html] +skip-if = toolkit != "cocoa" +[test_system_status_bar.xul] +skip-if = toolkit != "cocoa" + +# Windows +# taskbar_previews.xul +# window_state_windows.xul +[test_chrome_context_menus_win.xul] +skip-if = toolkit != "windows" +support-files = chrome_context_menus_win.xul +[test_plugin_input_event.html] +skip-if = toolkit != "windows" +[test_mouse_scroll.xul] +skip-if = toolkit != "windows" +support-files = window_mouse_scroll_win.html + +# Privacy relevant +[test_bug1123480.xul] +subsuite = clipboard + diff --git a/widget/tests/chrome_context_menus_win.xul b/widget/tests/chrome_context_menus_win.xul new file mode 100644 index 000000000..9a4590747 --- /dev/null +++ b/widget/tests/chrome_context_menus_win.xul @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
diff --git a/widget/tests/empty_window.xul b/widget/tests/empty_window.xul new file mode 100644 index 000000000..f0e01761d --- /dev/null +++ b/widget/tests/empty_window.xul @@ -0,0 +1,4 @@ + + + diff --git a/widget/tests/mochitest.ini b/widget/tests/mochitest.ini new file mode 100644 index 000000000..bf7bfe689 --- /dev/null +++ b/widget/tests/mochitest.ini @@ -0,0 +1,12 @@ +[DEFAULT] +support-files = utils.js + +[test_assign_event_data.html] +subsuite = clipboard +skip-if = toolkit == "cocoa" # Mac: Bug 933303 +[test_bug565392.html] +subsuite = clipboard +skip-if = toolkit != "windows" || e10s # Bug 1267406 +[test_picker_no_crash.html] +skip-if = toolkit != "windows" || e10s # Bug 1267491 +support-files = window_picker_no_crash_child.html diff --git a/widget/tests/moz.build b/widget/tests/moz.build new file mode 100644 index 000000000..750202b48 --- /dev/null +++ b/widget/tests/moz.build @@ -0,0 +1,15 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini'] +MOCHITEST_MANIFESTS += ['mochitest.ini'] +MOCHITEST_CHROME_MANIFESTS += ['chrome.ini'] + +# if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': +# +# Test disabled because it requires the internal API. Re-enabling this test +# is bug 652123. +# CPP_UNIT_TESTS += ['TestChromeMargin'] diff --git a/widget/tests/native_menus_window.xul b/widget/tests/native_menus_window.xul new file mode 100644 index 000000000..6e614d017 --- /dev/null +++ b/widget/tests/native_menus_window.xul @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/widget/tests/native_mouse_mac_window.xul b/widget/tests/native_mouse_mac_window.xul new file mode 100644 index 000000000..8680c3b1a --- /dev/null +++ b/widget/tests/native_mouse_mac_window.xul @@ -0,0 +1,773 @@ + + + + + + + + + diff --git a/widget/tests/standalone_native_menu_window.xul b/widget/tests/standalone_native_menu_window.xul new file mode 100644 index 000000000..6783a66e6 --- /dev/null +++ b/widget/tests/standalone_native_menu_window.xul @@ -0,0 +1,334 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/widget/tests/taskbar_previews.xul b/widget/tests/taskbar_previews.xul new file mode 100644 index 000000000..2f294d187 --- /dev/null +++ b/widget/tests/taskbar_previews.xul @@ -0,0 +1,127 @@ + + + + + + Previews - yeah! + + + +

+ +

+  
+
+
diff --git a/widget/tests/test_assign_event_data.html b/widget/tests/test_assign_event_data.html new file mode 100644 index 000000000..39f31cafe --- /dev/null +++ b/widget/tests/test_assign_event_data.html @@ -0,0 +1,748 @@ + + + + Testing ns*Event::Assign*EventData() + + + + + + + +
+ + + hyper link + span +
+
form
+
 
+
+ +
+
+ + + diff --git a/widget/tests/test_bug1123480.xul b/widget/tests/test_bug1123480.xul new file mode 100644 index 000000000..56ce0ed10 --- /dev/null +++ b/widget/tests/test_bug1123480.xul @@ -0,0 +1,79 @@ + + + + + + nsTransferable PBM Overflow Selection Test + + + + + Mozilla Bug 1123480 + + diff --git a/widget/tests/test_bug1151186.html b/widget/tests/test_bug1151186.html new file mode 100644 index 000000000..391e53d78 --- /dev/null +++ b/widget/tests/test_bug1151186.html @@ -0,0 +1,43 @@ + + + + + + Test for Bug 1151186 + + + + + + +Mozilla Bug 1151186 +

+ +
+
+
+ + diff --git a/widget/tests/test_bug343416.xul b/widget/tests/test_bug343416.xul new file mode 100644 index 000000000..1c31bdf54 --- /dev/null +++ b/widget/tests/test_bug343416.xul @@ -0,0 +1,202 @@ + + + + + + + + + diff --git a/widget/tests/test_bug413277.html b/widget/tests/test_bug413277.html new file mode 100644 index 000000000..dfb1ac8d4 --- /dev/null +++ b/widget/tests/test_bug413277.html @@ -0,0 +1,36 @@ + + + + + Test for Bug 413277 + + + + +Mozilla Bug 413277 +

+ +
+
+
+ diff --git a/widget/tests/test_bug428405.xul b/widget/tests/test_bug428405.xul new file mode 100644 index 000000000..365480468 --- /dev/null +++ b/widget/tests/test_bug428405.xul @@ -0,0 +1,167 @@ + + + + + + + + + + +

+ +

+  
+
+
diff --git a/widget/tests/test_bug429954.xul b/widget/tests/test_bug429954.xul new file mode 100644 index 000000000..9b617ed4d --- /dev/null +++ b/widget/tests/test_bug429954.xul @@ -0,0 +1,44 @@ + + + + + + + + + diff --git a/widget/tests/test_bug444800.xul b/widget/tests/test_bug444800.xul new file mode 100644 index 000000000..14d572baa --- /dev/null +++ b/widget/tests/test_bug444800.xul @@ -0,0 +1,102 @@ + + + + + + + diff --git a/widget/tests/test_bug466599.xul b/widget/tests/test_bug466599.xul new file mode 100644 index 000000000..a70f47add --- /dev/null +++ b/widget/tests/test_bug466599.xul @@ -0,0 +1,109 @@ + + + + + + + diff --git a/widget/tests/test_bug478536.xul b/widget/tests/test_bug478536.xul new file mode 100644 index 000000000..e83ff6032 --- /dev/null +++ b/widget/tests/test_bug478536.xul @@ -0,0 +1,34 @@ + + + + + + + Test for Bug 478536 + + + diff --git a/widget/tests/test_bug485118.xul b/widget/tests/test_bug485118.xul new file mode 100644 index 000000000..bbd5daed9 --- /dev/null +++ b/widget/tests/test_bug485118.xul @@ -0,0 +1,71 @@ + + + + + + + + + diff --git a/widget/tests/test_bug517396.xul b/widget/tests/test_bug517396.xul new file mode 100644 index 000000000..18a1b8f59 --- /dev/null +++ b/widget/tests/test_bug517396.xul @@ -0,0 +1,56 @@ + + + + + + + + + diff --git a/widget/tests/test_bug522217.xul b/widget/tests/test_bug522217.xul new file mode 100644 index 000000000..22aa1a061 --- /dev/null +++ b/widget/tests/test_bug522217.xul @@ -0,0 +1,36 @@ + + + + + + + + + diff --git a/widget/tests/test_bug538242.xul b/widget/tests/test_bug538242.xul new file mode 100644 index 000000000..9ebab5259 --- /dev/null +++ b/widget/tests/test_bug538242.xul @@ -0,0 +1,55 @@ + + + + + + + + + diff --git a/widget/tests/test_bug565392.html b/widget/tests/test_bug565392.html new file mode 100644 index 000000000..da6999ec6 --- /dev/null +++ b/widget/tests/test_bug565392.html @@ -0,0 +1,70 @@ + + + + + Test for Bug 565392 + + + + +Mozilla Bug 565392 +

+ +
+
+
+ + diff --git a/widget/tests/test_bug586713.xul b/widget/tests/test_bug586713.xul new file mode 100644 index 000000000..e91eb7931 --- /dev/null +++ b/widget/tests/test_bug586713.xul @@ -0,0 +1,30 @@ + + + + + + + + diff --git a/widget/tests/test_bug593307.xul b/widget/tests/test_bug593307.xul new file mode 100644 index 000000000..0b6e4d4a1 --- /dev/null +++ b/widget/tests/test_bug593307.xul @@ -0,0 +1,46 @@ + + + + + + + + + diff --git a/widget/tests/test_bug596600.xul b/widget/tests/test_bug596600.xul new file mode 100644 index 000000000..0468f7d4d --- /dev/null +++ b/widget/tests/test_bug596600.xul @@ -0,0 +1,177 @@ + + + + + + + + diff --git a/widget/tests/test_bug673301.xul b/widget/tests/test_bug673301.xul new file mode 100644 index 000000000..a5736b86f --- /dev/null +++ b/widget/tests/test_bug673301.xul @@ -0,0 +1,40 @@ + + + + + + + + diff --git a/widget/tests/test_bug760802.xul b/widget/tests/test_bug760802.xul new file mode 100644 index 000000000..c79be785e --- /dev/null +++ b/widget/tests/test_bug760802.xul @@ -0,0 +1,91 @@ + + + + + + + diff --git a/widget/tests/test_chrome_context_menus_win.xul b/widget/tests/test_chrome_context_menus_win.xul new file mode 100644 index 000000000..575e7743d --- /dev/null +++ b/widget/tests/test_chrome_context_menus_win.xul @@ -0,0 +1,27 @@ + + + + + + + + + + + diff --git a/widget/tests/test_clipboard.xul b/widget/tests/test_clipboard.xul new file mode 100644 index 000000000..19a55714d --- /dev/null +++ b/widget/tests/test_clipboard.xul @@ -0,0 +1,80 @@ + + + + + + + diff --git a/widget/tests/test_composition_text_querycontent.xul b/widget/tests/test_composition_text_querycontent.xul new file mode 100644 index 000000000..e48a1b14a --- /dev/null +++ b/widget/tests/test_composition_text_querycontent.xul @@ -0,0 +1,34 @@ + + + + + + + diff --git a/widget/tests/test_imestate.html b/widget/tests/test_imestate.html new file mode 100644 index 000000000..fe5a3cce2 --- /dev/null +++ b/widget/tests/test_imestate.html @@ -0,0 +1,1529 @@ + + + Test for IME state controling + + + + + + + +
+ +
+
+
+
+
+
+
+
+
+
+
+ + +
+
+
+
+
+ + +
+
+
+
+
+
+ + + a[href]
+ + +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+ + +
+ + +
+ + +
+
+ +
+
+ + + + + diff --git a/widget/tests/test_input_events_on_deactive_window.xul b/widget/tests/test_input_events_on_deactive_window.xul new file mode 100644 index 000000000..a85646266 --- /dev/null +++ b/widget/tests/test_input_events_on_deactive_window.xul @@ -0,0 +1,236 @@ + + + + + + + diff --git a/widget/tests/test_key_event_counts.xul b/widget/tests/test_key_event_counts.xul new file mode 100644 index 000000000..4dd4b83da --- /dev/null +++ b/widget/tests/test_key_event_counts.xul @@ -0,0 +1,90 @@ + + + + + + + + + + + diff --git a/widget/tests/test_keycodes.xul b/widget/tests/test_keycodes.xul new file mode 100644 index 000000000..3ec460ecb --- /dev/null +++ b/widget/tests/test_keycodes.xul @@ -0,0 +1,4361 @@ + + + + + + + + diff --git a/widget/tests/test_mouse_scroll.xul b/widget/tests/test_mouse_scroll.xul new file mode 100644 index 000000000..570b304ea --- /dev/null +++ b/widget/tests/test_mouse_scroll.xul @@ -0,0 +1,28 @@ + + + + + + + diff --git a/widget/tests/test_native_key_bindings_mac.html b/widget/tests/test_native_key_bindings_mac.html new file mode 100644 index 000000000..dc3872f02 --- /dev/null +++ b/widget/tests/test_native_key_bindings_mac.html @@ -0,0 +1,343 @@ + + + + + Native Key Bindings for Cocoa Test + + + + + + +
+

Stretching attack nullam stuck in a tree zzz, suspendisse cras nec + suspendisse lick suscipit. Nunc egestas amet litter box, nullam climb the + curtains biting I don't like that food tristique biting sleep on your + keyboard non. Lay down in your way cras nec tempus chase the red dot cras + nec, pharetra pharetra eat the grass leap run orci turpis attack. + Consectetur sleep in the sink eat I don't like that food, knock over the + lamp catnip in viverra tail flick zzz meow etiam enim. Ac ac hiss shed + everywhere kittens rhoncus, attack your ankles zzz iaculis kittens. Nullam + pellentesque rip the couch iaculis rhoncus nibh, give me fish orci turpis + purr sleep on your face quis nunc bibendum.

+ +

Neque jump on the table bat iaculis, adipiscing sleep on your keyboard + jump vel justo shed everywhere suspendisse lick. Zzz enim faucibus + hairball faucibus, pharetra sunbathe biting bat leap rip the couch attack. + Tortor nibh in viverra quis hairball nam, vulputate adipiscing sleep on + your keyboard purr knock over the lamp orci turpis. Vestibulum I don't + like that food et chase the red dot, adipiscing neque bibendum rutrum + accumsan quis rhoncus claw. Leap accumsan vehicula enim biting sleep on + your face, pharetra nam accumsan egestas kittens sunbathe. Pharetra chase + the red dot sniff non eat the grass, vulputate fluffy fur aliquam puking + judging you.

+ +

Claw purr sollicitudin sollicitudin lay down in your way consectetur, + pellentesque vehicula zzz orci turpis consectetur. I don't like that food + rhoncus pellentesque sniff attack, rhoncus tortor attack your ankles + iaculis scratched hiss vel. Tortor zzz tortor nullam rip the couch rutrum, + bat enim ut leap hairball iaculis. Bibendum sunbathe elit suspendisse + nibh, puking adipiscing sleep on your face sleep on your face zzz catnip. + Judging you rutrum bat sunbathe sleep on your face, jump on the table leap + tincidunt a faucibus sleep in the sink. Stuck in a tree tristique zzz hiss + in viverra nullam, quis tortor pharetra attack.

+
+ + + + + + + + diff --git a/widget/tests/test_native_menus.xul b/widget/tests/test_native_menus.xul new file mode 100644 index 000000000..cf9bcc881 --- /dev/null +++ b/widget/tests/test_native_menus.xul @@ -0,0 +1,30 @@ + + + + + + + + diff --git a/widget/tests/test_native_mouse_mac.xul b/widget/tests/test_native_mouse_mac.xul new file mode 100644 index 000000000..5d86864b2 --- /dev/null +++ b/widget/tests/test_native_mouse_mac.xul @@ -0,0 +1,30 @@ + + + + + + + + diff --git a/widget/tests/test_panel_mouse_coords.xul b/widget/tests/test_panel_mouse_coords.xul new file mode 100644 index 000000000..41ef49044 --- /dev/null +++ b/widget/tests/test_panel_mouse_coords.xul @@ -0,0 +1,83 @@ + + + + + + + diff --git a/widget/tests/test_picker_no_crash.html b/widget/tests/test_picker_no_crash.html new file mode 100644 index 000000000..08ba1db12 --- /dev/null +++ b/widget/tests/test_picker_no_crash.html @@ -0,0 +1,36 @@ + + + + Test for crashes when the parent window of a file picker is closed via script + + + + + + + diff --git a/widget/tests/test_platform_colors.xul b/widget/tests/test_platform_colors.xul new file mode 100644 index 000000000..b30b9837f --- /dev/null +++ b/widget/tests/test_platform_colors.xul @@ -0,0 +1,107 @@ + + + + + + + + diff --git a/widget/tests/test_plugin_input_event.html b/widget/tests/test_plugin_input_event.html new file mode 100644 index 000000000..6ed2a14c4 --- /dev/null +++ b/widget/tests/test_plugin_input_event.html @@ -0,0 +1,74 @@ + + + + Test for plugin input event + + + + + + + + + +

+ +

+ +
+
+ + + + diff --git a/widget/tests/test_plugin_scroll_consistency.html b/widget/tests/test_plugin_scroll_consistency.html new file mode 100644 index 000000000..76d97f4ef --- /dev/null +++ b/widget/tests/test_plugin_scroll_consistency.html @@ -0,0 +1,61 @@ + + + Test for plugin child widgets not being messed up by scrolling + + + + + + + +

+

+ +
+
+

+ +
+
+ + + + + diff --git a/widget/tests/test_position_on_resize.xul b/widget/tests/test_position_on_resize.xul new file mode 100644 index 000000000..e1adfc2b4 --- /dev/null +++ b/widget/tests/test_position_on_resize.xul @@ -0,0 +1,94 @@ + + + + + + + + + +

+

+ +
+
+ + +
diff --git a/widget/tests/test_secure_input.html b/widget/tests/test_secure_input.html new file mode 100644 index 000000000..2c3ee38db --- /dev/null +++ b/widget/tests/test_secure_input.html @@ -0,0 +1,148 @@ + + + + Test for secure input mode + + + + + + + +
+
+ +

+
+
+
+
+
+
+

+
+ + + + diff --git a/widget/tests/test_sizemode_events.xul b/widget/tests/test_sizemode_events.xul new file mode 100644 index 000000000..e6ab940b2 --- /dev/null +++ b/widget/tests/test_sizemode_events.xul @@ -0,0 +1,105 @@ + + + + + + + + diff --git a/widget/tests/test_standalone_native_menu.xul b/widget/tests/test_standalone_native_menu.xul new file mode 100644 index 000000000..bac7a352e --- /dev/null +++ b/widget/tests/test_standalone_native_menu.xul @@ -0,0 +1,30 @@ + + + + + + + + diff --git a/widget/tests/test_system_status_bar.xul b/widget/tests/test_system_status_bar.xul new file mode 100644 index 000000000..784620fc8 --- /dev/null +++ b/widget/tests/test_system_status_bar.xul @@ -0,0 +1,57 @@ + + + + + + + diff --git a/widget/tests/test_taskbar_progress.xul b/widget/tests/test_taskbar_progress.xul new file mode 100644 index 000000000..e4ff533a0 --- /dev/null +++ b/widget/tests/test_taskbar_progress.xul @@ -0,0 +1,126 @@ + + + + + + + + +

+ +

+  
+
+
diff --git a/widget/tests/test_wheeltransaction.xul b/widget/tests/test_wheeltransaction.xul new file mode 100644 index 000000000..dadd46629 --- /dev/null +++ b/widget/tests/test_wheeltransaction.xul @@ -0,0 +1,28 @@ + + + + + + + diff --git a/widget/tests/unit/test_macwebapputils.js b/widget/tests/unit/test_macwebapputils.js new file mode 100644 index 000000000..0701bedf0 --- /dev/null +++ b/widget/tests/unit/test_macwebapputils.js @@ -0,0 +1,44 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//Basic tests to verify that MacWebAppUtils works + +var Ci = Components.interfaces; +var Cc = Components.classes; +var Cu = Components.utils; +var Cr = Components.results; + +Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); + +function test_find_app() +{ + var mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"]. + createInstance(Ci.nsIMacWebAppUtils); + let sig = "com.apple.TextEdit"; + + let path; + path = mwaUtils.pathForAppWithIdentifier(sig); + do_print("TextEdit path: " + path + "\n"); + do_check_neq(path, ""); +} + +function test_dont_find_fake_app() +{ + var mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"]. + createInstance(Ci.nsIMacWebAppUtils); + let sig = "calliope.penitentiary.dramamine"; + + let path; + path = mwaUtils.pathForAppWithIdentifier(sig); + do_check_eq(path, ""); +} + + +function run_test() +{ + test_find_app(); + test_dont_find_fake_app(); +} diff --git a/widget/tests/unit/test_taskbar_jumplistitems.js b/widget/tests/unit/test_taskbar_jumplistitems.js new file mode 100644 index 000000000..d145683eb --- /dev/null +++ b/widget/tests/unit/test_taskbar_jumplistitems.js @@ -0,0 +1,261 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// This tests taskbar jump list functionality available on win7 and up. + +var Cc = Components.classes; +var Ci = Components.interfaces; + +function test_basics() +{ + var item = Cc["@mozilla.org/windows-jumplistitem;1"]. + createInstance(Ci.nsIJumpListItem); + + var sep = Cc["@mozilla.org/windows-jumplistseparator;1"]. + createInstance(Ci.nsIJumpListSeparator); + + var shortcut = Cc["@mozilla.org/windows-jumplistshortcut;1"]. + createInstance(Ci.nsIJumpListShortcut); + + var link = Cc["@mozilla.org/windows-jumplistlink;1"]. + createInstance(Ci.nsIJumpListLink); + + do_check_false(item.equals(sep)); + do_check_false(item.equals(shortcut)); + do_check_false(item.equals(link)); + + do_check_false(sep.equals(item)); + do_check_false(sep.equals(shortcut)); + do_check_false(sep.equals(link)); + + do_check_false(shortcut.equals(item)); + do_check_false(shortcut.equals(sep)); + do_check_false(shortcut.equals(link)); + + do_check_false(link.equals(item)); + do_check_false(link.equals(sep)); + do_check_false(link.equals(shortcut)); + + do_check_true(item.equals(item)); + do_check_true(sep.equals(sep)); + do_check_true(link.equals(link)); + do_check_true(shortcut.equals(shortcut)); +} + +function test_separator() +{ + // separators: + + var item = Cc["@mozilla.org/windows-jumplistseparator;1"]. + createInstance(Ci.nsIJumpListSeparator); + + do_check_true(item.type == Ci.nsIJumpListItem.JUMPLIST_ITEM_SEPARATOR); +} + +function test_hashes() +{ + var link = Cc["@mozilla.org/windows-jumplistlink;1"] + .createInstance(Ci.nsIJumpListLink); + var uri1 = Cc["@mozilla.org/network/simple-uri;1"] + .createInstance(Ci.nsIURI); + var uri2 = Cc["@mozilla.org/network/simple-uri;1"] + .createInstance(Ci.nsIURI); + + uri1.spec = "http://www.123.com/"; + uri2.spec = "http://www.123.com/"; + + link.uri = uri1; + + do_check_true(link.compareHash(uri2)) + uri2.spec = "http://www.456.com/"; + do_check_false(link.compareHash(uri2)) + uri2.spec = "http://www.123.com/"; + do_check_true(link.compareHash(uri2)) + uri2.spec = "https://www.123.com/"; + do_check_false(link.compareHash(uri2)) + uri2.spec = "http://www.123.com/test/"; + do_check_false(link.compareHash(uri2)) + uri1.spec = "http://www.123.com/test/"; + uri2.spec = "http://www.123.com/test/"; + do_check_true(link.compareHash(uri2)) + uri1.spec = "https://www.123.com/test/"; + uri2.spec = "https://www.123.com/test/"; + do_check_true(link.compareHash(uri2)) + uri2.spec = "ftp://www.123.com/test/"; + do_check_false(link.compareHash(uri2)) + uri2.spec = "http://123.com/test/"; + do_check_false(link.compareHash(uri2)) + uri1.spec = "https://www.123.com/test/"; + uri2.spec = "https://www.123.com/Test/"; + do_check_false(link.compareHash(uri2)) + + uri1.spec = "http://www.123.com/"; + do_check_eq(link.uriHash, "QGLmWuwuTozr3tOfXSf5mg=="); + uri1.spec = "http://www.123.com/test/"; + do_check_eq(link.uriHash, "AG87Ls+GmaUYSUJFETRr3Q=="); + uri1.spec = "https://www.123.com/"; + do_check_eq(link.uriHash, "iSx6UH1a9enVPzUA9JZ42g=="); + + var uri3 = Cc["@mozilla.org/network/simple-uri;1"] + .createInstance(Ci.nsIURI); + link.uri = uri3; + do_check_eq(link.uriHash, "hTrpDwNRMkvXPqYV5kh1Fw=="); +} + +function test_links() +{ + // links: + var link1 = Cc["@mozilla.org/windows-jumplistlink;1"] + .createInstance(Ci.nsIJumpListLink); + var link2 = Cc["@mozilla.org/windows-jumplistlink;1"] + .createInstance(Ci.nsIJumpListLink); + + var uri1 = Cc["@mozilla.org/network/simple-uri;1"] + .createInstance(Ci.nsIURI); + var uri2 = Cc["@mozilla.org/network/simple-uri;1"] + .createInstance(Ci.nsIURI); + + uri1.spec = "http://www.test.com/"; + uri2.spec = "http://www.test.com/"; + + link1.uri = uri1; + link1.uriTitle = "Test"; + link2.uri = uri2; + link2.uriTitle = "Test"; + + do_check_true(link1.equals(link2)); + + link2.uriTitle = "Testing"; + + do_check_false(link1.equals(link2)); + + link2.uriTitle = "Test"; + uri2.spec = "http://www.testing.com/"; + + do_check_false(link1.equals(link2)); +} + +function test_shortcuts() +{ + // shortcuts: + var sc = Cc["@mozilla.org/windows-jumplistshortcut;1"] + .createInstance(Ci.nsIJumpListShortcut); + + var handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"] + .createInstance(Ci.nsILocalHandlerApp); + + handlerApp.name = "TestApp"; + handlerApp.detailedDescription = "TestApp detailed description."; + handlerApp.appendParameter("-test"); + + sc.iconIndex = 1; + do_check_eq(sc.iconIndex, 1); + + var faviconPageUri = Cc["@mozilla.org/network/simple-uri;1"] + .createInstance(Ci.nsIURI); + faviconPageUri.spec = "http://www.123.com/"; + sc.faviconPageUri = faviconPageUri; + do_check_eq(sc.faviconPageUri, faviconPageUri); + + var dirSvc = Cc["@mozilla.org/file/directory_service;1"]. + getService(Ci.nsIProperties). + QueryInterface(Ci.nsIDirectoryService); + var notepad = dirSvc.get("WinD", Ci.nsIFile); + notepad.append("notepad.exe"); + if (notepad.exists()) { + handlerApp.executable = notepad; + sc.app = handlerApp; + do_check_eq(sc.app.detailedDescription, "TestApp detailed description."); + do_check_eq(sc.app.name, "TestApp"); + do_check_true(sc.app.parameterExists("-test")); + do_check_false(sc.app.parameterExists("-notset")); + } +} + +function test_jumplist() +{ + // Jump lists can't register links unless the application is the default + // protocol handler for the protocol of the link, so we skip off testing + // those in these tests. We'll init the jump list for the xpc shell harness, + // add a task item, and commit it. + + // not compiled in + if (Ci.nsIWinTaskbar == null) + return; + + var taskbar = Cc["@mozilla.org/windows-taskbar;1"] + .getService(Ci.nsIWinTaskbar); + + var builder = taskbar.createJumpListBuilder(); + + do_check_neq(builder, null); + + // Win7 and up only + try { + var sysInfo = Cc["@mozilla.org/system-info;1"]. + getService(Ci.nsIPropertyBag2); + var ver = parseFloat(sysInfo.getProperty("version")); + if (ver < 6.1) { + do_check_false(builder.available, false); + return; + } + } catch (ex) { } + + do_check_true(taskbar.available); + + builder.deleteActiveList(); + + var items = Cc["@mozilla.org/array;1"] + .createInstance(Ci.nsIMutableArray); + + var sc = Cc["@mozilla.org/windows-jumplistshortcut;1"] + .createInstance(Ci.nsIJumpListShortcut); + + var handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"] + .createInstance(Ci.nsILocalHandlerApp); + + handlerApp.name = "Notepad"; + handlerApp.detailedDescription = "Testing detailed description."; + + var dirSvc = Cc["@mozilla.org/file/directory_service;1"]. + getService(Ci.nsIProperties). + QueryInterface(Ci.nsIDirectoryService); + var notepad = dirSvc.get("WinD", Ci.nsIFile); + notepad.append("notepad.exe"); + if (notepad.exists()) { + handlerApp.executable = notepad; + sc.app = handlerApp; + items.appendElement(sc, false); + + var removed = Cc["@mozilla.org/array;1"] + .createInstance(Ci.nsIMutableArray); + do_check_true(builder.initListBuild(removed)); + do_check_true(builder.addListToBuild(builder.JUMPLIST_CATEGORY_TASKS, items)); + do_check_true(builder.addListToBuild(builder.JUMPLIST_CATEGORY_RECENT)); + do_check_true(builder.addListToBuild(builder.JUMPLIST_CATEGORY_FREQUENT)); + do_check_true(builder.commitListBuild()); + + builder.deleteActiveList(); + + do_check_true(builder.initListBuild(removed)); + do_check_true(builder.addListToBuild(builder.JUMPLIST_CATEGORY_CUSTOM, items, "Custom List")); + do_check_true(builder.commitListBuild()); + + builder.deleteActiveList(); + } +} + +function run_test() +{ + if (mozinfo.os != "win") { + return; + } + test_basics(); + test_separator(); + test_hashes(); + test_links(); + test_shortcuts(); + test_jumplist(); +} diff --git a/widget/tests/unit/xpcshell.ini b/widget/tests/unit/xpcshell.ini new file mode 100644 index 000000000..d0e8f8701 --- /dev/null +++ b/widget/tests/unit/xpcshell.ini @@ -0,0 +1,7 @@ +[DEFAULT] +head = +tail = + +[test_taskbar_jumplistitems.js] +[test_macwebapputils.js] +skip-if = os != "mac" diff --git a/widget/tests/utils.js b/widget/tests/utils.js new file mode 100644 index 000000000..3796c7d2b --- /dev/null +++ b/widget/tests/utils.js @@ -0,0 +1,27 @@ + +function getTestPlugin(pluginName) { + var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"] + .getService(SpecialPowers.Ci.nsIPluginHost); + var tags = ph.getPluginTags(); + var name = pluginName || "Test Plug-in"; + for (var tag of tags) { + if (tag.name == name) { + return tag; + } + } + + ok(false, "Could not find plugin tag with plugin name '" + name + "'"); + return null; +} + +// call this to set the test plugin(s) initially expected enabled state. +// it will automatically be reset to it's previous value after the test +// ends +function setTestPluginEnabledState(newEnabledState, pluginName) { + var plugin = getTestPlugin(pluginName); + var oldEnabledState = plugin.enabledState; + plugin.enabledState = newEnabledState; + SimpleTest.registerCleanupFunction(function() { + getTestPlugin(pluginName).enabledState = oldEnabledState; + }); +} diff --git a/widget/tests/window_bug429954.xul b/widget/tests/window_bug429954.xul new file mode 100644 index 000000000..6604e91b4 --- /dev/null +++ b/widget/tests/window_bug429954.xul @@ -0,0 +1,45 @@ + + + + + + + diff --git a/widget/tests/window_bug478536.xul b/widget/tests/window_bug478536.xul new file mode 100644 index 000000000..0a07777b4 --- /dev/null +++ b/widget/tests/window_bug478536.xul @@ -0,0 +1,215 @@ + + + + + + + diff --git a/widget/tests/window_bug522217.xul b/widget/tests/window_bug522217.xul new file mode 100644 index 000000000..8fbb21037 --- /dev/null +++ b/widget/tests/window_bug522217.xul @@ -0,0 +1,72 @@ + + + + + + + diff --git a/widget/tests/window_bug538242.xul b/widget/tests/window_bug538242.xul new file mode 100644 index 000000000..fb878b138 --- /dev/null +++ b/widget/tests/window_bug538242.xul @@ -0,0 +1,3 @@ + + diff --git a/widget/tests/window_bug593307_centerscreen.xul b/widget/tests/window_bug593307_centerscreen.xul new file mode 100644 index 000000000..24d708760 --- /dev/null +++ b/widget/tests/window_bug593307_centerscreen.xul @@ -0,0 +1,27 @@ + + + + + + + diff --git a/widget/tests/window_bug593307_offscreen.xul b/widget/tests/window_bug593307_offscreen.xul new file mode 100644 index 000000000..0857c73a6 --- /dev/null +++ b/widget/tests/window_bug593307_offscreen.xul @@ -0,0 +1,34 @@ + + + + + + + diff --git a/widget/tests/window_composition_text_querycontent.xul b/widget/tests/window_composition_text_querycontent.xul new file mode 100644 index 000000000..a5b9e2655 --- /dev/null +++ b/widget/tests/window_composition_text_querycontent.xul @@ -0,0 +1,6992 @@ + + + + + + + + diff --git a/widget/tests/window_imestate_iframes.html b/widget/tests/window_imestate_iframes.html new file mode 100644 index 000000000..064cf19a5 --- /dev/null +++ b/widget/tests/window_imestate_iframes.html @@ -0,0 +1,380 @@ + + + Test for IME state controling and focus moving for iframes + + + + + +

+ +
+
+ + +
+
+
+
+ +
+

+ + + + diff --git a/widget/tests/window_mouse_scroll_win.html b/widget/tests/window_mouse_scroll_win.html new file mode 100644 index 000000000..4a83e23ef --- /dev/null +++ b/widget/tests/window_mouse_scroll_win.html @@ -0,0 +1,1531 @@ + + + Test for mouse scroll handling on Windows + + + + + +
+

1st <p>.

+

2nd <p>.

+
+ + + + diff --git a/widget/tests/window_picker_no_crash_child.html b/widget/tests/window_picker_no_crash_child.html new file mode 100644 index 000000000..51bf1b1e6 --- /dev/null +++ b/widget/tests/window_picker_no_crash_child.html @@ -0,0 +1,10 @@ + + + Picker window + + +
+ +
+ + diff --git a/widget/tests/window_state_windows.xul b/widget/tests/window_state_windows.xul new file mode 100644 index 000000000..9643e1dad --- /dev/null +++ b/widget/tests/window_state_windows.xul @@ -0,0 +1,87 @@ + + + + + + + + + + + +

+ +

+  
+
diff --git a/widget/tests/window_wheeltransaction.xul b/widget/tests/window_wheeltransaction.xul new file mode 100644 index 000000000..8573eb3a4 --- /dev/null +++ b/widget/tests/window_wheeltransaction.xul @@ -0,0 +1,1560 @@ + + + + + + + -- cgit v1.2.3