Author: svasilyev
Date: 2007-10-19 06:12:54 -0400 (Fri, 19 Oct 2007)
New Revision: 4370
Added:
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/AllTests.java
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/DOMCreatingTest.java
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/XulRunnerBrowserTest.java
Removed:
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/DOMCreatingTest.java
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/VpeXulRunnerAllTests.java
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/XulRunnerBrowserTest.java
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/tests/
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/META-INF/MANIFEST.MF
Log:
Tests were fixed to be run on XULRunner
Property changes on: trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test
___________________________________________________________________
Name: svn:ignore
+ bin
AllTests.txt
Modified: trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/META-INF/MANIFEST.MF 2007-10-19
09:52:27 UTC (rev 4369)
+++ trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/META-INF/MANIFEST.MF 2007-10-19
10:12:54 UTC (rev 4370)
@@ -11,6 +11,6 @@
org.jboss.tools.vpe.xulrunner,
org.mozilla.xpcom
Eclipse-LazyStart: true
-Export-Package: org.jboss.tools.vpe.xulrunner.tests,
+Export-Package: org.jboss.tools.vpe.xulrunner.test,
org.jboss.tools.vpe.xulrunner.view
Bundle-ClassPath: vpe-mozilla-tests.jar
Copied:
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test
(from rev 4367,
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/tests)
Copied:
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/AllTests.java
(from rev 4367,
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/tests/VpeXulRunnerAllTests.java)
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/AllTests.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/AllTests.java 2007-10-19
10:12:54 UTC (rev 4370)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.xulrunner.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test for " + AllTests.class.getName());
+ //add test cases for dom elements
+ suite.addTestSuite(DOMCreatingTest.class);
+ return suite;
+ }
+
+}
Deleted:
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/DOMCreatingTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/tests/DOMCreatingTest.java 2007-10-19
09:22:43 UTC (rev 4367)
+++
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/DOMCreatingTest.java 2007-10-19
10:12:54 UTC (rev 4370)
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.xulrunner.tests;
-
-import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
-import org.jboss.tools.vpe.xulrunner.view.XulRunnerView;
-import org.mozilla.interfaces.nsIDOMAttr;
-import org.mozilla.interfaces.nsIDOMDocument;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNode;
-import org.mozilla.interfaces.nsIDOMNodeList;
-import org.mozilla.interfaces.nsIDOMText;
-
-/**
- * This class used for testing mozilla interfaces.
- *
- * @author Max Areshkau
- *
- */
-public class DOMCreatingTest extends XulRunnerBrowserTest {
-
- /**
- * Contains brouser instamce
- */
- private XulRunnerEditor xulrunnerBrowser;
-
- /**
- * Tests possability add and remove dom elements.
- *
- */
- public void testAddRemovingDOMElements() {
- nsIDOMDocument domDocument = xulrunnerBrowser.getDOMDocument();
- nsIDOMElement root = domDocument.getDocumentElement();
- nsIDOMElement child = domDocument.createElement("test-element");
- root.appendChild(child);
- assertTrue("We doen't have elements to remove", root.getChildNodes()
- .getLength() > 0);
- for (long i = root.getChildNodes().getLength() - 1; i >= 0; i--) {
- root.removeChild(root.getChildNodes().item(i));
- }
- root.appendChild(child);
- assertTrue("We haven't remove some elements", root.getChildNodes()
- .getLength() == 1);
- }
-
- /**
- * Tests that DOM can be created
- *
- * @throws Exception
- */
- public void testXulRunnerCreatingDOM() throws Exception {
- String chieldName = "H";
- String attrName = "color";
- String attrValue = "TEST_VALUE";
- assertNotNull(xulrunnerBrowser);
- nsIDOMDocument domDocument = xulrunnerBrowser.getDOMDocument();
- nsIDOMElement root = domDocument.getDocumentElement();
-
- for (long i = root.getChildNodes().getLength() - 1; i >= 0; i--) {
- root.removeChild(root.getChildNodes().item(i));
- }
- // checks of creating elements with attributes and chield nodes
- nsIDOMElement child = domDocument.createElement("test-element");
- for (int i = 0; i < 4; i++) {
- child.appendChild(domDocument.createElement(chieldName + i));
- }
- for (int i = 0; i < 3; i++) {
- child.setAttribute(attrName + i, attrValue + i);
- }
- nsIDOMAttr attr = domDocument.createAttribute(attrName + 3);
- attr.setValue(attrValue + 3);
- child.setAttributeNode(attr);
- // append child element to root element
- root.appendChild(child);
- nsIDOMNode toCheck = root.getChildNodes().item(0);
- assertEquals("We haven't add child element", toCheck.getNodeName(),
- child.getNodeName());
-
- assertEquals("Number of child nodes do not coincide", 4,child
- .getChildNodes().getLength());
- nsIDOMNodeList nodeList = child.getChildNodes();
- for (int i = 0; i < nodeList.getLength(); i++) {
- assertEquals("Child node doesn't concide", nodeList.item(i)
- .getNodeName(), chieldName + i);
- }
-
- for (int i = 0; i < toCheck.getAttributes().getLength(); i++) {
- assertEquals("Attribute names doesn't coinside",
toCheck.getAttributes()
- .item(i).getNodeName(), attrName + i);
- assertEquals("Attribute values doesn't coinside",
toCheck.getAttributes()
- .item(i).getNodeValue(), attrValue + i);
- }
- nsIDOMText text = domDocument.createTextNode("TEST");
- root.appendChild(text);
- assertEquals("Dom element hasn't been created", "TEST", text
- .getNodeValue());
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- waitForJobs();
- XulRunnerView xulrunner
- = ((XulRunnerView) PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().showView(VIEW_ID));
- waitForJobs();
- delay(3000);
-
- xulrunnerBrowser = xulrunner.getBrowser();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-}
Copied:
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/DOMCreatingTest.java
(from rev 4369,
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/tests/DOMCreatingTest.java)
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/DOMCreatingTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/DOMCreatingTest.java 2007-10-19
10:12:54 UTC (rev 4370)
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.xulrunner.test;
+
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
+import org.jboss.tools.vpe.xulrunner.view.XulRunnerView;
+import org.mozilla.interfaces.nsIDOMAttr;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.interfaces.nsIDOMNodeList;
+import org.mozilla.interfaces.nsIDOMText;
+
+/**
+ * This class used for testing mozilla interfaces.
+ *
+ * @author Max Areshkau
+ *
+ */
+public class DOMCreatingTest extends XulRunnerBrowserTest {
+
+ /**
+ * Contains brouser instamce
+ */
+ private XulRunnerEditor xulrunnerBrowser;
+
+ /**
+ * Tests possability add and remove dom elements.
+ *
+ */
+ public void testAddRemovingDOMElements() {
+ nsIDOMDocument domDocument = xulrunnerBrowser.getDOMDocument();
+ nsIDOMElement root = domDocument.getDocumentElement();
+ nsIDOMElement child = domDocument.createElement("test-element");
+ root.appendChild(child);
+ assertTrue("We doen't have elements to remove", root.getChildNodes()
+ .getLength() > 0);
+ for (long i = root.getChildNodes().getLength() - 1; i >= 0; i--) {
+ root.removeChild(root.getChildNodes().item(i));
+ }
+ root.appendChild(child);
+ assertTrue("We haven't remove some elements", root.getChildNodes()
+ .getLength() == 1);
+ }
+
+ /**
+ * Tests that DOM can be created
+ *
+ * @throws Exception
+ */
+ public void testXulRunnerCreatingDOM() throws Exception {
+ String chieldName = "H";
+ String attrName = "color";
+ String attrValue = "TEST_VALUE";
+ assertNotNull(xulrunnerBrowser);
+ nsIDOMDocument domDocument = xulrunnerBrowser.getDOMDocument();
+ nsIDOMElement root = domDocument.getDocumentElement();
+
+ for (long i = root.getChildNodes().getLength() - 1; i >= 0; i--) {
+ root.removeChild(root.getChildNodes().item(i));
+ }
+ // checks of creating elements with attributes and chield nodes
+ nsIDOMElement child = domDocument.createElement("test-element");
+ for (int i = 0; i < 4; i++) {
+ child.appendChild(domDocument.createElement(chieldName + i));
+ }
+ for (int i = 0; i < 3; i++) {
+ child.setAttribute(attrName + i, attrValue + i);
+ }
+ nsIDOMAttr attr = domDocument.createAttribute(attrName + 3);
+ attr.setValue(attrValue + 3);
+ child.setAttributeNode(attr);
+ // append child element to root element
+ root.appendChild(child);
+ nsIDOMNode toCheck = root.getChildNodes().item(0);
+ assertEquals("We haven't add child element", toCheck.getNodeName(),
+ child.getNodeName());
+
+ assertEquals("Number of child nodes do not coincide", 4,child
+ .getChildNodes().getLength());
+ nsIDOMNodeList nodeList = child.getChildNodes();
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ assertEquals("Child node doesn't concide", nodeList.item(i)
+ .getNodeName(), chieldName + i);
+ }
+
+ for (int i = 0; i < toCheck.getAttributes().getLength(); i++) {
+ assertEquals("Attribute names doesn't coinside",
toCheck.getAttributes()
+ .item(i).getNodeName(), attrName + i);
+ assertEquals("Attribute values doesn't coinside",
toCheck.getAttributes()
+ .item(i).getNodeValue(), attrValue + i);
+ }
+ nsIDOMText text = domDocument.createTextNode("TEST");
+ root.appendChild(text);
+ assertEquals("Dom element hasn't been created", "TEST", text
+ .getNodeValue());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ waitForJobs();
+ XulRunnerView xulrunner
+ = ((XulRunnerView) PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().showView(VIEW_ID));
+ waitForJobs();
+ delay(3000);
+
+ xulrunnerBrowser = xulrunner.getBrowser();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+}
Deleted:
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/VpeXulRunnerAllTests.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/tests/VpeXulRunnerAllTests.java 2007-10-19
09:22:43 UTC (rev 4367)
+++
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/VpeXulRunnerAllTests.java 2007-10-19
10:12:54 UTC (rev 4370)
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.xulrunner.tests;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class VpeXulRunnerAllTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite("Test for " +
VpeXulRunnerAllTests.class.getName());
- //add test cases for dom elements
- suite.addTestSuite(DOMCreatingTest.class);
- return suite;
- }
-
-}
Deleted:
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/XulRunnerBrowserTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/tests/XulRunnerBrowserTest.java 2007-10-19
09:22:43 UTC (rev 4367)
+++
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/XulRunnerBrowserTest.java 2007-10-19
10:12:54 UTC (rev 4370)
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.xulrunner.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.vpe.xulrunner.view.XulRunnerView;
-
-public class XulRunnerBrowserTest extends TestCase {
- public static final String VIEW_ID =
"org.jboss.tools.vpe.xulrunner.view.XulRunnerView";
-
- /**
- * Process UI input but do not return for the specified time interval.
- *
- * @param waitTimeMillis
- * the number of milliseconds
- */
- protected void delay(long waitTimeMillis) {
- Display display = Display.getCurrent();
-
- // If this is the UI thread,
- // then process input.
- if (display != null) {
- long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
- while (System.currentTimeMillis() < endTimeMillis) {
- if (!display.readAndDispatch())
- display.sleep();
- }
- display.update();
- }
- // Otherwise, perform a simple sleep.
- else {
- try {
- Thread.sleep(waitTimeMillis);
- } catch (InterruptedException e) {
- // Ignored.
- }
- }
- }
-
- /**
- * Wait until all background tasks are complete.
- */
- public void waitForJobs() {
- while (Job.getJobManager().currentJob() != null)
- delay(1000);
- }
-
- public void testMozillaBrowser() throws PartInitException {
- waitForJobs();
- XulRunnerView mozillaView = (XulRunnerView) PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().showView(VIEW_ID);
-
- // Delay for 3 seconds so that
- // the Favorites view can be seen.
- waitForJobs();
- delay(3000);
-
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .hideView(mozillaView);
- }
-}
Copied:
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/XulRunnerBrowserTest.java
(from rev 4369,
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/tests/XulRunnerBrowserTest.java)
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/XulRunnerBrowserTest.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.xulrunner.test/src/org/jboss/tools/vpe/xulrunner/test/XulRunnerBrowserTest.java 2007-10-19
10:12:54 UTC (rev 4370)
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.xulrunner.test;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.vpe.xulrunner.view.XulRunnerView;
+
+public class XulRunnerBrowserTest extends TestCase {
+ public static final String VIEW_ID =
"org.jboss.tools.vpe.xulrunner.view.XulRunnerView";
+
+ /**
+ * Process UI input but do not return for the specified time interval.
+ *
+ * @param waitTimeMillis
+ * the number of milliseconds
+ */
+ protected void delay(long waitTimeMillis) {
+ Display display = Display.getCurrent();
+
+ // If this is the UI thread,
+ // then process input.
+ if (display != null) {
+ long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
+ while (System.currentTimeMillis() < endTimeMillis) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ display.update();
+ }
+ // Otherwise, perform a simple sleep.
+ else {
+ try {
+ Thread.sleep(waitTimeMillis);
+ } catch (InterruptedException e) {
+ // Ignored.
+ }
+ }
+ }
+
+ /**
+ * Wait until all background tasks are complete.
+ */
+ public void waitForJobs() {
+ while (Job.getJobManager().currentJob() != null)
+ delay(1000);
+ }
+
+ public void testXulRunnerBrowser() throws PartInitException {
+ waitForJobs();
+ XulRunnerView mozillaView = (XulRunnerView) PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().showView(VIEW_ID);
+
+ // Delay for 3 seconds so that
+ // the Favorites view can be seen.
+ waitForJobs();
+ delay(3000);
+
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .hideView(mozillaView);
+ }
+}