Some cleanup in jsinterop tests.

Change-Id: Ifaeab2922f3c3ada8659109093b35f01d61a659e
diff --git a/user/test/com/google/gwt/core/CoreJsInteropSuite.java b/user/test/com/google/gwt/core/CoreJsInteropSuite.java
index 52f5787..5fb87e2 100644
--- a/user/test/com/google/gwt/core/CoreJsInteropSuite.java
+++ b/user/test/com/google/gwt/core/CoreJsInteropSuite.java
@@ -20,6 +20,7 @@
 import com.google.gwt.core.client.interop.JsMethodTest;
 import com.google.gwt.core.client.interop.JsPropertyTest;
 import com.google.gwt.core.client.interop.JsTypeArrayTest;
+import com.google.gwt.core.client.interop.JsTypeBridgeTest;
 import com.google.gwt.core.client.interop.JsTypeTest;
 
 import junit.framework.Test;
@@ -33,6 +34,7 @@
     TestSuite suite = new TestSuite("All core js interop tests");
 
     suite.addTestSuite(JsTypeTest.class);
+    suite.addTestSuite(JsTypeBridgeTest.class);
     suite.addTestSuite(JsPropertyTest.class);
     suite.addTestSuite(JsMethodTest.class);
     suite.addTestSuite(JsTypeArrayTest.class);
diff --git a/user/test/com/google/gwt/core/client/interop/Collection.java b/user/test/com/google/gwt/core/client/interop/Collection.java
deleted file mode 100644
index b63534c..0000000
--- a/user/test/com/google/gwt/core/client/interop/Collection.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2014 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.interop;
-
-/**
-  * Test that disjoint types that virtually inherit identically named methods work.
-  */
-interface Collection {
-  void add(Object o);
-}
diff --git a/user/test/com/google/gwt/core/client/interop/CollectionBase.java b/user/test/com/google/gwt/core/client/interop/CollectionBase.java
deleted file mode 100644
index 705b738..0000000
--- a/user/test/com/google/gwt/core/client/interop/CollectionBase.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2014 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.interop;
-
-class CollectionBase implements Collection {
-  Object x;
-  public void add(Object o) {
-    x = o + "CollectionBase";
-  }
-}
diff --git a/user/test/com/google/gwt/core/client/interop/FooImpl.java b/user/test/com/google/gwt/core/client/interop/FooImpl.java
deleted file mode 100644
index 2cb8e77..0000000
--- a/user/test/com/google/gwt/core/client/interop/FooImpl.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.core.client.interop;
-
-class FooImpl extends CollectionBase implements Collection {
-  @Override
-  public void add(Object o) {
-    super.add(o);
-    x = x.toString() + "FooImpl";
-  }
-}
diff --git a/user/test/com/google/gwt/core/client/interop/HTMLButtonElement.java b/user/test/com/google/gwt/core/client/interop/HTMLButtonElementConcreteNativeJsType.java
similarity index 89%
rename from user/test/com/google/gwt/core/client/interop/HTMLButtonElement.java
rename to user/test/com/google/gwt/core/client/interop/HTMLButtonElementConcreteNativeJsType.java
index fa178c9..8020256 100644
--- a/user/test/com/google/gwt/core/client/interop/HTMLButtonElement.java
+++ b/user/test/com/google/gwt/core/client/interop/HTMLButtonElementConcreteNativeJsType.java
@@ -19,5 +19,5 @@
 import jsinterop.annotations.JsType;
 
 @JsType(namespace = JsPackage.GLOBAL, name = "HTMLButtonElement", isNative = true)
-class HTMLButtonElement extends HTMLElementConcreteNativeJsType {
+class HTMLButtonElementConcreteNativeJsType extends HTMLElementConcreteNativeJsType {
 }
diff --git a/user/test/com/google/gwt/core/client/interop/JsListInterface.java b/user/test/com/google/gwt/core/client/interop/JsListInterface.java
deleted file mode 100644
index 0976b77..0000000
--- a/user/test/com/google/gwt/core/client/interop/JsListInterface.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2014 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.interop;
-
-import jsinterop.annotations.JsType;
-
-@JsType
-interface JsListInterface {
-  void add(Object o);
-}
diff --git a/user/test/com/google/gwt/core/client/interop/JsTypeBridgeTest.java b/user/test/com/google/gwt/core/client/interop/JsTypeBridgeTest.java
new file mode 100644
index 0000000..0c0e5ea
--- /dev/null
+++ b/user/test/com/google/gwt/core/client/interop/JsTypeBridgeTest.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2015 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.interop;
+
+import com.google.gwt.junit.client.GWTTestCase;
+
+import jsinterop.annotations.JsType;
+
+/**
+ * Tests JsInterop bridge methods.
+ */
+public class JsTypeBridgeTest extends GWTTestCase {
+  @Override
+  public String getModuleName() {
+    return "com.google.gwt.core.Core";
+  }
+
+  @JsType
+  private interface JsListInterface {
+    void add(Object o);
+  }
+
+  private interface Collection {
+    void add(Object o);
+  }
+
+  private static class CollectionBase implements Collection {
+    Object x;
+
+    public void add(Object o) {
+      x = o + "CollectionBase";
+    }
+  }
+
+  private interface List extends Collection, JsListInterface {
+    void add(Object o);
+  }
+
+  private static class FooImpl extends CollectionBase implements Collection {
+    @Override
+    public void add(Object o) {
+      super.add(o);
+      x = x.toString() + "FooImpl";
+    }
+  }
+
+  private static class ListImpl extends CollectionBase implements List {
+    @Override
+    public void add(Object o) {
+      x = o + "ListImpl";
+    }
+  }
+
+  public void testBridges() {
+    ListImpl listWithExport = new ListImpl(); // Exports .add().
+    FooImpl listNoExport = new FooImpl(); // Does not export .add().
+
+    // Use a loose type reference to force polymorphic dispatch.
+    Collection collectionWithExport = listWithExport;
+    // Calls through a bridge method.
+    collectionWithExport.add("Loose");
+    assertEquals("LooseListImpl", listWithExport.x);
+
+    // Use a loose type reference to force polymorphic dispatch.
+    Collection collectionNoExport = listNoExport;
+    collectionNoExport.add("Loose");
+    assertEquals("LooseCollectionBaseFooImpl", listNoExport.x);
+
+    // Calls directly.
+    listNoExport.add("Tight");
+    assertEquals("TightCollectionBaseFooImpl", listNoExport.x);
+
+    listWithExport.add("Tight");
+    assertEquals("TightListImpl", listWithExport.x);
+  }
+}
diff --git a/user/test/com/google/gwt/core/client/interop/JsTypeTest.java b/user/test/com/google/gwt/core/client/interop/JsTypeTest.java
index 7d8a005..08238ac 100644
--- a/user/test/com/google/gwt/core/client/interop/JsTypeTest.java
+++ b/user/test/com/google/gwt/core/client/interop/JsTypeTest.java
@@ -48,29 +48,6 @@
         .inject();
   }
 
-  public void testVirtualUpRefs() {
-    ListImpl listWithExport = new ListImpl(); // Exports .add().
-    FooImpl listNoExport = new FooImpl(); // Does not export .add().
-
-    // Use a loose type reference to force polymorphic dispatch.
-    Collection collectionWithExport = listWithExport;
-    collectionWithExport.add("Loose");
-    assertEquals("LooseListImpl", listWithExport.x);
-
-    // Use a loose type reference to force polymorphic dispatch.
-    Collection collectionNoExport = listNoExport;
-    collectionNoExport.add("Loose");
-    assertEquals("LooseCollectionBaseFooImpl", listNoExport.x);
-
-    // Calls directly.
-    listNoExport.add("Tight");
-    assertEquals("TightCollectionBaseFooImpl", listNoExport.x);
-
-    // Calls through a bridge method.
-    listWithExport.add("Tight");
-    assertEquals("TightListImpl", listWithExport.x);
-  }
-
   public void testConcreteJsTypeAccess() {
     ConcreteJsType concreteJsType = new ConcreteJsType();
 
@@ -208,9 +185,9 @@
     Object object = createMyNativeJsType();
 
     assertTrue(object instanceof Object);
-    assertFalse(object instanceof HTMLElementAnotherConcreteNativeJsType);
-    assertFalse(object instanceof HTMLButtonElement);
     assertFalse(object instanceof HTMLElementConcreteNativeJsType);
+    assertFalse(object instanceof HTMLElementAnotherConcreteNativeJsType);
+    assertFalse(object instanceof HTMLButtonElementConcreteNativeJsType);
     assertFalse(object instanceof Iterator);
     assertFalse(object instanceof MyNativeJsTypeInterfaceImpl);
     assertFalse(object instanceof ElementLikeNativeInterfaceImpl);
@@ -225,9 +202,9 @@
     Object object = JavaScriptObject.createObject();
 
     assertTrue(object instanceof Object);
-    assertFalse(object instanceof HTMLElementAnotherConcreteNativeJsType);
-    assertFalse(object instanceof HTMLButtonElement);
     assertFalse(object instanceof HTMLElementConcreteNativeJsType);
+    assertFalse(object instanceof HTMLElementAnotherConcreteNativeJsType);
+    assertFalse(object instanceof HTMLButtonElementConcreteNativeJsType);
     assertFalse(object instanceof Iterator);
     assertFalse(object instanceof MyNativeJsTypeInterfaceImpl);
     assertFalse(object instanceof ElementLikeNativeInterfaceImpl);
@@ -242,9 +219,9 @@
     Object object = createNativeButton();
 
     assertTrue(object instanceof Object);
-    assertTrue(object instanceof HTMLElementAnotherConcreteNativeJsType);
-    assertTrue(object instanceof HTMLButtonElement);
     assertTrue(object instanceof HTMLElementConcreteNativeJsType);
+    assertTrue(object instanceof HTMLElementAnotherConcreteNativeJsType);
+    assertTrue(object instanceof HTMLButtonElementConcreteNativeJsType);
     assertFalse(object instanceof Iterator);
     assertFalse(object instanceof MyNativeJsTypeInterfaceImpl);
     assertFalse(object instanceof ElementLikeNativeInterfaceImpl);
@@ -260,9 +237,9 @@
     Object object = new ElementLikeNativeInterfaceImpl();
 
     assertTrue(object instanceof Object);
-    assertFalse(object instanceof HTMLElementAnotherConcreteNativeJsType);
-    assertFalse(object instanceof HTMLButtonElement);
     assertFalse(object instanceof HTMLElementConcreteNativeJsType);
+    assertFalse(object instanceof HTMLElementAnotherConcreteNativeJsType);
+    assertFalse(object instanceof HTMLButtonElementConcreteNativeJsType);
     assertFalse(object instanceof Iterator);
     assertFalse(object instanceof MyNativeJsTypeInterfaceImpl);
     assertTrue(object instanceof ElementLikeNativeInterfaceImpl);
@@ -278,9 +255,9 @@
     Object object = new MyNativeJsTypeInterfaceImpl();
 
     assertTrue(object instanceof Object);
-    assertFalse(object instanceof HTMLElementAnotherConcreteNativeJsType);
-    assertFalse(object instanceof HTMLButtonElement);
     assertFalse(object instanceof HTMLElementConcreteNativeJsType);
+    assertFalse(object instanceof HTMLElementAnotherConcreteNativeJsType);
+    assertFalse(object instanceof HTMLButtonElementConcreteNativeJsType);
     assertFalse(object instanceof Iterator);
     assertTrue(object instanceof MyNativeJsTypeInterfaceImpl);
     assertFalse(object instanceof ElementLikeNativeInterfaceImpl);
@@ -296,9 +273,9 @@
     Object object = new ConcreteJsType();
 
     assertTrue(object instanceof Object);
-    assertFalse(object instanceof HTMLElementAnotherConcreteNativeJsType);
-    assertFalse(object instanceof HTMLButtonElement);
     assertFalse(object instanceof HTMLElementConcreteNativeJsType);
+    assertFalse(object instanceof HTMLElementAnotherConcreteNativeJsType);
+    assertFalse(object instanceof HTMLButtonElementConcreteNativeJsType);
     assertFalse(object instanceof Iterator);
     assertFalse(object instanceof MyNativeJsTypeInterfaceImpl);
     assertFalse(object instanceof ElementLikeNativeInterfaceImpl);
@@ -329,9 +306,9 @@
     assertTrue(object instanceof MyNativeJsType);
     assertFalse(object instanceof MyNativeJsTypeSubclass);
     assertTrue(object instanceof MyNativeJsTypeSubclassWithIterator);
-    assertFalse(object instanceof HTMLElementAnotherConcreteNativeJsType);
-    assertFalse(object instanceof HTMLButtonElement);
     assertFalse(object instanceof HTMLElementConcreteNativeJsType);
+    assertFalse(object instanceof HTMLElementAnotherConcreteNativeJsType);
+    assertFalse(object instanceof HTMLButtonElementConcreteNativeJsType);
     assertTrue(object instanceof Iterable);
     assertFalse(object instanceof MyNativeJsTypeInterfaceImpl);
     assertFalse(object instanceof ElementLikeNativeInterfaceImpl);
diff --git a/user/test/com/google/gwt/core/client/interop/List.java b/user/test/com/google/gwt/core/client/interop/List.java
deleted file mode 100644
index 9a7aa75..0000000
--- a/user/test/com/google/gwt/core/client/interop/List.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2014 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.interop;
-
-interface List extends Collection, JsListInterface {
-  void add(Object o);
-}
diff --git a/user/test/com/google/gwt/core/client/interop/ListImpl.java b/user/test/com/google/gwt/core/client/interop/ListImpl.java
deleted file mode 100644
index 149b755..0000000
--- a/user/test/com/google/gwt/core/client/interop/ListImpl.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2014 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.interop;
-
-class ListImpl extends CollectionBase implements List {
-  @Override
-  public void add(Object o) {
-    x = o + "ListImpl";
-  }
-}
diff --git a/user/test/com/google/gwt/core/client/interop/MyCustomHtmlButtonWithIterator.java b/user/test/com/google/gwt/core/client/interop/MyCustomHtmlButtonWithIterator.java
deleted file mode 100644
index 89e2ed4..0000000
--- a/user/test/com/google/gwt/core/client/interop/MyCustomHtmlButtonWithIterator.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2014 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.interop;
-
-import java.util.Iterator;
-
-class MyCustomHtmlButtonWithIterator extends HTMLButtonElement implements Iterable {
-  @Override
-  public Iterator iterator() {
-    return null;
-  }
-}