http://gwt-code-reviews.appspot.com/646803/diff/1/15
File user/src/com/google/gwt/dom/client/WebSocket.java (right):

http://gwt-code-reviews.appspot.com/646803/diff/1/15#newcode48
user/src/com/google/gwt/dom/client/WebSocket.java:48: };
Just forget my last comment :) I misinterpreted the code here when first
looking at it...

http://gwt-code-reviews.appspot.com/646803/diff/1/20
File user/test/com/google/gwt/dom/client/WebSocketTest.java (right):

http://gwt-code-reviews.appspot.com/646803/diff/1/20#newcode174
user/test/com/google/gwt/dom/client/WebSocketTest.java:174: private
static MockRawWebSocket mockRawSocket;
What about adding a protected constructor into WebSocket which would
accept an additional parameter which would be the mockRawWebSocket

  @SuppressWarnings("unused")
  protected WebSocket(String url, String subProtocol, RawWebSocket
socket) {
    rawWebSocket = socket;
  }

and here in test you would have:

  private static class MockWebSocket extends WebSocket {

    public MockWebSocket(String url, String subProtocol,
MockRawWebSocket mockRawSocket) {
      super(url, subProtocol, mockRawSocket);
    }

    public static MockWebSocket create(MockRawWebSocket mockRawSocket) {
      return new MockWebSocket(mockRawSocket.getURL(), null,
mockRawSocket);
    }

  }

I think that hack would be gone - though haven't tried this yet.

http://gwt-code-reviews.appspot.com/646803/show

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

Reply via email to