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 13 matching lines...) Expand all Loading... |
24 import '../../utils.dart'; | 24 import '../../utils.dart'; |
25 import '../load_exception.dart'; | 25 import '../load_exception.dart'; |
26 import 'browser.dart'; | 26 import 'browser.dart'; |
27 import 'browser_manager.dart'; | 27 import 'browser_manager.dart'; |
28 import 'compiler_pool.dart'; | 28 import 'compiler_pool.dart'; |
29 import 'chrome.dart'; | 29 import 'chrome.dart'; |
30 import 'dartium.dart'; | 30 import 'dartium.dart'; |
31 import 'content_shell.dart'; | 31 import 'content_shell.dart'; |
32 import 'firefox.dart'; | 32 import 'firefox.dart'; |
33 import 'phantom_js.dart'; | 33 import 'phantom_js.dart'; |
| 34 import 'safari.dart'; |
34 | 35 |
35 /// A server that serves JS-compiled tests to browsers. | 36 /// A server that serves JS-compiled tests to browsers. |
36 /// | 37 /// |
37 /// A test suite may be loaded for a given file using [loadSuite]. | 38 /// A test suite may be loaded for a given file using [loadSuite]. |
38 class BrowserServer { | 39 class BrowserServer { |
39 /// Starts the server. | 40 /// Starts the server. |
40 /// | 41 /// |
41 /// [root] is the root directory that the server should serve. It defaults to | 42 /// [root] is the root directory that the server should serve. It defaults to |
42 /// the working directory. | 43 /// the working directory. |
43 /// | 44 /// |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 } | 361 } |
361 | 362 |
362 /// Starts the browser identified by [browser] and has it load [url]. | 363 /// Starts the browser identified by [browser] and has it load [url]. |
363 Browser _newBrowser(Uri url, TestPlatform browser) { | 364 Browser _newBrowser(Uri url, TestPlatform browser) { |
364 switch (browser) { | 365 switch (browser) { |
365 case TestPlatform.dartium: return new Dartium(url); | 366 case TestPlatform.dartium: return new Dartium(url); |
366 case TestPlatform.contentShell: return new ContentShell(url); | 367 case TestPlatform.contentShell: return new ContentShell(url); |
367 case TestPlatform.chrome: return new Chrome(url); | 368 case TestPlatform.chrome: return new Chrome(url); |
368 case TestPlatform.phantomJS: return new PhantomJS(url); | 369 case TestPlatform.phantomJS: return new PhantomJS(url); |
369 case TestPlatform.firefox: return new Firefox(url); | 370 case TestPlatform.firefox: return new Firefox(url); |
| 371 case TestPlatform.safari: return new Safari(url); |
370 default: | 372 default: |
371 throw new ArgumentError("$browser is not a browser."); | 373 throw new ArgumentError("$browser is not a browser."); |
372 } | 374 } |
373 } | 375 } |
374 | 376 |
375 /// Closes the server and releases all its resources. | 377 /// Closes the server and releases all its resources. |
376 /// | 378 /// |
377 /// Returns a [Future] that completes once the server is closed and its | 379 /// Returns a [Future] that completes once the server is closed and its |
378 /// resources have been fully released. | 380 /// resources have been fully released. |
379 Future close() { | 381 Future close() { |
(...skipping 13 matching lines...) Expand all Loading... |
393 if (_pubServeUrl == null) { | 395 if (_pubServeUrl == null) { |
394 new Directory(_compiledDir).deleteSync(recursive: true); | 396 new Directory(_compiledDir).deleteSync(recursive: true); |
395 } else { | 397 } else { |
396 _http.close(); | 398 _http.close(); |
397 } | 399 } |
398 | 400 |
399 _closeCompleter.complete(); | 401 _closeCompleter.complete(); |
400 }).catchError(_closeCompleter.completeError); | 402 }).catchError(_closeCompleter.completeError); |
401 } | 403 } |
402 } | 404 } |
OLD | NEW |