Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library test.runner.browser.server; | 5 library test.runner.browser.server; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 import '../../util/one_off_handler.dart'; | 22 import '../../util/one_off_handler.dart'; |
| 23 import '../../utils.dart'; | 23 import '../../utils.dart'; |
| 24 import '../load_exception.dart'; | 24 import '../load_exception.dart'; |
| 25 import 'browser.dart'; | 25 import 'browser.dart'; |
| 26 import 'browser_manager.dart'; | 26 import 'browser_manager.dart'; |
| 27 import 'compiler_pool.dart'; | 27 import 'compiler_pool.dart'; |
| 28 import 'chrome.dart'; | 28 import 'chrome.dart'; |
| 29 import 'dartium.dart'; | 29 import 'dartium.dart'; |
| 30 import 'content_shell.dart'; | 30 import 'content_shell.dart'; |
| 31 import 'firefox.dart'; | 31 import 'firefox.dart'; |
| 32 import 'phantom_js.dart'; | 32 import 'phantom_js.dart'; |
|
kevmoo
2015/04/15 22:42:34
import Safari here...
| |
| 33 | 33 |
| 34 /// A server that serves JS-compiled tests to browsers. | 34 /// A server that serves JS-compiled tests to browsers. |
| 35 /// | 35 /// |
| 36 /// A test suite may be loaded for a given file using [loadSuite]. | 36 /// A test suite may be loaded for a given file using [loadSuite]. |
| 37 class BrowserServer { | 37 class BrowserServer { |
| 38 /// Starts the server. | 38 /// Starts the server. |
| 39 /// | 39 /// |
| 40 /// [root] is the root directory that the server should serve. It defaults to | 40 /// [root] is the root directory that the server should serve. It defaults to |
| 41 /// the working directory. | 41 /// the working directory. |
| 42 /// | 42 /// |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 } | 358 } |
| 359 | 359 |
| 360 /// Starts the browser identified by [browser] and has it load [url]. | 360 /// Starts the browser identified by [browser] and has it load [url]. |
| 361 Browser _newBrowser(Uri url, TestPlatform browser) { | 361 Browser _newBrowser(Uri url, TestPlatform browser) { |
| 362 switch (browser) { | 362 switch (browser) { |
| 363 case TestPlatform.dartium: return new Dartium(url); | 363 case TestPlatform.dartium: return new Dartium(url); |
| 364 case TestPlatform.contentShell: return new ContentShell(url); | 364 case TestPlatform.contentShell: return new ContentShell(url); |
| 365 case TestPlatform.chrome: return new Chrome(url); | 365 case TestPlatform.chrome: return new Chrome(url); |
| 366 case TestPlatform.phantomJS: return new PhantomJS(url); | 366 case TestPlatform.phantomJS: return new PhantomJS(url); |
| 367 case TestPlatform.firefox: return new Firefox(url); | 367 case TestPlatform.firefox: return new Firefox(url); |
| 368 case TestPlatform.safari: return new Safari(url); | |
| 368 default: | 369 default: |
| 369 throw new ArgumentError("$browser is not a browser."); | 370 throw new ArgumentError("$browser is not a browser."); |
| 370 } | 371 } |
| 371 } | 372 } |
| 372 | 373 |
| 373 /// Closes the server and releases all its resources. | 374 /// Closes the server and releases all its resources. |
| 374 /// | 375 /// |
| 375 /// Returns a [Future] that completes once the server is closed and its | 376 /// Returns a [Future] that completes once the server is closed and its |
| 376 /// resources have been fully released. | 377 /// resources have been fully released. |
| 377 Future close() { | 378 Future close() { |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 391 if (_pubServeUrl == null) { | 392 if (_pubServeUrl == null) { |
| 392 new Directory(_compiledDir).deleteSync(recursive: true); | 393 new Directory(_compiledDir).deleteSync(recursive: true); |
| 393 } else { | 394 } else { |
| 394 _http.close(); | 395 _http.close(); |
| 395 } | 396 } |
| 396 | 397 |
| 397 _closeCompleter.complete(); | 398 _closeCompleter.complete(); |
| 398 }).catchError(_closeCompleter.completeError); | 399 }).catchError(_closeCompleter.completeError); |
| 399 } | 400 } |
| 400 } | 401 } |
| OLD | NEW |