| Summary: | SWTBot fails to load the internal browser in headless mode | ||
|---|---|---|---|
| Product: | [Technology] SWTBot | Reporter: | Gabriel Petrovay <gabipetrovay> |
| Component: | SWTBot | Assignee: | Project Inbox <swtbot-inbox> |
| Status: | RESOLVED INVALID | QA Contact: | |
| Severity: | blocker | ||
| Priority: | P3 | CC: | eclipse.felipe, grant_gayed, KetanPadegaonkar, lzoubek, platform-swt-inbox |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
Anyone on the SWT team have any thoughts ? It appears like an SWT bug, but I'm unable to reproduce this locally on linux and mac. SWTBot is not doing anything that is specific about any platform. There's some more context on the forum here: http://www.eclipse.org/forums/index.php?t=msg&th=175593&start=0&S=f81450a23963083a9e57b7a1bd2298f5 (In reply to comment #1) > Anyone on the SWT team have any thoughts ? It appears like an SWT bug, but I'm > unable to reproduce this locally on linux and mac. SWTBot is not doing anything > that is specific about any platform. > > There's some more context on the forum here: > http://www.eclipse.org/forums/index.php?t=msg&th=175593&start=0&S=f81450a23963083a9e57b7a1bd2298f5 I am thinking more about something that does not get loaded/initialized properly by the org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplication. For the SWT guys, there is the Bug 326174 that you can discuss on. Once we see exactly where the problem lies, I will mark one of the two as invalid or duplicate of the other. For a comparison, if this helps: the arguments passed to the two UITestApplication's are: to the failing application (headless): org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication args: [-testApplication, org.eclipse.ui.ide.workbench, formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,D:\STTF\nightly_downloads\Sausalito Tools/result.xml, formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter, -testPluginName, my.test.plugin, -className, org.eclipse.wst.xquery.set.ui.tests.AllTests] to the successful application (from Eclipse): org.eclipse.swtbot.eclipse.core.UITestApplication args: [-version, 3, -port, 9310, -testLoaderClass, org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader, -loaderpluginname, org.eclipse.jdt.junit4.runtime, -classNames, org.eclipse.wst.xquery.set.ui.tests.AllTests, -testpluginname, my.test.plugin] Adding Ketan from SWTBot to the discussion. I have attached a zip to the bug 326174 with a sample plug-in (independent of SWTBot) and the steps to reproduce. We still have to see if this is a bug in SWT or a configuration problem in both SWTBot and my sample plug-in. Hi, I' facing a little bit similar problems with SWTBotBrowser. I've updated bot to 2.0.1 few days ago, and I am getting NoClassDefFound (org/eclipse/swt/browser/Browser) whenever I try to access it. This is reproducible always on linux I looked into org.eclipse.swtbot.swt.finder manifest and found out, that there is missing 'Import package: org.eclipse.swt.browser'. This would be a different issue, the problem described in this report was recently resolved in bug 326174. Gabriel, Is this still an issue? I can see that bug 326174 was marked as NOT_ECLIPSE. Are you able to run the tests after setting the TMP environment variable? Marking as INVALID since this was a case of an environment variable not set correctly. Please reopen if this is still an issue. |
Hi, There must be a bug somewhere in there on Windows 7 at least. This happens only when running SWTBot in headless mode. I also ran it "as Administrator" to make sure there are no permission problems. But the behaviour is the same. I have one test containing the lines: public void test_InternalBrowser() throws Exception { SWTWorkbenchBot bot = AllTests.bot; final StringBuffer sb = new StringBuffer(); PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { public void run() { sb.append("canUseInternalWebBrowser: " + WebBrowserUtil.canUseInternalWebBrowser() + "\n"); } }); try { Class.forName("org.eclipse.swt.browser.Browser"); sb.append("class \"org.eclipse.swt.browser.Browser\" found.\n"); } catch (ClassNotFoundException e) { sb.append("class \"org.eclipse.swt.browser.Browser\" not found.\n"); } assertTrue(sb.toString(), false); } The output is: canUseInternalWebBrowser: false class "org.eclipse.swt.browser.Browser" found The problem is that WebBrowserUtil.canUseInternalWebBrowser() tries to construct a Browser object. The call goes down to org.eclipse.swt.browser.WebSite.createTempStorage() method inherited from org.eclipse.swt.ole.win32.OleClientSite: protected IStorage createTempStorage() { int /*long*/[] tempStorage = new int /*long*/[1]; int grfMode = COM.STGM_READWRITE | COM.STGM_SHARE_EXCLUSIVE | COM.STGM_DELETEONRELEASE; int result = COM.StgCreateDocfile(null, grfMode, 0, tempStorage); if (result != COM.S_OK) OLE.error(OLE.ERROR_CANNOT_CREATE_FILE, result); return new IStorage(tempStorage[0]); } After the call to the native method COM.StgCreateDocfile(...) result has the value -2147286788. This translates to 0x800300FC which is STG_E_INVALIDNAME http://msdn.microsoft.com/en-us/library/aa380323(VS.85).aspx 1. Why is the name not valid if NULL is also a valid input value as the page above describes? 2. Eclipse calls this function many times and it always succeeds called in the same way (providing NULL as the first parameter). When SWTBot is hosted in Eclipse, the environments are already set up by the eclipse host. In headless mode, when SWTBot starts eclipse, something is missing. So I assume there is a problem in how SWTBot launches Eclipse when started headlessly