/**
 * 
 */
package org.ajax4jsf.tests;

import org.apache.commons.logging.Log;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.Function;
import org.mozilla.javascript.Script;
import org.mozilla.javascript.Scriptable;

import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.WebResponse;
import com.gargoylesoftware.htmlunit.WebWindow;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine;

/**
 * Dummy implementation of script engine. It really does nuthin.
 * Always returns empty strings.
 * @author Maksim Kaszynski
 *
 */
public class DummyScriptEngine extends JavaScriptEngine {

	public DummyScriptEngine(WebClient webClient) {
		super(webClient);
	}

	public Object callFunction(HtmlPage htmlPage, Function function,
			Context context, Scriptable scope, Scriptable thisObject,
			Object[] args) {
		return Boolean.FALSE;
	}

	public Script compile(HtmlPage htmlPage, String sourceCode,
			String sourceName, int startLine) {
		return new Script() {
			public Object exec(Context arg0, Scriptable arg1) {
				return Boolean.FALSE;
			}
		};
	}

	
	public Script getCachedScript(WebResponse webResponse) {
		return null;
	}

	protected Log getLog() {
		return null;
	}

	public void initialize(WebWindow webWindow) {
		super.initialize(webWindow);
	}

	public boolean isScriptRunning() {
		return false;
	}

	public String preProcess(HtmlPage htmlPage, String sourceCode,
			String sourceName, HtmlElement htmlElement) {
		return "";
	}
}
