Add a webApiUsage property to control whether prefixed API's will be used.

This is a simple implementation that doesn't include browser or
feature-specific settings.

Change-Id: I416794f99bafa78a9a0ef84ef698d372c8263613
Review-Link: https://gwt-review.googlesource.com/#/c/1840/

Review by: goktug@google.com

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@11495 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/animation/Animation.gwt.xml b/user/src/com/google/gwt/animation/Animation.gwt.xml
index bc2a47c..8fd4427 100644
--- a/user/src/com/google/gwt/animation/Animation.gwt.xml
+++ b/user/src/com/google/gwt/animation/Animation.gwt.xml
@@ -32,11 +32,13 @@
   <replace-with class="com.google.gwt.animation.client.AnimationSchedulerImplMozilla">
     <when-type-is class="com.google.gwt.animation.client.AnimationScheduler"/>
     <when-property-is name="user.agent" value="gecko1_8"/>
+    <when-property-is name="webApiUsage" value="modern"/>
   </replace-with>
 
   <!-- Implementation based on webkitRequestAnimationFrame -->
   <replace-with class="com.google.gwt.animation.client.AnimationSchedulerImplWebkit">
     <when-type-is class="com.google.gwt.animation.client.AnimationScheduler"/>
     <when-property-is name="user.agent" value="safari"/>
+    <when-property-is name="webApiUsage" value="modern"/>
   </replace-with>
 </module>
diff --git a/user/src/com/google/gwt/useragent/UserAgent.gwt.xml b/user/src/com/google/gwt/useragent/UserAgent.gwt.xml
index 16a65ec..3039a35 100644
--- a/user/src/com/google/gwt/useragent/UserAgent.gwt.xml
+++ b/user/src/com/google/gwt/useragent/UserAgent.gwt.xml
@@ -33,6 +33,15 @@
     is-multi-valued="false" />
   <set-configuration-property name="user.agent.runtimeWarning" value="true"/>
 
+  <!--
+    If set to "modern", GWT widgets will sometimes attempt to use new web API's that
+    aren't yet standardized (such as prefixed API's). The "stable" setting turns this off.
+    If recompiling and redeploying your GWT app when someone reports a browser bug would be
+    a problem, you should choose "stable".
+  -->
+  <define-property name="webApiUsage" values="stable,modern"/>
+  <set-property name="webApiUsage" value="modern"/>
+
   <!-- Asserts that the compile time user.agent value matches the runtime -->
   <!-- user.agent value -->
   <entry-point class="com.google.gwt.useragent.client.UserAgentAsserter" />
diff --git a/user/test/com/google/gwt/animation/AnimationApiUsage.gwt.xml b/user/test/com/google/gwt/animation/AnimationApiUsage.gwt.xml
new file mode 100644
index 0000000..b8afd4c
--- /dev/null
+++ b/user/test/com/google/gwt/animation/AnimationApiUsage.gwt.xml
@@ -0,0 +1,19 @@
+<!--                                                                        -->
+<!-- Copyright 2013 Google Inc.                                             -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
+<!-- may not use this file except in compliance with the License. You may   -->
+<!-- may obtain a copy of the License at                                    -->
+<!--                                                                        -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
+<!--                                                                        -->
+<!-- Unless required by applicable law or agreed to in writing, software    -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
+<!-- implied. License for the specific language governing permissions and   -->
+<!-- limitations under the License.                                         -->
+
+<!-- Module used to test Animation API usage.                               -->
+<module>
+  <inherits name="com.google.gwt.animation.Animation"/>
+  <set-property name="webApiUsage" value="stable"/>
+</module>
\ No newline at end of file
diff --git a/user/test/com/google/gwt/animation/AnimationSuite.java b/user/test/com/google/gwt/animation/AnimationSuite.java
index ef8551f..8302101 100644
--- a/user/test/com/google/gwt/animation/AnimationSuite.java
+++ b/user/test/com/google/gwt/animation/AnimationSuite.java
@@ -15,6 +15,7 @@
  */
 package com.google.gwt.animation;
 
+import com.google.gwt.animation.client.AnimationApiUsageTest;
 import com.google.gwt.animation.client.AnimationSchedulerImplTimerTest;
 import com.google.gwt.animation.client.AnimationTest;
 
@@ -28,6 +29,7 @@
   public static Test suite() {
     TestSuite suite = new TestSuite("Tests of the animation package");
 
+    suite.addTestSuite(AnimationApiUsageTest.class);
     suite.addTestSuite(AnimationSchedulerImplTimerTest.class);
     suite.addTestSuite(AnimationTest.class);
 
diff --git a/user/test/com/google/gwt/animation/client/AnimationApiUsageTest.java b/user/test/com/google/gwt/animation/client/AnimationApiUsageTest.java
new file mode 100644
index 0000000..27a6c64
--- /dev/null
+++ b/user/test/com/google/gwt/animation/client/AnimationApiUsageTest.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.animation.client;
+
+import com.google.gwt.junit.client.GWTTestCase;
+
+/**
+ * Verifies that we always use timers in 'resistance' mode.
+ */
+public class AnimationApiUsageTest extends GWTTestCase {
+  @Override
+  public String getModuleName() {
+    return "com.google.gwt.animation.AnimationApiUsage";
+  }
+
+  public void testAnimationSchedulerUsesTimer() {
+    AnimationScheduler scheduler = AnimationScheduler.get();
+    assertEquals("Expected timer implementation but got: " + scheduler.getClass().getName(),
+        AnimationSchedulerImplTimer.class, scheduler.getClass());
+  }
+}