Author: [email protected]
Date: Thu Jul 9 19:17:11 2009
New Revision: 5710
Added:
branches/htmlunit/user/src/com/google/gwt/junit/HostedModePluginObject.java
(contents, props changed)
Modified:
branches/htmlunit/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
Log:
Fixed to run the right runstyle/thread, refactoring.
Added:
branches/htmlunit/user/src/com/google/gwt/junit/HostedModePluginObject.java
==============================================================================
--- (empty file)
+++
branches/htmlunit/user/src/com/google/gwt/junit/HostedModePluginObject.java
Thu Jul 9 19:17:11 2009
@@ -0,0 +1,95 @@
+// Copyright 2009 Google Inc. All Rights Reserved.
+
+package com.google.gwt.junit;
+
+import net.sourceforge.htmlunit.corejs.javascript.Context;
+import net.sourceforge.htmlunit.corejs.javascript.NativeJavaMethod;
+import net.sourceforge.htmlunit.corejs.javascript.Scriptable;
+
+import java.lang.reflect.Method;
+
+public class HostedModePluginObject implements Scriptable {
+
+ private Scriptable parent;
+ private Scriptable prototype;
+
+ public HostedModePluginObject(Scriptable parent, Scriptable prototype) {
+ this.parent = parent;
+ this.prototype = prototype;
+ }
+
+ public void delete(int index) {
+ }
+
+ public void delete(String name) {
+ }
+
+ public Object get(int index, Scriptable start) {
+ return Context.getUndefinedValue();
+ }
+
+ public Object get(String name, Scriptable start) {
+ if (name.equals("connect")) {
+ Method connectMethod = null;
+ try {
+ connectMethod = HostedModePluginObject.class.getMethod("connect",
+ String.class, String.class, Object.class);
+ } catch (SecurityException e) {
+ // TODO(jat) Auto-generated catch block
+ e.printStackTrace();
+ } catch (NoSuchMethodException e) {
+ // TODO(jat) Auto-generated catch block
+ e.printStackTrace();
+ }
+ return new NativeJavaMethod(connectMethod, "connect");
+ }
+ return Context.getUndefinedValue();
+ }
+
+ public String getClassName() {
+ return "Plugin";
+ }
+
+ public Object getDefaultValue(Class<?> hint) {
+ // TODO(jat) Auto-generated method stub
+ return Context.getUndefinedValue();
+ }
+
+ public Object[] getIds() {
+ return new Object[] { "connect" };
+ }
+
+ public Scriptable getParentScope() {
+ return parent;
+ }
+
+ public Scriptable getPrototype() {
+ return prototype;
+ }
+
+ public boolean has(int index, Scriptable start) {
+ return false;
+ }
+
+ public boolean has(String name, Scriptable start) {
+ return name.equals("connect");
+ }
+
+ public boolean hasInstance(Scriptable instance) {
+ return false;
+ }
+
+ public void put(int index, Scriptable start, Object value) {
+ }
+
+ public void put(String name, Scriptable start, Object value) {
+ }
+
+ public void setParentScope(Scriptable parent) {
+ this.parent = parent;
+ }
+
+ public void setPrototype(Scriptable prototype) {
+ this.prototype = prototype;
+ }
+}
\ No newline at end of file
Modified:
branches/htmlunit/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
==============================================================================
--- branches/htmlunit/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
(original)
+++ branches/htmlunit/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
Thu Jul 9 19:17:11 2009
@@ -129,7 +129,7 @@
// TODO(jat): find the browser name in BrowserVersion
browsers[i] = browser;
}
- RunStyleHtmlUnit runStyle = new RunStyleHtmlUnit(shell, browsers);
+ RunStyleHtmlUnit runStyle = new RunStyleHtmlUnitHosted(shell,
browsers);
return runStyle;
}
@@ -147,8 +147,12 @@
String url = getMyUrl(moduleName);
shell.getTopLogger().log(TreeLogger.INFO, "Starting " + url
+ " on browser " + browser);
- threads.add(new HtmlUnitThread(browser, url));
+ threads.add(createHtmlUnitThread(browser, url));
}
+ }
+
+ protected HtmlUnitThread createHtmlUnitThread(BrowserVersion browser,
String url) {
+ return new HtmlUnitThread(browser, url);
}
@Override
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---