2009-07-16 18:00:08 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* Copyright (c) 2002 - 2006 IBM Corporation.
|
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
|
|
* which accompanies this distribution, and is available at
|
|
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
*
|
|
|
|
* Contributors:
|
|
|
|
* IBM Corporation - initial API and implementation
|
|
|
|
*****************************************************************************/
|
|
|
|
package com.ibm.wala.cast.js.test;
|
|
|
|
|
2011-04-05 16:42:49 +00:00
|
|
|
import java.io.IOException;
|
|
|
|
import java.net.URL;
|
|
|
|
|
2009-07-27 23:21:22 +00:00
|
|
|
import org.junit.Before;
|
2011-04-05 16:42:49 +00:00
|
|
|
import org.junit.Test;
|
2009-07-16 18:00:08 +00:00
|
|
|
|
2011-04-13 16:27:15 +00:00
|
|
|
import com.ibm.wala.cast.js.html.IHtmlParser;
|
|
|
|
import com.ibm.wala.cast.js.html.IHtmlParserFactory;
|
|
|
|
import com.ibm.wala.cast.js.html.WebUtil;
|
2009-07-16 18:00:08 +00:00
|
|
|
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
|
2011-04-05 16:42:49 +00:00
|
|
|
import com.ibm.wala.ipa.callgraph.CallGraph;
|
|
|
|
import com.ibm.wala.util.CancelException;
|
2009-07-16 18:00:08 +00:00
|
|
|
|
2011-04-13 16:27:15 +00:00
|
|
|
public abstract class TestSimplePageCallGraphShapeRhino extends TestSimplePageCallGraphShape {
|
|
|
|
|
|
|
|
private static final Object[][] assertionsForPage3 = new Object[][] {
|
|
|
|
new Object[] { ROOT, new String[] { "page3.html" } },
|
|
|
|
new Object[] { "page3.html", new String[] { "page3.html/__WINDOW_MAIN__" } }
|
|
|
|
};
|
|
|
|
|
|
|
|
@Test public void testPage3() throws IOException, IllegalArgumentException, CancelException {
|
|
|
|
URL url = getClass().getClassLoader().getResource("pages/page3.html");
|
2012-02-17 20:21:59 +00:00
|
|
|
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
|
2011-04-13 16:27:15 +00:00
|
|
|
verifyGraphAssertions(CG, assertionsForPage3);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
justThisTest(TestSimplePageCallGraphShapeRhino.class);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected abstract IHtmlParser getParser();
|
|
|
|
|
|
|
|
@Before
|
|
|
|
public void setUp() {
|
2012-02-17 20:21:59 +00:00
|
|
|
com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
2011-04-13 16:27:15 +00:00
|
|
|
WebUtil.setFactory(new IHtmlParserFactory() {
|
|
|
|
public IHtmlParser getParser() {
|
|
|
|
return TestSimplePageCallGraphShapeRhino.this.getParser();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2009-07-16 18:00:08 +00:00
|
|
|
}
|