W3C home > Mailing lists > Public > public-webapps-testsuite@w3.org > May 2012

[WebStorage] Patch to approved/event_local_constructor

From: Odin Hørthe Omdal <odinho@opera.com>
Date: Wed, 09 May 2012 16:02:31 +0200
Cc: jhlee@infraware.co.kr
To: "public-webapps-testsuite@w3.org" <public-webapps-testsuite@w3.org>
Message-ID: <op.wd1nyhjt49xobu@odinho-fido.oslo.osa>
Hey,

we looked at the WebStorage tests at the webapps-meeting in Mountain View,  
and it no-one was passing this particular test. WebKit actually do now,  
but I anyway looked at what the test is doing. It should'nt time out, but  
rather fail when it throws an exception (like Opera and Firefox do, still  
haven't gotten Win8 to work in Virtualbox for testing IE10).

So I made a patch to the test, and comitted that file to an Opera folder:

http://w3c-test.org/webapps/WebStorage/tests/approved/event_local_constructor.html
http://w3c-test.org/webapps/WebStorage/tests/submissions/Opera/event_local_constructor.html

The test is much shorter, should be a bit easier to read (YMMV ;-) ), but  
most importantly, since it has all the logic inside the real test, every  
exception thrown will fail the test. So it tests everything the old one  
did, but with more.


So I'd like a review of it, if it's accepted I might help with writing the  
other tests the same way.

I'll inline the files for easy reviewing.


Original test
-------------

		var t = async_test("storageeventinit test");

		function onStorageEvent(event) {
			t.step(function() {
			   assert_true(true);
			  });
			t.done();
		}

		if (window.addEventListener) {
             window.addEventListener('storage', onStorageEvent, false);
         }

         else {
			test(function() {
				assert_unreached("DOM event subscribtion is not supported.");
			}, "existence of event listener")
         }

		if (('localStorage' in window) && window.localStorage !== null){

			var event = new StorageEvent('storage');

			window.dispatchEvent(event);
		} else {
			test(function() {
				assert_unreached("localStorage is not supported.");
			}, "localStorage interface test")
		}

------------


Patched test
------------

     async_test("storageeventinit test").step(function() {
         window.addEventListener('storage', this.step_func(
             function() { this.done(); }), false);

         var event = new StorageEvent('storage');
         window.dispatchEvent(event);
     });

------------


WDYT? (yes, I know we should make bugzilla bugs for this, but I'd rather  
just take it up here first for discussion etc.)

-- 
Odin Hørthe Omdal (Velmont/odinho) · Core, Opera Software, http://opera.com
Received on Wednesday, 9 May 2012 14:03:21 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:52:55 UTC