Revision: 7708
Author: [email protected]
Date: Thu Mar 11 10:58:55 2010
Log: Allow skipping a test case in development mode or production mode.

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

http://code.google.com/p/google-web-toolkit/source/detail?r=7708

Modified:
 /trunk/user/src/com/google/gwt/junit/JUnitShell.java
 /trunk/user/src/com/google/gwt/junit/Platform.java
 /trunk/user/test/com/google/gwt/junit/client/GWTTestCaseTest.java

=======================================
--- /trunk/user/src/com/google/gwt/junit/JUnitShell.java Wed Mar 3 07:09:08 2010 +++ /trunk/user/src/com/google/gwt/junit/JUnitShell.java Thu Mar 11 10:58:55 2010
@@ -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) {
=======================================
--- /trunk/user/src/com/google/gwt/junit/Platform.java Thu Feb 25 06:57:14 2010 +++ /trunk/user/src/com/google/gwt/junit/Platform.java Thu Mar 11 10:58:55 2010
@@ -22,6 +22,8 @@
  * between HtmlUnit and non-HtmlUnit platforms.
  */
 public enum Platform {
+  Devel,
   HtmlUnitBug,
-  HtmlUnit
-}
+  HtmlUnit,
+  Prod,
+}
=======================================
--- /trunk/user/test/com/google/gwt/junit/client/GWTTestCaseTest.java Thu Feb 25 06:57:14 2010 +++ /trunk/user/test/com/google/gwt/junit/client/GWTTestCaseTest.java Thu Mar 11 10:58:55 2010
@@ -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,13 +367,29 @@
fail("Unexpected exception during assertTrue(String, boolean) testing");
   }

-  /*
+  /**
    * Just setting the htmlunit mode.
    */
   @DoNotRunWith(Platform.HtmlUnitBug)
   public void testSetRetry() {
     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().

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to