| 
									
										
										
										
											2016-10-23 22:37:15 +02:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							|  |  |  |  * Copyright Google Inc. All Rights Reserved. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Use of this source code is governed by an MIT-style license that can be | 
					
						
							|  |  |  |  * found in the LICENSE file at https://angular.io/license
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-28 17:50:03 -07:00
										 |  |  | import {runBenchmark, verifyNoBrowserErrors} from '@angular/testing/src/perf_util'; | 
					
						
							| 
									
										
										
										
											2015-01-27 09:53:22 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-03 10:04:27 -07:00
										 |  |  | describe('ng-dart1.x naive infinite scroll benchmark', function() { | 
					
						
							| 
									
										
										
										
											2015-01-27 09:53:22 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |   const URL = 'benchmarks_external/src/naive_infinite_scroll/index.html'; | 
					
						
							| 
									
										
										
										
											2015-01-27 09:53:22 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-03 10:04:27 -07:00
										 |  |  |   afterEach(verifyNoBrowserErrors); | 
					
						
							| 
									
										
										
										
											2015-01-27 09:53:22 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   [1, 2, 4].forEach(function(appSize) { | 
					
						
							| 
									
										
										
										
											2015-06-03 10:04:27 -07:00
										 |  |  |     it('should run scroll benchmark and collect stats for appSize = ' + appSize, function(done) { | 
					
						
							|  |  |  |       runBenchmark({ | 
					
						
							| 
									
										
										
										
											2015-01-27 09:53:22 -08:00
										 |  |  |         url: URL, | 
					
						
							|  |  |  |         id: 'ng1-dart1.x.naive_infinite_scroll', | 
					
						
							|  |  |  |         work: function() { | 
					
						
							| 
									
										
										
										
											2015-02-27 09:07:16 -08:00
										 |  |  |           $('#reset-btn').click(); | 
					
						
							|  |  |  |           $('#run-btn').click(); | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |           let s = 1000; | 
					
						
							| 
									
										
										
										
											2015-02-05 18:33:57 -08:00
										 |  |  |           if (appSize > 4) { | 
					
						
							|  |  |  |             s = s + appSize * 100; | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           browser.sleep(s); | 
					
						
							| 
									
										
										
										
											2015-01-27 09:53:22 -08:00
										 |  |  |         }, | 
					
						
							| 
									
										
										
										
											2015-06-03 10:04:27 -07:00
										 |  |  |         params: [ | 
					
						
							| 
									
										
										
										
											2016-04-12 09:40:37 -07:00
										 |  |  |           {name: 'appSize', value: appSize}, | 
					
						
							|  |  |  |           {name: 'iterationCount', value: 20, scale: 'linear'}, | 
					
						
							| 
									
										
										
										
											2015-06-03 10:04:27 -07:00
										 |  |  |           {name: 'scrollIncrement', value: 40} | 
					
						
							| 
									
										
										
										
											2015-08-27 17:44:59 +02:00
										 |  |  |         ], | 
					
						
							|  |  |  |         waitForAngular2: false | 
					
						
							| 
									
										
										
										
											2015-02-11 10:13:49 -08:00
										 |  |  |       }).then(done, done.fail); | 
					
						
							| 
									
										
										
										
											2015-01-27 09:53:22 -08:00
										 |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }); |