| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library test_mocks; |
| 6 |
| 7 import 'dart:html'; |
| 8 import 'package:unittest/mock.dart'; |
| 9 |
| 10 class MockWindow extends Mock implements Window { |
| 11 MockHistory history = new MockHistory(); |
| 12 MockLocation location = new MockLocation(); |
| 13 MockDocument document = new MockDocument(); |
| 14 } |
| 15 |
| 16 class MockHistory extends Mock implements History { |
| 17 //TODO(pavelgj): ugly hack for making tests run in dart2js |
| 18 void pushState(Object data, String title, [String url]) { |
| 19 log.add(new LogEntry(name, 'pushState', [data, title, url], Action.IGNORE)); |
| 20 } |
| 21 |
| 22 //TODO(pavelgj): ugly hack for making tests run in dart2js |
| 23 void replaceState(Object data, String title, [String url]) { |
| 24 log.add(new LogEntry(name, 'replaceState', [data, title, url], Action.IGNORE
)); |
| 25 } |
| 26 } |
| 27 |
| 28 class MockLocation extends Mock implements Location {} |
| 29 |
| 30 class MockDocument extends Mock implements HtmlDocument { |
| 31 //TODO(pavelgj): ugly hack for making tests run in dart2js |
| 32 String set title(title) => |
| 33 log.add(new LogEntry(name, '=title', [title], Action.IGNORE)); |
| 34 } |
| OLD | NEW |