Chromium Code Reviews| Index: tools/testing/dart/drt_updater.dart |
| diff --git a/tools/testing/dart/drt_updater.dart b/tools/testing/dart/drt_updater.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..794df4460ca854bd75fc5d76f8b8e49506cc2c60 |
| --- /dev/null |
| +++ b/tools/testing/dart/drt_updater.dart |
| @@ -0,0 +1,49 @@ |
| +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +#library("drt_updater"); |
| + |
| +#import("dart:io"); |
| + |
| +class DumpRenderTreeUpdater { |
| + static bool isActive = false; |
| + static bool updated = false; |
| + static List onUpdated; |
| + |
| + static Process updatingProcess; |
|
Mads Ager (google)
2012/03/12 14:09:20
Make this private?
Bill Hesse
2012/03/12 18:13:35
Done.
|
| + |
| + static void update() { |
| + if (!isActive) { |
| + isActive = true; |
| + print('Updating DumpRenderTree.'); |
| + onUpdated = [() {updated = true;} ]; |
| + updatingProcess = new Process.start('python', [getDrtPath]); |
| + updatingProcess.onExit = onUpdatedHandler; |
| + updatingProcess.onError = (error) { |
| + print("Error starting get_drt.py process: $error"); |
| + onUpdatedHandler(-1); // Continue anyway. |
| + }; |
| + } |
| + } |
| + |
| + static bool componentRequiresDRT(String component) => |
| + const <String>['dartium', |
|
Mads Ager (google)
2012/03/12 14:09:20
return TestUtils.isBrowserComponent(component)?
Bill Hesse
2012/03/12 18:13:35
This is an open question - should these be assumed
|
| + 'chromium', |
| + 'frogium', |
| + 'legium', |
| + 'webdriver'].some((x) => x == component); |
|
vsm
2012/03/12 15:53:21
webdriver shouldn't need DRT. It'll use chrome (o
Bill Hesse
2012/03/12 18:13:35
Done.
|
| + |
| + static String get getDrtPath() { |
|
Mads Ager (google)
2012/03/12 14:09:20
Make this private?
Bill Hesse
2012/03/12 18:13:35
Done.
|
| + String scriptPath = new Options().script.replaceAll('\\', '/'); |
| + String toolsDir = scriptPath.substring(0, scriptPath.lastIndexOf('/')); |
| + return '$toolsDir/get_drt.py'; |
| + } |
| + |
| + static void onUpdatedHandler(int exit_code) { |
|
Mads Ager (google)
2012/03/12 14:09:20
Make this private.
Bill Hesse
2012/03/12 18:13:35
Done.
|
| + // blah blah blah |
|
Bill Hesse
2012/03/12 13:38:32
Remove Bob Loblaw.
Bill Hesse
2012/03/12 18:13:35
Done.
|
| + print('DumpRenderTree updated($exit_code)'); |
|
Mads Ager (google)
2012/03/12 14:09:20
Space between "updated" and "($exit_code)"?
Bill Hesse
2012/03/12 18:13:35
Done.
|
| + for (var callback in onUpdated ) callback(); |
|
Mads Ager (google)
2012/03/12 14:09:20
Remove trailing space after onUpdated.
Bill Hesse
2012/03/12 18:13:35
Done.
|
| + } |
| + |
| +} |