Allow skipping a test case in development mode or production mode.

http://gwt-code-reviews.appspot.com/171801
Review by: amitmanjhi


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7708 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/junit/JUnitShell.java b/user/src/com/google/gwt/junit/JUnitShell.java
index 53292ad..7babf18 100644
--- a/user/src/com/google/gwt/junit/JUnitShell.java
+++ b/user/src/com/google/gwt/junit/JUnitShell.java
@@ -1116,9 +1116,23 @@
   private boolean mustNotExecuteTest(Set<Platform> bannedPlatforms) {
     // TODO (amitmanjhi): Remove this hard-coding. A RunStyle somehow needs to
     // specify how it interacts with the platforms.
-    return runStyle instanceof RunStyleHtmlUnit
-        && (bannedPlatforms.contains(Platform.HtmlUnitBug) 
-            || bannedPlatforms.contains(Platform.HtmlUnit));
+    if (runStyle instanceof RunStyleHtmlUnit
+        && (bannedPlatforms.contains(Platform.HtmlUnitBug) || bannedPlatforms.contains(Platform.HtmlUnit))) {
+      return true;
+    }
+
+    if (developmentMode) {
+      if (bannedPlatforms.contains(Platform.Devel)) {
+        return true;
+      }
+    } else {
+      // Prod mode
+      if (bannedPlatforms.contains(Platform.Prod)) {
+        return true;
+      }
+    }
+
+    return false;
   }
 
   private boolean mustRetry(int numTries) {
diff --git a/user/src/com/google/gwt/junit/Platform.java b/user/src/com/google/gwt/junit/Platform.java
index 1d53155..f4fe228 100644
--- a/user/src/com/google/gwt/junit/Platform.java
+++ b/user/src/com/google/gwt/junit/Platform.java
@@ -22,6 +22,8 @@
  * between HtmlUnit and non-HtmlUnit platforms.
  */
 public enum Platform {
+  Devel,
   HtmlUnitBug,
-  HtmlUnit
+  HtmlUnit,
+  Prod,
 }
diff --git a/user/test/com/google/gwt/junit/client/GWTTestCaseTest.java b/user/test/com/google/gwt/junit/client/GWTTestCaseTest.java
index 56b94b7..00e04f1 100644
--- a/user/test/com/google/gwt/junit/client/GWTTestCaseTest.java
+++ b/user/test/com/google/gwt/junit/client/GWTTestCaseTest.java
@@ -24,6 +24,7 @@
 import static com.google.gwt.junit.client.GWTTestCaseTest.SetUpTearDownState.IS_SETUP;
 import static com.google.gwt.junit.client.GWTTestCaseTest.SetUpTearDownState.IS_TORNDOWN;
 
+import com.google.gwt.core.client.GWT;
 import com.google.gwt.junit.DoNotRunWith;
 import com.google.gwt.junit.Platform;
 import com.google.gwt.user.client.Timer;
@@ -366,7 +367,7 @@
     fail("Unexpected exception during assertTrue(String, boolean) testing");
   }
 
-  /*
+  /**
    * Just setting the htmlunit mode.
    */
   @DoNotRunWith(Platform.HtmlUnitBug)
@@ -374,6 +375,22 @@
     htmlunitMode = false;
   }
 
+  /**
+   * Test skipping a test for dev mode.
+   */
+  @DoNotRunWith(Platform.Devel)
+  public void testPlatformDevel() {
+    assertTrue("Should not run in devel mode", GWT.isScript());
+  }
+
+  /**
+   * Test skipping a test for prod mode.
+   */
+  @DoNotRunWith(Platform.Prod)
+  public void testPlatformProd() {
+    assertTrue("Should not run in prod mode", !GWT.isScript());
+  }
+
   /*
    * This test MUST appear after testSetRetry().
    */