cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [4/8] js commit: CB-9883 - remove unused bridge tests
Date Tue, 26 Jan 2016 00:18:10 GMT
CB-9883 - remove unused bridge tests


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/8e9610fe
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/8e9610fe
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/8e9610fe

Branch: refs/heads/4.1.x
Commit: 8e9610fe33fc743fcaf5d920064f0deb2cad1715
Parents: 7703d38
Author: Shazron Abdullah <shazron@apache.org>
Authored: Fri Nov 6 15:59:28 2015 -0800
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Fri Nov 6 15:59:28 2015 -0800

----------------------------------------------------------------------
 test/ios/test.exec.js | 63 ----------------------------------------------
 1 file changed, 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/8e9610fe/test/ios/test.exec.js
----------------------------------------------------------------------
diff --git a/test/ios/test.exec.js b/test/ios/test.exec.js
index 9b1d35a..8006277 100644
--- a/test/ios/test.exec.js
+++ b/test/ios/test.exec.js
@@ -28,7 +28,6 @@ describe('iOS exec', function () {
 
     var cordova = require('cordova');
     var exec = require('cordova/ios/exec');
-    var mockxhr = require('cordova/test/mockxhr');
     var winSpy = jasmine.createSpy('win');
     var failSpy = jasmine.createSpy('fail');
     var origUserAgent = navigator.userAgent;
@@ -36,33 +35,14 @@ describe('iOS exec', function () {
     beforeEach(function() {
         winSpy.reset();
         failSpy.reset();
-        mockxhr.install();
-        exec.setJsToNativeBridgeMode(exec.jsToNativeModes.XHR_NO_PAYLOAD);
-        navigator.__defineGetter__('userAgent', function(){
-            return 'hi there (' + VC_ADDR + ')';
-        });
     });
 
     afterEach(function() {
-        expect(mockxhr.activeXhrs.length).toBe(0);
         navigator.__defineGetter__('userAgent', function(){
             return origUserAgent;
         });
     });
 
-    afterEach(mockxhr.uninstall);
-
-    function expectXhr() {
-        expect(mockxhr.activeXhrs.length).toBeGreaterThan(0, 'expected an XHR to have been
sent.');
-        var mockXhr = mockxhr.activeXhrs[0];
-        expect(mockXhr.url).toMatch(/^\/!gap_exec\\?/);
-        expect(mockXhr.requestHeaders['vc']).toBe(VC_ADDR, 'missing vc header');
-        expect(mockXhr.requestHeaders['rc']).toBeDefined('missing rc header.');
-        expect(mockXhr.requestHeaders['cmds']).not.toBeDefined();
-        expect(mockXhr.requestPayload).toBe(null);
-        mockXhr.simulateResponse(200, '');
-    }
-
     function simulateNativeBehaviour(codes) {
         var execPayload = JSON.parse(exec.nativeFetchMessages());
         while (execPayload.length && codes.length) {
@@ -81,48 +61,5 @@ describe('iOS exec', function () {
             var execPayload = exec.nativeFetchMessages();
             expect(execPayload).toBe('');
         });
-        it('should work in the win case.', function() {
-            exec(winSpy, failSpy, SERVICE, ACTION, []);
-            expectXhr();
-            simulateNativeBehaviour([1]);
-            expect(winSpy).toHaveBeenCalledWith('payload');
-            expect(failSpy).not.toHaveBeenCalled();
-        });
-        it('should work in the fail case.', function() {
-            exec(winSpy, failSpy, SERVICE, ACTION, []);
-            expectXhr();
-            simulateNativeBehaviour([2]);
-            expect(winSpy).not.toHaveBeenCalled();
-            expect(failSpy).toHaveBeenCalledWith('payload');
-        });
-        it('should use only one XHR for multiple calls.', function() {
-            exec(winSpy, failSpy, SERVICE, ACTION, []);
-            exec(winSpy, failSpy, SERVICE, ACTION, []);
-            expectXhr();
-            simulateNativeBehaviour([1, 2]);
-            expect(winSpy).toHaveBeenCalledWith('payload');
-            expect(failSpy).toHaveBeenCalledWith('payload');
-        });
-        it('should send an extra XHR when commands flushed before XHR finishes', function()
{
-            exec(winSpy, failSpy, SERVICE, ACTION, []);
-            simulateNativeBehaviour([1]);
-            exec(winSpy, failSpy, SERVICE, ACTION, []);
-            expectXhr();
-            expectXhr();
-            simulateNativeBehaviour([2]);
-            expect(winSpy).toHaveBeenCalledWith('payload');
-            expect(failSpy).toHaveBeenCalledWith('payload');
-        });
-        it('should return pending calls made from callbacks.', function() {
-            function callMore() {
-                exec(winSpy, failSpy, SERVICE, ACTION, []);
-                exec(winSpy, failSpy, SERVICE, ACTION, []);
-            }
-            exec(callMore, failSpy, SERVICE, ACTION, []);
-            expectXhr();
-            simulateNativeBehaviour([1, 1, 1]);
-            expect(winSpy.callCount).toBe(2);
-            expect(failSpy).not.toHaveBeenCalled();
-        });
     });
 });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message