Tests for FLEX-34753

Signed-off-by: Erik de Bruin <e...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/b2e06b59
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/b2e06b59
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/b2e06b59

Branch: refs/heads/develop
Commit: b2e06b59961588b0de2161c0ee0d5ead58865723
Parents: 2867276
Author: Erik de Bruin <e...@ixsoftware.nl>
Authored: Sat Apr 4 13:23:28 2015 +0200
Committer: Erik de Bruin <e...@ixsoftware.nl>
Committed: Sat Apr 4 13:23:28 2015 +0200

----------------------------------------------------------------------
 .../apache/tests/promises/PromisesTestSuite.as  |   3 +
 .../tests/promises/cases/PromisesJIRATests.as   | 132 +++++++++++++++++++
 2 files changed, 135 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b2e06b59/frameworks/projects/apache/tests/promises/PromisesTestSuite.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/tests/promises/PromisesTestSuite.as 
b/frameworks/projects/apache/tests/promises/PromisesTestSuite.as
index 2fbb424..223a579 100644
--- a/frameworks/projects/apache/tests/promises/PromisesTestSuite.as
+++ b/frameworks/projects/apache/tests/promises/PromisesTestSuite.as
@@ -21,6 +21,7 @@ package promises
 {
 
 import promises.cases.PromisesBasicTests;
+import promises.cases.PromisesJIRATests;
 
 [Suite]
 [RunWith("org.flexunit.runners.Suite")]
@@ -28,6 +29,8 @@ public class PromisesTestSuite
 {
 
        public var promisesBasic:PromisesBasicTests;
+       
+       public var promisesJIRA:PromisesJIRATests;
 
 }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b2e06b59/frameworks/projects/apache/tests/promises/cases/PromisesJIRATests.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/apache/tests/promises/cases/PromisesJIRATests.as 
b/frameworks/projects/apache/tests/promises/cases/PromisesJIRATests.as
new file mode 100644
index 0000000..ae102c3
--- /dev/null
+++ b/frameworks/projects/apache/tests/promises/cases/PromisesJIRATests.as
@@ -0,0 +1,132 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package promises.cases
+{
+
+import flash.events.TimerEvent;
+import flash.net.URLRequest;
+import flash.utils.Timer;
+
+import flashx.textLayout.debug.assert;
+
+import org.apache.flex.promises.Promise;
+import org.apache.flex.promises.interfaces.IThenable;
+import org.flexunit.asserts.assertEquals;
+import org.flexunit.async.Async;
+
+public class PromisesJIRATests
+{
+
+       
//--------------------------------------------------------------------------
+       //
+       //    Variables
+       //
+       
//--------------------------------------------------------------------------
+       
+       private var expected_:*;
+       
+       private var promise_:IThenable;
+       
+       private var got_:*;
+       
+       private var timer_:Timer;
+       
+       
+       
+       
//--------------------------------------------------------------------------
+       //
+       //    Methods
+       //
+       
//--------------------------------------------------------------------------
+       
+       //----------------------------------
+       //    parseGot_
+       //----------------------------------
+       
+       private function parseGot_(value:*):void {
+               this.got_ = value;
+       }
+       
+       //----------------------------------
+       //    setUp
+       //----------------------------------
+       
+       [Before(async)]
+       public function setUp():void
+       {
+               this.timer_ = new Timer(100, 1);
+       }
+       
+       //----------------------------------
+       //    tearDown
+       //----------------------------------
+       
+       [After(async)]
+       public function tearDown():void
+       {
+               this.promise_ = null;
+               
+               if (this.timer_)
+               {
+                       this.timer_.stop();
+                       this.timer_ = null;
+               }
+       }
+       
+       //----------------------------------
+       //    verifyGotType_
+       //----------------------------------
+       
+       private function verifyGotType_(event:TimerEvent, result:*):void {
+               assertEquals(typeof this.expected_, this.got_);
+       }
+       
+
+       
+       
//--------------------------------------------------------------------------
+       //
+       //    Tests
+       //
+       
//--------------------------------------------------------------------------
+       
+       //----------------------------------
+       //    test_FLEX34753
+       //----------------------------------
+       
+       [Test(async)]
+       public function test_FLEX34753():void
+       {
+               Async.handleEvent(this, timer_, TimerEvent.TIMER_COMPLETE, 
verifyGotType_);
+               
+               timer_.start();
+               
+               promise_ = new Promise(function (fulfill:Function = null, 
reject:Function = null):*
+               {
+                       var urlRequest:URLRequest = new 
URLRequest('http://flex.apache.org');
+                       
+                       fulfill(urlRequest);
+               });
+               
+               expected_ = '[object URLRequest]';
+               
+               promise_.then(parseGot_);
+       }
+       
+}}
\ No newline at end of file

Reply via email to