mobile/android/tests/background/junit3/src/sync/helpers/DefaultDelegate.java

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 package org.mozilla.gecko.background.sync.helpers;
     6 import java.util.concurrent.ExecutorService;
     8 import junit.framework.AssertionFailedError;
    10 import org.mozilla.gecko.background.testhelpers.WaitHelper;
    12 public abstract class DefaultDelegate {
    13   protected ExecutorService executor;
    15   protected final WaitHelper waitHelper;
    17   public DefaultDelegate() {
    18     waitHelper = WaitHelper.getTestWaiter();
    19   }
    21   public DefaultDelegate(WaitHelper waitHelper) {
    22     this.waitHelper = waitHelper;
    23   }
    25   protected WaitHelper getTestWaiter() {
    26     return waitHelper;
    27   }
    29   public void performWait(Runnable runnable) throws AssertionFailedError {
    30     getTestWaiter().performWait(runnable);
    31   }
    33   public void performNotify() {
    34     getTestWaiter().performNotify();
    35   }
    37   public void performNotify(Throwable e) {
    38     getTestWaiter().performNotify(e);
    39   }
    41   public void performNotify(String reason, Throwable e) {
    42     String message = reason;
    43     if (e != null) {
    44       message += ": " + e.getMessage();
    45     }
    46     AssertionFailedError ex = new AssertionFailedError(message);
    47     if (e != null) {
    48       ex.initCause(e);
    49     }
    50     getTestWaiter().performNotify(ex);
    51   }
    52 }

mercurial