Revision: 6862
Author: [email protected]
Date: Wed Nov 11 20:06:00 2009
Log: Cherrypick r6851, due to Qmfe's inliner error
http://code.google.com/p/google-web-toolkit/source/detail?r=6862

Added:
   
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/core/client/impl/SchedulerImplTest.java
Modified:
  /branches/snapshot-2009.10.23-r6446
  /branches/snapshot-2009.10.23-r6446/branch-info.txt
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/core/ext/ServletContainer.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/core/ext/ServletContainerLauncher.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/BootStrapPlatform.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/DevMode.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/DevModeBase.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/DevelModeTabKey.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/Disconnectable.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/GWTShell.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/ModulePanel.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/ModuleTabPanel.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/SessionModule.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/WebServerPanel.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/BrowserChannel.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/BrowserChannelClient.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/BrowserChannelException.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/BrowserChannelServer.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/BrowserListener.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/CloseButton.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/HostedModePluginObject.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/HtmlUnitSessionHandler.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/Icons.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/JavaObject.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/JsValue.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/JsValueGlue.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/JsValueOOPHM.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/Jsni.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/MethodDispatch.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/ModuleSpaceOOPHM.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/OophmSessionHandler.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/RemoteObjectTable.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/ServerMethods.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/ServerObjectsTable.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/SessionData.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/ShellMainWindow.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/close.png
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/ie
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/log/SwingLoggerPanel.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/log/SwingTreeLogger.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/log/icon-close.png
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/rewrite/RewriteSingleJsoImplDispatches.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/util/BrowserInfo.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerDisableAggressiveOptimization.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerEnableAssertions.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerOutDir.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerWorkDirOptional.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerWorkDirRequired.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/test/com/google/gwt/dev/AboutTest.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/test/com/google/gwt/dev/DevelModeTabKeyTest.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/test/com/google/gwt/dev/SessionModuleTest.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/test/com/google/gwt/dev/shell/BrowserChannelTest.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/test/com/google/gwt/dev/shell/RemoteObjectTableTest.java
   
/branches/snapshot-2009.10.23-r6446/dev/core/test/com/google/gwt/dev/util/TemporaryBufferStream.java
  /branches/snapshot-2009.10.23-r6446/distro-source/mac/src/webAppCreator
  /branches/snapshot-2009.10.23-r6446/distro-source/src/benchmarkViewer
  /branches/snapshot-2009.10.23-r6446/distro-source/src/benchmarkViewer.cmd
  /branches/snapshot-2009.10.23-r6446/distro-source/src/i18nCreator
  /branches/snapshot-2009.10.23-r6446/distro-source/src/i18nCreator.cmd
  /branches/snapshot-2009.10.23-r6446/distro-source/src/junitCreator
  /branches/snapshot-2009.10.23-r6446/distro-source/src/junitCreator.cmd
  /branches/snapshot-2009.10.23-r6446/distro-source/src/webAppCreator
  /branches/snapshot-2009.10.23-r6446/distro-source/src/webAppCreator.cmd
  /branches/snapshot-2009.10.23-r6446/eclipse/samples/Hello/Hello-gwtc.launch
  /branches/snapshot-2009.10.23-r6446/jni
   
/branches/snapshot-2009.10.23-r6446/plugins/ie/prebuilt/GwtDevModeIePluginInstaller.msi
  /branches/snapshot-2009.10.23-r6446/samples/dynatable/war/DynaTable.css
  /branches/snapshot-2009.10.23-r6446/samples/dynatable/war/DynaTable.html
  /branches/snapshot-2009.10.23-r6446/samples/hello/war/Hello.html
  /branches/snapshot-2009.10.23-r6446/samples/json/war/JSON.css
  /branches/snapshot-2009.10.23-r6446/samples/json/war/JSON.html
  /branches/snapshot-2009.10.23-r6446/samples/mail/war/Mail.html
  /branches/snapshot-2009.10.23-r6446/samples/showcase/war/Showcase.html
  /branches/snapshot-2009.10.23-r6446/samples/simplerpc/war/SimpleRPC.css
  /branches/snapshot-2009.10.23-r6446/samples/simplerpc/war/SimpleRPC.html
  /branches/snapshot-2009.10.23-r6446/samples/simplexml/war/SimpleXML.css
  /branches/snapshot-2009.10.23-r6446/samples/simplexml/war/SimpleXML.html
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/core/client/HttpThrowableReporter.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/core/client/JsonUtils.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/core/client/Scheduler.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/core/client/impl/Impl.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/core/client/impl/SchedulerImpl.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/event/dom/client/HandlesAllFocusEvents.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/event/dom/client/HandlesAllKeyEvents.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/event/dom/client/HandlesAllMouseEvents.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/event/dom/client/KeyCodes.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/event/dom/client/PrivateMap.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/event/logical/shared/HasValueChangeHandlers.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/event/logical/shared/ValueChangeEvent.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/event/logical/shared/ValueChangeHandler.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/event/shared/DefaultHandlerRegistration.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/event/shared/GwtEvent.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/event/shared/HandlerRegistration.java
  /branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/resources
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/resources/client/ClientBundle.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/resources/ext/ClientBundleFields.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/resources/ext/ClientBundleRequirements.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/resources/rebind/context/AbstractClientBundleGenerator.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/resources/rebind/context/InlineClientBundleGenerator.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/resources/rebind/context/StaticClientBundleGenerator.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/user/RemoteServiceObfuscateTypeNames.gwt.xml
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/user/client/ui/ListenerWrapper.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/user/rebind/StringSourceWriter.java
   
/branches/snapshot-2009.10.23-r6446/user/src/com/google/gwt/user/tools/WebAppCreator.java
   
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/core/CoreSuite.java
   
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/core/client/HttpThrowableReporterTest.java
   
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/dev/jjs/test/jsoimpls/UnreferencedImplOfJsoInterface.java
   
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/dev/jjs/test/jsointfs/JsoInterfaceWithUnreferencedImpl.java
   
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/event/dom/client/DomEventTest.java
   
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/event/logical/shared/LogicalEventsTest.java
   
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/junit/NonGwtTestSuite.java
  /branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/resources
   
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/user/RPCSuiteWithObfuscation.gwt.xml
   
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/user/client/rpc/CollectionsTestWithTypeObfuscation.java
   
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/user/client/rpc/CustomFieldSerializerTestWithTypeObfuscation.java
   
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/user/client/rpc/EnumsTestWithTypeObfuscation.java
   
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/user/client/rpc/InheritanceTestWithTypeObfuscation.java
   
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/user/client/rpc/ObjectGraphTestWithTypeObfuscation.java
   
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/user/client/rpc/RemoteServiceServletTestWithTypeObfuscation.java
   
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/user/client/rpc/UnicodeEscapingTestWithTypeObfuscation.java
   
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/user/client/rpc/ValueTypesTestWithTypeObfuscation.java

=======================================
--- /dev/null
+++  
/branches/snapshot-2009.10.23-r6446/user/test/com/google/gwt/core/client/impl/SchedulerImplTest.java
     
Wed Nov 11 20:06:00 2009
@@ -0,0 +1,187 @@
+/*
+ * Copyright 2009 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.core.client.impl;
+
+import com.google.gwt.core.client.Scheduler.RepeatingCommand;
+import com.google.gwt.core.client.Scheduler.ScheduledCommand;
+import com.google.gwt.junit.client.GWTTestCase;
+
+/**
+ * Tests that poke at the internal state of SchedulerImpl.
+ */
+public class SchedulerImplTest extends GWTTestCase {
+
+  static class ArraySetterCommand implements ScheduledCommand {
+    private final boolean[] values;
+
+    public ArraySetterCommand(boolean[] values) {
+      this.values = values;
+    }
+
+    public void execute() {
+      values[0] = true;
+    }
+  }
+
+  static class CountingCommand implements RepeatingCommand {
+    public final int[] values;
+
+    public CountingCommand(int[] values) {
+      assertEquals(2, values.length);
+      this.values = values;
+    }
+
+    public boolean execute() {
+      assertTrue("Called too many times", values[0] < values[1]);
+      values[0] = values[0] + 1;
+      return values[0] < values[1];
+    }
+  }
+
+  /**
+   * A no-op command used to test internal datastructures.
+   */
+  static class NullCommand implements ScheduledCommand {
+    public void execute() {
+    }
+  }
+
+  private static final int TEST_DELAY = 5000;
+
+  @Override
+  public String getModuleName() {
+    return "com.google.gwt.core.Core";
+  }
+
+  public void testDeferredCommands() {
+    final SchedulerImpl impl = new SchedulerImpl();
+
+    final boolean[] values = {false};
+    impl.scheduleDeferred(new ArraySetterCommand(values));
+
+    assertEquals(1, impl.deferredCommands.length());
+
+    ScheduledCommand nullCommand = new NullCommand();
+    impl.scheduleDeferred(nullCommand);
+    assertEquals(2, impl.deferredCommands.length());
+    assertSame(nullCommand, impl.deferredCommands.get(1).getScheduled());
+
+    impl.scheduleDeferred(new ScheduledCommand() {
+      public void execute() {
+        assertTrue(values[0]);
+        assertEquals(0, impl.deferredCommands.length());
+        finishTest();
+      }
+    });
+
+    delayTestFinish(TEST_DELAY);
+  }
+
+  public void testFinallyCommands() {
+    SchedulerImpl impl = new SchedulerImpl();
+
+    final boolean[] values = {false};
+    impl.scheduleFinally(new ArraySetterCommand(values));
+
+    assertEquals(1, impl.finallyCommands.length());
+
+    ScheduledCommand nullCommand = new NullCommand();
+    impl.scheduleFinally(nullCommand);
+    assertEquals(2, impl.finallyCommands.length());
+    assertSame(nullCommand, impl.finallyCommands.get(1).getScheduled());
+
+    impl.flushFinallyCommands();
+
+    assertTrue(values[0]);
+    assertEquals(0, impl.finallyCommands.length());
+  }
+
+  public void testFixedDelayCommands() {
+    final SchedulerImpl impl = new SchedulerImpl();
+    final int[] values = {0, 4};
+
+    impl.scheduleFixedDelay(new CountingCommand(values), 20);
+    // Scheduler doesn't need to maintain state for this kind of command
+    assertFalse(impl.isWorkQueued());
+
+    // Busy wait for the counter
+    impl.scheduleDeferred(new ScheduledCommand() {
+      public void execute() {
+        if (values[0] == values[1]) {
+          finishTest();
+        } else {
+          impl.scheduleDeferred(this);
+        }
+      }
+    });
+
+    delayTestFinish(TEST_DELAY);
+  }
+
+  public void testFixedPeriodCommands() {
+    final SchedulerImpl impl = new SchedulerImpl();
+    final int[] values = {0, 4};
+
+    impl.scheduleFixedPeriod(new CountingCommand(values), 20);
+    // Scheduler doesn't need to maintain state for this kind of command
+    assertFalse(impl.isWorkQueued());
+
+    // Busy wait for the counter
+    impl.scheduleDeferred(new ScheduledCommand() {
+      public void execute() {
+        if (values[0] == values[1]) {
+          finishTest();
+        } else {
+          impl.scheduleDeferred(this);
+        }
+      }
+    });
+
+    delayTestFinish(TEST_DELAY);
+  }
+
+  public void testIncrementalCommands() {
+    final SchedulerImpl impl = new SchedulerImpl();
+
+    final int[] values = {0, 4};
+    final CountingCommand counter = new CountingCommand(values);
+    impl.scheduleIncremental(counter);
+
+    // The first pass is scheduled as a deferred command
+    assertEquals(1, impl.deferredCommands.length());
+
+    impl.scheduleDeferred(new ScheduledCommand() {
+      public void execute() {
+        // After the incremental command has fired, it's moved to a new  
queue
+        assertEquals(0, impl.deferredCommands.length());
+        assertTrue(String.valueOf(values[0]), values[0] <= values[1]);
+
+        if (values[0] == values[1]) {
+          assertEquals(0, impl.incrementalCommands.length());
+          finishTest();
+        } else {
+          assertEquals(1, impl.incrementalCommands.length());
+          assertSame(counter,  
impl.incrementalCommands.get(0).getRepeating());
+          impl.scheduleDeferred(this);
+        }
+      }
+    });
+
+    assertEquals(2, impl.deferredCommands.length());
+
+    delayTestFinish(TEST_DELAY);
+  }
+}
=======================================
--- /branches/snapshot-2009.10.23-r6446/branch-info.txt Fri Oct 23 12:30:47  
2009
+++ /branches/snapshot-2009.10.23-r6446/branch-info.txt Wed Nov 11 20:06:00  
2009
@@ -8,4 +8,5 @@
  Merges:
  Cherrypicked c6451 with:
    svn merge -c6451 https://google-web-toolkit.googlecode.com/svn/trunk .
-
+  svn merge -c6851 https://google-web-toolkit.googlecode.com/svn/trunk .
+
=======================================
---  
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/close.png
      
Wed Nov 11 19:58:10 2009
+++  
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/close.png
      
Wed Nov 11 20:06:00 2009
Binary file, no diff available.
=======================================
---  
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/log/icon-close.png
     
Wed Nov 11 19:58:10 2009
+++  
/branches/snapshot-2009.10.23-r6446/dev/core/src/com/google/gwt/dev/shell/log/icon-close.png
     
Wed Nov 11 20:06:00 2009
Binary file, no diff available.
=======================================
***Additional files exist in this changeset.***

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

Reply via email to