com.android.repository.testframework
Class FakeProgressIndicator

java.lang.Object
  extended by com.android.repository.testframework.FakeProgressIndicator
All Implemented Interfaces:
ProgressIndicator

public class FakeProgressIndicator
extends java.lang.Object
implements ProgressIndicator

Fake ProgressIndicator that keeps track of the messages that were logged to it, and provides a convenient method for asserting that no errors or warnings occurred.


Constructor Summary
FakeProgressIndicator()
           
 
Method Summary
 void assertNoErrors()
          assert that no errors have been logged.
 void assertNoErrorsOrWarnings()
          assert that no errors or warnings have been logged.
 void cancel()
          Try to cancel this operation.
 java.util.List<java.lang.String> getErrors()
           
 double getFraction()
           
 java.util.List<java.lang.String> getInfos()
           
 java.util.List<java.lang.String> getWarnings()
           
 boolean isCanceled()
           
 boolean isCancellable()
           
 boolean isIndeterminate()
           
 void logError(java.lang.String s)
          Logs an error.
 void logError(java.lang.String s, java.lang.Throwable e)
          Logs an error, including a stacktrace.
 void logInfo(java.lang.String s)
          Logs an info message.
 void logWarning(java.lang.String s)
          Logs a warning.
 void logWarning(java.lang.String s, java.lang.Throwable e)
          Logs a warning, including a stacktrace.
 void setCancellable(boolean cancellable)
          Sets whether the user should be able to cancel this operation.
 void setFraction(double v)
          Sets how much progress should be shown on the progress bar, between 0 and 1.
 void setIndeterminate(boolean indeterminate)
          Sets whether this progress indicator should show indeterminate progress.
 void setSecondaryText(java.lang.String s)
          Sets the secondary text on the progress indicator.
 void setText(java.lang.String s)
          Sets the main text shown in the progress indicator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FakeProgressIndicator

public FakeProgressIndicator()
Method Detail

setText

public void setText(java.lang.String s)
Description copied from interface: ProgressIndicator
Sets the main text shown in the progress indicator.

Specified by:
setText in interface ProgressIndicator

isCanceled

public boolean isCanceled()
Specified by:
isCanceled in interface ProgressIndicator
Returns:
True if the user has canceled this operation.

cancel

public void cancel()
Description copied from interface: ProgressIndicator
Try to cancel this operation.

Specified by:
cancel in interface ProgressIndicator

setCancellable

public void setCancellable(boolean cancellable)
Description copied from interface: ProgressIndicator
Sets whether the user should be able to cancel this operation.

Specified by:
setCancellable in interface ProgressIndicator

isCancellable

public boolean isCancellable()
Specified by:
isCancellable in interface ProgressIndicator
Returns:
true if the user should be able to cancel this operation.

setFraction

public void setFraction(double v)
Description copied from interface: ProgressIndicator
Sets how much progress should be shown on the progress bar, between 0 and 1.

Specified by:
setFraction in interface ProgressIndicator

getFraction

public double getFraction()
Specified by:
getFraction in interface ProgressIndicator
Returns:
The current amount of progress shown on the progress bar, between 0 and 1.

setSecondaryText

public void setSecondaryText(java.lang.String s)
Description copied from interface: ProgressIndicator
Sets the secondary text on the progress indicator.

Specified by:
setSecondaryText in interface ProgressIndicator

logWarning

public void logWarning(@NonNull
                       java.lang.String s)
Description copied from interface: ProgressIndicator
Logs a warning.

Specified by:
logWarning in interface ProgressIndicator

logWarning

public void logWarning(@NonNull
                       java.lang.String s,
                       java.lang.Throwable e)
Description copied from interface: ProgressIndicator
Logs a warning, including a stacktrace.

Specified by:
logWarning in interface ProgressIndicator

logError

public void logError(@NonNull
                     java.lang.String s)
Description copied from interface: ProgressIndicator
Logs an error.

Specified by:
logError in interface ProgressIndicator

logError

public void logError(@NonNull
                     java.lang.String s,
                     java.lang.Throwable e)
Description copied from interface: ProgressIndicator
Logs an error, including a stacktrace.

Specified by:
logError in interface ProgressIndicator

logInfo

public void logInfo(@NonNull
                    java.lang.String s)
Description copied from interface: ProgressIndicator
Logs an info message.

Specified by:
logInfo in interface ProgressIndicator

isIndeterminate

public boolean isIndeterminate()
Specified by:
isIndeterminate in interface ProgressIndicator
Returns:
true if this progress indicator is set to show indeterminate progress.

setIndeterminate

public void setIndeterminate(boolean indeterminate)
Description copied from interface: ProgressIndicator
Sets whether this progress indicator should show indeterminate progress.

Specified by:
setIndeterminate in interface ProgressIndicator

getInfos

public java.util.List<java.lang.String> getInfos()

getWarnings

public java.util.List<java.lang.String> getWarnings()

getErrors

public java.util.List<java.lang.String> getErrors()

assertNoErrorsOrWarnings

public void assertNoErrorsOrWarnings()
assert that no errors or warnings have been logged.


assertNoErrors

public void assertNoErrors()
assert that no errors have been logged.