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 10 matching lines...) Expand all Loading... |
21 import '../../util/io.dart'; | 21 import '../../util/io.dart'; |
22 import '../../util/path_handler.dart'; | 22 import '../../util/path_handler.dart'; |
23 import '../../util/one_off_handler.dart'; | 23 import '../../util/one_off_handler.dart'; |
24 import '../../utils.dart'; | 24 import '../../utils.dart'; |
25 import '../application_exception.dart'; | 25 import '../application_exception.dart'; |
26 import '../load_exception.dart'; | 26 import '../load_exception.dart'; |
27 import 'browser.dart'; | 27 import 'browser.dart'; |
28 import 'browser_manager.dart'; | 28 import 'browser_manager.dart'; |
29 import 'compiler_pool.dart'; | 29 import 'compiler_pool.dart'; |
30 import 'chrome.dart'; | 30 import 'chrome.dart'; |
| 31 import 'content_shell.dart'; |
31 import 'dartium.dart'; | 32 import 'dartium.dart'; |
32 import 'content_shell.dart'; | |
33 import 'firefox.dart'; | 33 import 'firefox.dart'; |
| 34 import 'internet_explorer.dart'; |
34 import 'phantom_js.dart'; | 35 import 'phantom_js.dart'; |
35 import 'safari.dart'; | 36 import 'safari.dart'; |
36 | 37 |
37 /// A server that serves JS-compiled tests to browsers. | 38 /// A server that serves JS-compiled tests to browsers. |
38 /// | 39 /// |
39 /// A test suite may be loaded for a given file using [loadSuite]. | 40 /// A test suite may be loaded for a given file using [loadSuite]. |
40 class BrowserServer { | 41 class BrowserServer { |
41 /// Starts the server. | 42 /// Starts the server. |
42 /// | 43 /// |
43 /// [root] is the root directory that the server should serve. It defaults to | 44 /// [root] is the root directory that the server should serve. It defaults to |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 | 383 |
383 /// Starts the browser identified by [browser] and has it load [url]. | 384 /// Starts the browser identified by [browser] and has it load [url]. |
384 Browser _newBrowser(Uri url, TestPlatform browser) { | 385 Browser _newBrowser(Uri url, TestPlatform browser) { |
385 switch (browser) { | 386 switch (browser) { |
386 case TestPlatform.dartium: return new Dartium(url); | 387 case TestPlatform.dartium: return new Dartium(url); |
387 case TestPlatform.contentShell: return new ContentShell(url); | 388 case TestPlatform.contentShell: return new ContentShell(url); |
388 case TestPlatform.chrome: return new Chrome(url); | 389 case TestPlatform.chrome: return new Chrome(url); |
389 case TestPlatform.phantomJS: return new PhantomJS(url); | 390 case TestPlatform.phantomJS: return new PhantomJS(url); |
390 case TestPlatform.firefox: return new Firefox(url); | 391 case TestPlatform.firefox: return new Firefox(url); |
391 case TestPlatform.safari: return new Safari(url); | 392 case TestPlatform.safari: return new Safari(url); |
| 393 case TestPlatform.internetExplorer: return new InternetExplorer(url); |
392 default: | 394 default: |
393 throw new ArgumentError("$browser is not a browser."); | 395 throw new ArgumentError("$browser is not a browser."); |
394 } | 396 } |
395 } | 397 } |
396 | 398 |
397 /// Closes the server and releases all its resources. | 399 /// Closes the server and releases all its resources. |
398 /// | 400 /// |
399 /// Returns a [Future] that completes once the server is closed and its | 401 /// Returns a [Future] that completes once the server is closed and its |
400 /// resources have been fully released. | 402 /// resources have been fully released. |
401 Future close() { | 403 Future close() { |
(...skipping 13 matching lines...) Expand all Loading... |
415 if (_pubServeUrl == null) { | 417 if (_pubServeUrl == null) { |
416 new Directory(_compiledDir).deleteSync(recursive: true); | 418 new Directory(_compiledDir).deleteSync(recursive: true); |
417 } else { | 419 } else { |
418 _http.close(); | 420 _http.close(); |
419 } | 421 } |
420 | 422 |
421 _closeCompleter.complete(); | 423 _closeCompleter.complete(); |
422 }).catchError(_closeCompleter.completeError); | 424 }).catchError(_closeCompleter.completeError); |
423 } | 425 } |
424 } | 426 } |
OLD | NEW |