Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTim Buschtöns2011-01-20 13:36:32 +0000
committerTim Buschtöns2011-01-20 13:36:32 +0000
commit98d3f26b091812009162c13db487c291c74f01d4 (patch)
tree6337b64547b803bd5fb3847432c0053dd2697914 /tests
parent17a481a99f2ed39b29dffd81d135747738c813d9 (diff)
downloadorg.eclipse.rap-98d3f26b091812009162c13db487c291c74f01d4.tar.gz
org.eclipse.rap-98d3f26b091812009162c13db487c291c74f01d4.tar.xz
org.eclipse.rap-98d3f26b091812009162c13db487c291c74f01d4.zip
Fix for Bug 334138 - [Browser] Refactor BrowserFunction creation
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/TestRunner.js1
-rw-r--r--tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/BrowserTest.js212
-rw-r--r--tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/TestRunner.js1
-rw-r--r--tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/BrowserTest.js212
4 files changed, 368 insertions, 58 deletions
diff --git a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/TestRunner.js b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/TestRunner.js
index 613522676d..239b2c3c8f 100644
--- a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/TestRunner.js
+++ b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/TestRunner.js
@@ -206,6 +206,7 @@ qx.Class.define("org.eclipse.rwt.test.TestRunner", {
org.eclipse.rwt.test.fixture.TestUtil.restoreAppearance();
org.eclipse.rwt.test.fixture.TestUtil.emptyDragCache();
org.eclipse.rwt.test.fixture.TestUtil.resetEventHandler();
+ org.eclipse.rwt.test.fixture.TestUtil.clearErrorPage();
qx.ui.core.Widget.flushGlobalQueues();
},
diff --git a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/BrowserTest.js b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/BrowserTest.js
index a05cd08620..fee0804153 100644
--- a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/BrowserTest.js
+++ b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/BrowserTest.js
@@ -16,18 +16,25 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
BLANK : "../org.eclipse.rap.rwt.q07/resources/resource/static/html/blank.html",
testGetDomain : function() {
- var url1 = "http://google.de/";
- var url2 = "http://www.sub.somedomain.com:84/"
- + "example/document.html?param=value&param2=%20value2"
+ var url1 = "HTtp://google.de/";
+ var url2 = "http://www.sub.somedomain.com:84/"
+ + "example/document.html?param=value&param2=%20value2"
+ var url3 = "https://amazon.com";
+ var url4 = "FTPS://mydomain.cOM";
var domain1 = org.eclipse.swt.browser.Browser.getDomain( url1 );
var domain2 = org.eclipse.swt.browser.Browser.getDomain( url2 );
+ var domain3 = org.eclipse.swt.browser.Browser.getDomain( url3 );
+ var domain4 = org.eclipse.swt.browser.Browser.getDomain( url4 );
assertEquals( "google.de", domain1 );
assertEquals( "www.sub.somedomain.com:84", domain2 );
+ assertEquals( "amazon.com", domain3 );
+ assertEquals( "mydomain.com", domain4 );
},
testGetDomainFails : function() {
+ // url1/2 are assumed to be relative
var url1 = "htp://google.de/";
- var url2 = "http://www.sub.somedomain.com:84";
+ var url2 = "ftp.www.sub.somedomain.com:84";
var domain1 = org.eclipse.swt.browser.Browser.getDomain( url1 );
var domain2 = org.eclipse.swt.browser.Browser.getDomain( url2 );
var domain3 = org.eclipse.swt.browser.Browser.getDomain( null );
@@ -40,16 +47,17 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ //NOTE: Using "_isLoaded" instead of "isLoaded" because of IE.
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
var win = browser.getContentWindow();
assertNotNull( win );
- assertTrue( typeof foo == "undefined" );
+ assertTrue( typeof foo === "undefined" );
foo = 17;
// Note: Using this line would fail in firefox, no workaround known:
//browser.execute( "foo = 33;" );
@@ -67,11 +75,11 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.execute( "33;" );
@@ -86,11 +94,11 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.execute( "for(){}" );
@@ -105,11 +113,11 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.execute( "/regexp/;" );
@@ -124,11 +132,11 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.execute( "( function(){ return {};})();" );
@@ -143,11 +151,11 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.execute( "( function(){ return [ 1,2,3 ]; } )();" );
@@ -162,11 +170,11 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.execute( "( function(){ return function(){}; } )();" );
@@ -221,11 +229,11 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.createFunction( "abc" );
@@ -239,15 +247,161 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
}
],
+ testCreateBrowserFunctionBeforeLoaded : [
+ function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var browser = this._createBrowser();
+ browser.createFunction( "abc" );
+ testUtil.delayTest( 300 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ assertTrue( "slow connection?", browser._isLoaded );
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ testUtil.initRequestLog();
+ var win = browser.getContentWindow();
+ assertTrue( typeof( win.abc ) === "function" );
+ assertTrue( typeof( win.abc_impl ) === "function" );
+ browser.destroy();
+ }
+ ],
+
+ testCreateBrowserFunctionThenNavigate : [
+ function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var browser = this._createBrowser();
+ testUtil.delayTest( 300 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ browser.createFunction( "abc" );
+ browser.reload(); //simulates a navigation
+ testUtil.delayTest( 300 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ assertTrue( "slow connection?", browser._isLoaded );
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ testUtil.initRequestLog();
+ var win = browser.getContentWindow();
+ assertTrue( typeof( win.abc ) === "function" );
+ assertTrue( typeof( win.abc_impl ) === "function" );
+ browser.destroy();
+ }
+ ],
+
+ testCreateDestroyBrowserFunctionThenNavigate : [
+ function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var browser = this._createBrowser();
+ testUtil.delayTest( 300 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ assertTrue( "slow connection?", browser._isLoaded );
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ testUtil.initRequestLog();
+ browser.createFunction( "abc" );
+ browser.destroyFunction( "abc" );
+ browser.reload();
+ testUtil.delayTest( 300 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ var win = browser.getContentWindow();
+ assertTrue( typeof( win.abc ) === "undefined" );
+ assertTrue( typeof( win.abc_impl ) === "undefined" );
+ browser.destroy();
+ }
+ ],
+
+ testCreateBrowserFunctionThenSetSourceToOtherDomain : [
+ function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var browser = this._createBrowser();
+ testUtil.delayTest( 300 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ assertTrue( "slow connection?", browser._isLoaded );
+ browser.createFunction( "abc" );
+ browser.setSource( "http://www.google.com/" );
+ testUtil.delayTest( 2500 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ assertTrue( "slow connection?", browser._isLoaded );
+ assertNotNull( testUtil.getErrorPage() );
+ browser.destroy();
+ }
+ ],
+
+ testCreateBrowserFunctionThenNavigateToOtherDomain : [
+ function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var browser = this._createBrowser();
+ testUtil.delayTest( 300 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ assertTrue( "slow connection?", browser._isLoaded );
+ browser.createFunction( "abc" );
+ browser.getIframeNode().onload = function() {
+ browser.setUserData( "nativeLoaded", true );
+ };
+ // Simulates navigation: source stays the same, no load event
+ // since the "load" flag is already true:
+ browser.getIframeNode().src = "http://www.google.com/";
+ testUtil.delayTest( 3000 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ // TODO: check for native load event to prevent false positive
+ assertTrue( "native loaded?", browser.getUserData( "nativeLoaded" ) );
+ assertNull( testUtil.getErrorPage() );
+ browser.destroy();
+ }
+ ],
+
+ testNavigateToOtherDomainThenCreateBrowserFunction : [
+ function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var browser = this._createBrowser();
+ testUtil.delayTest( 300 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ assertTrue( "slow connection?", browser._isLoaded );
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ browser.getIframeNode().onload = function() {
+ browser.setUserData( "nativeLoaded", true );
+ };
+ browser.getIframeNode().src = "http://www.google.com/";
+ testUtil.delayTest( 2000 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ assertTrue( "native loaded?", browser.getUserData( "nativeLoaded" ) );
+ var error = null;
+ try{
+ browser.createFunction( "abc" );
+ }catch( ex ) {
+ error = ex;
+ }
+ assertNotNull( error );
+ }
+ ],
+
testBrowserFunctionFailed : [
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.createFunction( "abc" );
@@ -271,11 +425,11 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.createFunction( "abc" );
@@ -302,12 +456,12 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
assertTrue( browser.isSeeable() );
- assertFalse( browser.isLoaded() );
- testUtil.delayTest( 300 );
+ assertFalse( browser._isLoaded );
+ testUtil.delayTest( 500 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var wm = org.eclipse.swt.WidgetManager.getInstance();
var el = browser._getTargetNode();
@@ -323,7 +477,7 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
}
assertEquals( "javascript:false;", browser.getSource() );
assertTrue( wm.findWidgetById( "w6" ) == null ); /* may be undefined */
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser, el, iframe );
},
function( browser, el, iframe ) {
diff --git a/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/TestRunner.js b/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/TestRunner.js
index 613522676d..239b2c3c8f 100644
--- a/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/TestRunner.js
+++ b/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/TestRunner.js
@@ -206,6 +206,7 @@ qx.Class.define("org.eclipse.rwt.test.TestRunner", {
org.eclipse.rwt.test.fixture.TestUtil.restoreAppearance();
org.eclipse.rwt.test.fixture.TestUtil.emptyDragCache();
org.eclipse.rwt.test.fixture.TestUtil.resetEventHandler();
+ org.eclipse.rwt.test.fixture.TestUtil.clearErrorPage();
qx.ui.core.Widget.flushGlobalQueues();
},
diff --git a/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/BrowserTest.js b/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/BrowserTest.js
index a05cd08620..fee0804153 100644
--- a/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/BrowserTest.js
+++ b/tests/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/BrowserTest.js
@@ -16,18 +16,25 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
BLANK : "../org.eclipse.rap.rwt.q07/resources/resource/static/html/blank.html",
testGetDomain : function() {
- var url1 = "http://google.de/";
- var url2 = "http://www.sub.somedomain.com:84/"
- + "example/document.html?param=value&param2=%20value2"
+ var url1 = "HTtp://google.de/";
+ var url2 = "http://www.sub.somedomain.com:84/"
+ + "example/document.html?param=value&param2=%20value2"
+ var url3 = "https://amazon.com";
+ var url4 = "FTPS://mydomain.cOM";
var domain1 = org.eclipse.swt.browser.Browser.getDomain( url1 );
var domain2 = org.eclipse.swt.browser.Browser.getDomain( url2 );
+ var domain3 = org.eclipse.swt.browser.Browser.getDomain( url3 );
+ var domain4 = org.eclipse.swt.browser.Browser.getDomain( url4 );
assertEquals( "google.de", domain1 );
assertEquals( "www.sub.somedomain.com:84", domain2 );
+ assertEquals( "amazon.com", domain3 );
+ assertEquals( "mydomain.com", domain4 );
},
testGetDomainFails : function() {
+ // url1/2 are assumed to be relative
var url1 = "htp://google.de/";
- var url2 = "http://www.sub.somedomain.com:84";
+ var url2 = "ftp.www.sub.somedomain.com:84";
var domain1 = org.eclipse.swt.browser.Browser.getDomain( url1 );
var domain2 = org.eclipse.swt.browser.Browser.getDomain( url2 );
var domain3 = org.eclipse.swt.browser.Browser.getDomain( null );
@@ -40,16 +47,17 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ //NOTE: Using "_isLoaded" instead of "isLoaded" because of IE.
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
var win = browser.getContentWindow();
assertNotNull( win );
- assertTrue( typeof foo == "undefined" );
+ assertTrue( typeof foo === "undefined" );
foo = 17;
// Note: Using this line would fail in firefox, no workaround known:
//browser.execute( "foo = 33;" );
@@ -67,11 +75,11 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.execute( "33;" );
@@ -86,11 +94,11 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.execute( "for(){}" );
@@ -105,11 +113,11 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.execute( "/regexp/;" );
@@ -124,11 +132,11 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.execute( "( function(){ return {};})();" );
@@ -143,11 +151,11 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.execute( "( function(){ return [ 1,2,3 ]; } )();" );
@@ -162,11 +170,11 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.execute( "( function(){ return function(){}; } )();" );
@@ -221,11 +229,11 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.createFunction( "abc" );
@@ -239,15 +247,161 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
}
],
+ testCreateBrowserFunctionBeforeLoaded : [
+ function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var browser = this._createBrowser();
+ browser.createFunction( "abc" );
+ testUtil.delayTest( 300 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ assertTrue( "slow connection?", browser._isLoaded );
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ testUtil.initRequestLog();
+ var win = browser.getContentWindow();
+ assertTrue( typeof( win.abc ) === "function" );
+ assertTrue( typeof( win.abc_impl ) === "function" );
+ browser.destroy();
+ }
+ ],
+
+ testCreateBrowserFunctionThenNavigate : [
+ function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var browser = this._createBrowser();
+ testUtil.delayTest( 300 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ browser.createFunction( "abc" );
+ browser.reload(); //simulates a navigation
+ testUtil.delayTest( 300 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ assertTrue( "slow connection?", browser._isLoaded );
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ testUtil.initRequestLog();
+ var win = browser.getContentWindow();
+ assertTrue( typeof( win.abc ) === "function" );
+ assertTrue( typeof( win.abc_impl ) === "function" );
+ browser.destroy();
+ }
+ ],
+
+ testCreateDestroyBrowserFunctionThenNavigate : [
+ function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var browser = this._createBrowser();
+ testUtil.delayTest( 300 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ assertTrue( "slow connection?", browser._isLoaded );
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ testUtil.initRequestLog();
+ browser.createFunction( "abc" );
+ browser.destroyFunction( "abc" );
+ browser.reload();
+ testUtil.delayTest( 300 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ var win = browser.getContentWindow();
+ assertTrue( typeof( win.abc ) === "undefined" );
+ assertTrue( typeof( win.abc_impl ) === "undefined" );
+ browser.destroy();
+ }
+ ],
+
+ testCreateBrowserFunctionThenSetSourceToOtherDomain : [
+ function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var browser = this._createBrowser();
+ testUtil.delayTest( 300 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ assertTrue( "slow connection?", browser._isLoaded );
+ browser.createFunction( "abc" );
+ browser.setSource( "http://www.google.com/" );
+ testUtil.delayTest( 2500 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ assertTrue( "slow connection?", browser._isLoaded );
+ assertNotNull( testUtil.getErrorPage() );
+ browser.destroy();
+ }
+ ],
+
+ testCreateBrowserFunctionThenNavigateToOtherDomain : [
+ function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var browser = this._createBrowser();
+ testUtil.delayTest( 300 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ assertTrue( "slow connection?", browser._isLoaded );
+ browser.createFunction( "abc" );
+ browser.getIframeNode().onload = function() {
+ browser.setUserData( "nativeLoaded", true );
+ };
+ // Simulates navigation: source stays the same, no load event
+ // since the "load" flag is already true:
+ browser.getIframeNode().src = "http://www.google.com/";
+ testUtil.delayTest( 3000 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ // TODO: check for native load event to prevent false positive
+ assertTrue( "native loaded?", browser.getUserData( "nativeLoaded" ) );
+ assertNull( testUtil.getErrorPage() );
+ browser.destroy();
+ }
+ ],
+
+ testNavigateToOtherDomainThenCreateBrowserFunction : [
+ function() {
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ var browser = this._createBrowser();
+ testUtil.delayTest( 300 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ assertTrue( "slow connection?", browser._isLoaded );
+ var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
+ browser.getIframeNode().onload = function() {
+ browser.setUserData( "nativeLoaded", true );
+ };
+ browser.getIframeNode().src = "http://www.google.com/";
+ testUtil.delayTest( 2000 );
+ testUtil.store( browser );
+ },
+ function( browser ) {
+ assertTrue( "native loaded?", browser.getUserData( "nativeLoaded" ) );
+ var error = null;
+ try{
+ browser.createFunction( "abc" );
+ }catch( ex ) {
+ error = ex;
+ }
+ assertNotNull( error );
+ }
+ ],
+
testBrowserFunctionFailed : [
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.createFunction( "abc" );
@@ -271,11 +425,11 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
function() {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
testUtil.initRequestLog();
browser.createFunction( "abc" );
@@ -302,12 +456,12 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var browser = this._createBrowser();
assertTrue( browser.isSeeable() );
- assertFalse( browser.isLoaded() );
- testUtil.delayTest( 300 );
+ assertFalse( browser._isLoaded );
+ testUtil.delayTest( 500 );
testUtil.store( browser );
},
function( browser ) {
- assertTrue( browser.isLoaded() );
+ assertTrue( "slow connection?", browser._isLoaded );
var testUtil = org.eclipse.rwt.test.fixture.TestUtil;
var wm = org.eclipse.swt.WidgetManager.getInstance();
var el = browser._getTargetNode();
@@ -323,7 +477,7 @@ qx.Class.define( "org.eclipse.rwt.test.tests.BrowserTest", {
}
assertEquals( "javascript:false;", browser.getSource() );
assertTrue( wm.findWidgetById( "w6" ) == null ); /* may be undefined */
- testUtil.delayTest( 100 );
+ testUtil.delayTest( 300 );
testUtil.store( browser, el, iframe );
},
function( browser, el, iframe ) {

Back to the top