OLD | NEW |
---|---|
1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2011, 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 | 5 |
6 import os | 6 import os |
7 import platform | 7 import platform |
8 import re | 8 import re |
9 import shutil | 9 import shutil |
10 import subprocess | 10 import subprocess |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
418 return path + '.dartium.html' | 418 return path + '.dartium.html' |
419 | 419 |
420 def GetCompileCommand(self, fatal_static_type_errors=False): | 420 def GetCompileCommand(self, fatal_static_type_errors=False): |
421 fatal_static_type_errors = fatal_static_type_errors # shutup lint! | 421 fatal_static_type_errors = fatal_static_type_errors # shutup lint! |
422 return None | 422 return None |
423 | 423 |
424 def Compile(self): | 424 def Compile(self): |
425 return 0 | 425 return 0 |
426 | 426 |
427 | 427 |
428 class WebDriverArchiecture(FrogChromiumArchitecture): | 428 class WebDriverArchitecture(FrogChromiumArchitecture): |
429 """Architecture that runs compiled dart->JS (via frog) through a variety of | 429 """Architecture that runs compiled dart->JS (via frog) through a variety of |
430 real browsers using WebDriver.""" | 430 real browsers using WebDriver.""" |
431 | 431 |
432 def __init__(self, root_path, arch, mode, component, test): | 432 def __init__(self, root_path, arch, mode, component, test, browser='chrome'): |
433 super(WebDriverArchiecture, self).__init__(root_path, arch, mode, | 433 super(WebDriverArchitecture, self).__init__(root_path, arch, mode, |
434 component, test) | 434 component, test) |
435 self.browser = browser | |
435 | 436 |
436 def GetRunCommand(self, fatal_static_type_errors=False): | 437 def GetRunCommand(self, fatal_static_type_errors=False): |
437 """Returns a command line to execute for the test.""" | 438 """Returns a command line to execute for the test.""" |
438 selenium_location = os.path.join(self.root_path, 'tools', 'testing', | 439 selenium_location = os.path.join(self.root_path, 'tools', 'testing', |
439 'run_selenium.py') | 440 'run_selenium.py') |
440 | 441 |
441 html_output_file = os.path.join(self.GetHtmlPath(), self.GetHtmlName()) | 442 html_output_file = os.path.join(self.GetHtmlPath(), self.GetHtmlName()) |
442 f = open(html_output_file, 'w') | 443 f = open(html_output_file, 'w') |
443 f.write(self.GetHtmlContents()) | 444 f.write(self.GetHtmlContents()) |
444 f.close() | 445 f.close() |
445 return [selenium_location, html_output_file] | 446 return [selenium_location, html_output_file, self.browser] |
446 | 447 |
447 | 448 |
448 class StandaloneArchitecture(Architecture): | 449 class StandaloneArchitecture(Architecture): |
449 """Base class for architectures that run tests without a browser.""" | 450 """Base class for architectures that run tests without a browser.""" |
450 | 451 |
451 def __init__(self, root_path, arch, mode, component, test): | 452 def __init__(self, root_path, arch, mode, component, test): |
452 super(StandaloneArchitecture, self).__init__(root_path, arch, mode, componen t, | 453 super(StandaloneArchitecture, self).__init__(root_path, arch, mode, componen t, |
453 test) | 454 test) |
454 | 455 |
455 def GetExecutable(self): | 456 def GetExecutable(self): |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
533 print err | 534 print err |
534 return pipe.returncode, output, err | 535 return pipe.returncode, output, err |
535 | 536 |
536 | 537 |
537 def ExecuteCommand(cmd, verbose=False): | 538 def ExecuteCommand(cmd, verbose=False): |
538 """Execute a command in a subprocess.""" | 539 """Execute a command in a subprocess.""" |
539 if verbose: print 'Executing: ' + ' '.join(cmd) | 540 if verbose: print 'Executing: ' + ' '.join(cmd) |
540 return subprocess.call(cmd) | 541 return subprocess.call(cmd) |
541 | 542 |
542 | 543 |
543 def GetArchitecture(arch, mode, component, test): | 544 def GetArchitecture(arch, mode, component, test, flags): |
Siggi Cherem (dart-lang)
2011/11/15 02:16:18
One suggestion: we might be able to do this withou
| |
544 root_path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..')) | 545 root_path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..')) |
545 if component == 'chromium': | 546 if component == 'chromium': |
546 return DartcChromiumArchitecture(root_path, arch, mode, component, test) | 547 return DartcChromiumArchitecture(root_path, arch, mode, component, test) |
547 | 548 |
548 elif component == 'dartium': | 549 elif component == 'dartium': |
549 return DartiumArchitecture(root_path, arch, mode, component, test) | 550 return DartiumArchitecture(root_path, arch, mode, component, test) |
550 | 551 |
551 elif component == 'frogium': | 552 elif component == 'frogium': |
552 return FrogChromiumArchitecture(root_path, arch, mode, component, test) | 553 return FrogChromiumArchitecture(root_path, arch, mode, component, test) |
553 | 554 |
554 elif component == 'webdriver': | 555 elif component == 'webdriver': |
555 return WebDriverArchiecture(root_path, arch, mode, component, test) | 556 browser_flag = 'chrome' |
557 if 'ff' in flags or 'firefox' in flags: | |
558 browser_flag = 'ff' | |
559 elif 'ie' in flags or 'explorer' in flags or 'internet-explorer' in flags: | |
560 browser_flag = 'ie' | |
561 return WebDriverArchitecture(root_path, arch, mode, component, test, | |
562 browser=browser_flag) | |
556 | 563 |
557 elif component in ['vm', 'frog', 'frogsh']: | 564 elif component in ['vm', 'frog', 'frogsh']: |
558 return StandaloneArchitecture(root_path, arch, mode, component, test) | 565 return StandaloneArchitecture(root_path, arch, mode, component, test) |
559 | 566 |
560 elif component == 'leg': | 567 elif component == 'leg': |
561 return LegArchitecture(root_path, arch, mode, component, test) | 568 return LegArchitecture(root_path, arch, mode, component, test) |
562 | 569 |
563 elif component == 'dartc': | 570 elif component == 'dartc': |
564 return DartcArchitecture(root_path, arch, mode, component, test) | 571 return DartcArchitecture(root_path, arch, mode, component, test) |
OLD | NEW |