Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(700)

Side by Side Diff: tests/html/history_test.dart

Issue 12218131: Combine window.setTimeout/setInterval with Timer and Timer.repeating. Also (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/html/cssstyledeclaration_test.dart ('k') | tests/html/js_interop_3_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library HistoryTest; 1 library HistoryTest;
2 import '../../pkg/unittest/lib/unittest.dart'; 2 import '../../pkg/unittest/lib/unittest.dart';
3 import '../../pkg/unittest/lib/html_individual_config.dart'; 3 import '../../pkg/unittest/lib/html_individual_config.dart';
4 import 'dart:html'; 4 import 'dart:html';
5 import 'dart:async';
5 6
6 main() { 7 main() {
7 useHtmlIndividualConfiguration(); 8 useHtmlIndividualConfiguration();
8 9
9 group('supported_state', () { 10 group('supported_state', () {
10 test('supportsState', () { 11 test('supportsState', () {
11 expect(History.supportsState, true); 12 expect(History.supportsState, true);
12 }); 13 });
13 }); 14 });
14 15
(...skipping 20 matching lines...) Expand all
35 36
36 test('back', () { 37 test('back', () {
37 expect(() { 38 expect(() {
38 window.history.pushState(null, document.title, '?dummy1'); 39 window.history.pushState(null, document.title, '?dummy1');
39 window.history.pushState(null, document.title, '?dummy2'); 40 window.history.pushState(null, document.title, '?dummy2');
40 var length = window.history.length; 41 var length = window.history.length;
41 42
42 expect(window.location.href.endsWith('dummy2'), isTrue); 43 expect(window.location.href.endsWith('dummy2'), isTrue);
43 44
44 // Need to wait a frame or two to let the pushState events occur. 45 // Need to wait a frame or two to let the pushState events occur.
45 window.setTimeout(expectAsync0(() { 46 new Timer(const Duration(milliseconds: 100), expectAsync0(() {
46 window.onPopState.first.then(expectAsync1((_){ 47 window.onPopState.first.then(expectAsync1((_){
47 expect(window.history.length, length); 48 expect(window.history.length, length);
48 expect(window.location.href.endsWith('dummy1'), isTrue); 49 expect(window.location.href.endsWith('dummy1'), isTrue);
49 })); 50 }));
50 51
51 window.history.back(); 52 window.history.back();
52 }), 100); 53 }));
53 }, expectation); 54 }, expectation);
54 }); 55 });
55 56
56 test('replaceState', () { 57 test('replaceState', () {
57 expect(() { 58 expect(() {
58 var length = window.history.length; 59 var length = window.history.length;
59 60
60 window.history.replaceState(null, document.title, '?foo=baz'); 61 window.history.replaceState(null, document.title, '?foo=baz');
61 expect(window.history.length, length); 62 expect(window.history.length, length);
62 expect(window.location.href.endsWith('foo=baz'), isTrue); 63 expect(window.location.href.endsWith('foo=baz'), isTrue);
(...skipping 11 matching lines...) Expand all
74 var expectation = HashChangeEvent.supported ? returnsNormally : throws; 75 var expectation = HashChangeEvent.supported ? returnsNormally : throws;
75 expect(() { 76 expect(() {
76 var event = new HashChangeEvent('change', oldUrl:'old', newUrl: 'new'); 77 var event = new HashChangeEvent('change', oldUrl:'old', newUrl: 'new');
77 expect(event is HashChangeEvent, true); 78 expect(event is HashChangeEvent, true);
78 expect(event.oldUrl, 'old'); 79 expect(event.oldUrl, 'old');
79 expect(event.newUrl, 'new'); 80 expect(event.newUrl, 'new');
80 }, expectation); 81 }, expectation);
81 }); 82 });
82 }); 83 });
83 } 84 }
OLDNEW
« no previous file with comments | « tests/html/cssstyledeclaration_test.dart ('k') | tests/html/js_interop_3_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698