@@ -1112,7 +1112,7 @@ angular.mock.dump = function(object) {
1112
1112
```
1113
1113
*/
1114
1114
angular . mock . $HttpBackendProvider = function ( ) {
1115
- this . $get = [ '$rootScope' , createHttpBackendMock ] ;
1115
+ this . $get = [ '$rootScope' , '$timeout' , createHttpBackendMock ] ;
1116
1116
} ;
1117
1117
1118
1118
/**
@@ -1129,7 +1129,7 @@ angular.mock.$HttpBackendProvider = function() {
1129
1129
* @param {Object= } $browser Auto-flushing enabled if specified
1130
1130
* @return {Object } Instance of $httpBackend mock
1131
1131
*/
1132
- function createHttpBackendMock ( $rootScope , $delegate , $browser ) {
1132
+ function createHttpBackendMock ( $rootScope , $timeout , $ delegate, $browser ) {
1133
1133
var definitions = [ ] ,
1134
1134
expectations = [ ] ,
1135
1135
responses = [ ] ,
@@ -1159,7 +1159,9 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
1159
1159
}
1160
1160
1161
1161
function wrapResponse ( wrapped ) {
1162
- if ( ! $browser && timeout && timeout . then ) timeout . then ( handleTimeout ) ;
1162
+ if ( ! $browser && timeout ) {
1163
+ timeout . then ? timeout . then ( handleTimeout ) : $timeout ( handleTimeout , timeout ) ;
1164
+ }
1163
1165
1164
1166
return handleResponse ;
1165
1167
@@ -2033,7 +2035,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
2033
2035
*/
2034
2036
angular . mock . e2e = { } ;
2035
2037
angular . mock . e2e . $httpBackendDecorator =
2036
- [ '$rootScope' , '$delegate' , '$browser' , createHttpBackendMock ] ;
2038
+ [ '$rootScope' , '$timeout' , '$ delegate', '$browser' , createHttpBackendMock ] ;
2037
2039
2038
2040
2039
2041
/**
0 commit comments