Chromium Code Reviews| Index: test/perf/input/todomvc_async_test.html |
| diff --git a/test/data/input/todomvc_listorder_shadowdom_test.html b/test/perf/input/todomvc_async_test.html |
| similarity index 69% |
| copy from test/data/input/todomvc_listorder_shadowdom_test.html |
| copy to test/perf/input/todomvc_async_test.html |
| index 1ed1bc5f982a1c1df5b048ca1b407ae34cacbac2..2ec4cefc3a222d223f3b62ad3d5ff588d0181afd 100644 |
| --- a/test/data/input/todomvc_listorder_shadowdom_test.html |
| +++ b/test/perf/input/todomvc_async_test.html |
| @@ -7,12 +7,15 @@ BSD-style license that can be found in the LICENSE file. |
| <html lang="en"> |
| <head> |
| <!-- |
| - This test runs the TodoMVC app, adds a few elements, marks some as done, and |
| - switches from back and forth between "Active" and "All". This will make some |
| - nodes to be hidden and readded to the page. |
| + This performance test runs the TodoMVC app and uses the application as follows: |
| + * on each iteration: |
| + * clear all todos |
| + * add 5 todos |
| + * mark 1 as done |
| + * clear the todo marked as done. |
| - This is a regression test for a bug in dwc that made the nodes appear in the |
| - wrong order when using lists and ifs together. |
| + This test is just like todomvc_test.html, but we use requestLayoutFrame |
| + between rendering steps (after adding each note, or removing a note). |
| --> |
| <meta charset="utf-8"> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| @@ -20,6 +23,7 @@ BSD-style license that can be found in the LICENSE file. |
| <link rel="components" href="example/todomvc/todo_row.html"> |
| <link rel="stylesheet" href="example/todomvc/base.css"> |
| <script type="application/javascript" src="testing.js"></script> |
| + <script type="application/javascript" src="start_dart.js"></script> |
| <title>dart - TodoMVC</title> |
| </head> |
| <body> |
| @@ -75,34 +79,42 @@ import 'package:unittest/unittest.dart'; |
| import 'package:web_ui/web_ui.dart'; |
| import 'example/todomvc/main.dart' as todomvc_main; |
| import 'example/todomvc/model.dart'; |
| +import 'perf_common.dart'; |
| +import 'todomvc_common.dart'; |
| final addTodo = todomvc_main.addTodo; |
| main() { |
| - useShadowDom = true; |
| + useShadowDom = false; |
| todomvc_main.main(); |
| - |
| window.setTimeout(() { |
| - app.todos.add(new Todo('one (unchecked)')); |
| - app.todos.add(new Todo('two (checked)')..done = true); |
| - app.todos.add(new Todo('three (unchecked)')); |
| - viewModel.showIncomplete = true; |
| - viewModel.showDone = true; |
| - dispatch(); |
| - |
| - window.setTimeout(() { |
| - viewModel.showIncomplete = true; |
| - viewModel.showDone = false; |
| - dispatch(); |
| - window.setTimeout(() { |
| - viewModel.showIncomplete = true; |
| - viewModel.showDone = true; |
| - dispatch(); |
| - window.setTimeout(() => window.postMessage('done', '*'), 0); |
| - }, 0); |
| - }, 0); |
| + var bench = new TodoMvcBenchmark(); |
| + bench.measure().transform(perfDone); |
| }, 0); |
| } |
| + |
| +class TodoMvcBenchmark extends AsyncBenchmark { |
| + TodoMvcBenchmark() : super('todomvc-async'); |
| + Future run() { |
| + return step(app.todos.clear) |
| + .chain((_) => step(() => addNote("one"))) |
|
Jennifer Messerly
2013/01/07 21:07:46
It would be nice to combine step and chain somehow
Siggi Cherem (dart-lang)
2013/01/08 02:26:18
Good idea - I went with your first proposal (I wan
|
| + .chain((_) => step(() => addNote("two"))) |
| + .chain((_) => step(() => addNote("three"))) |
| + .chain((_) => step(() => addNote("four"))) |
| + .chain((_) => step(() => addNote("five"))) |
| + .chain((_) => step(() => markChecked(3))); |
| + } |
| +} |
| + |
| +Future step(f) { |
| + var completer = new Completer(); |
| + window.requestLayoutFrame(() { |
| + var res = f(); |
| + dispatch(); |
| + completer.complete(res); |
| + }); |
| + return completer.future; |
| +} |
| </script> |
| </body> |
| </html> |