Bug 619623 - Disable Idle Service to check if it's related with the intermittent failure.

r=sdwilsh
This commit is contained in:
Marco Bonardo 2011-04-29 18:12:23 +02:00
parent da3f9ff9ee
commit 8896556561

View File

@ -37,6 +37,9 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsWidgetsCID.h"
#include "nsIComponentRegistrar.h"
#ifndef TEST_NAME
#error "Must #define TEST_NAME before including places_test_harness_tail.h"
#endif
@ -92,12 +95,31 @@ do_test_finished()
gPendingTests--;
}
void
disable_idle_service()
{
(void)fprintf(stderr, TEST_INFO_STR "Disabling Idle Service.\n", TEST_FILE);
static NS_DEFINE_IID(kIdleCID, NS_IDLE_SERVICE_CID);
nsresult rv;
nsCOMPtr<nsIFactory> idleFactory = do_GetClassObject(kIdleCID, &rv);
do_check_success(rv);
nsCOMPtr<nsIComponentRegistrar> registrar;
rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
do_check_success(rv);
rv = registrar->UnregisterFactory(kIdleCID, idleFactory);
do_check_success(rv);
}
int
main(int aArgc,
char** aArgv)
{
ScopedXPCOM xpcom(TEST_NAME);
// Tinderboxes are constantly on idle. Since idle tasks can interact with
// tests, causing random failures, disable the idle service.
disable_idle_service();
do_test_pending();
run_next_test();