Add a test for RPC requests that lack the GWT permutation header.
Patch by: bobv
Review by: rjrjr


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7815 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/test/com/google/gwt/user/client/rpc/RemoteServiceServletTest.java b/user/test/com/google/gwt/user/client/rpc/RemoteServiceServletTest.java
index 90d63cc..880feef 100644
--- a/user/test/com/google/gwt/user/client/rpc/RemoteServiceServletTest.java
+++ b/user/test/com/google/gwt/user/client/rpc/RemoteServiceServletTest.java
@@ -200,6 +200,39 @@
   }
 
   /**
+   * Send request without the permutation strong name and expect a
+   * SecurityException. This tests
+   * RemoteServiceServlet#checkPermutationStrongName.
+   */
+  public void testRequestWithoutStrongNameHeader() {
+    RemoteServiceServletTestServiceAsync service = getAsyncService();
+    ((ServiceDefTarget) service).setRpcRequestBuilder(new RpcRequestBuilder() {
+      /**
+       * Copied from base class.
+       */
+      @Override
+      protected void doFinish(RequestBuilder rb) {
+        // Don't set permutation strong name
+        rb.setHeader(MODULE_BASE_HEADER, GWT.getModuleBaseURL());
+      }
+
+    });
+
+    delayTestFinishForRpc();
+    service.test(new AsyncCallback<Void>() {
+      public void onFailure(Throwable caught) {
+        assertTrue(caught instanceof StatusCodeException);
+        assertEquals(500, ((StatusCodeException) caught).getStatusCode());
+        finishTest();
+      }
+
+      public void onSuccess(Void result) {
+        fail();
+      }
+    });
+  }
+
+  /**
    * Ensure that each doFoo method is called.
    */
   public void testRpcRequestBuilder() {