OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library browser; | 4 library browser; |
5 | 5 |
6 import "dart:async"; | 6 import "dart:async"; |
7 import "dart:convert" show UTF8, JSON; | 7 import "dart:convert" show UTF8, JSON; |
8 import "dart:core"; | 8 import "dart:core"; |
9 import "dart:io"; | 9 import "dart:io"; |
10 import "dart:math" show min; | 10 import "dart:math" show min; |
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1900 final String date = | 1900 final String date = |
1901 new DateTime.now().toUtc().toIso8601String().replaceAll(':', '_'); | 1901 new DateTime.now().toUtc().toIso8601String().replaceAll(':', '_'); |
1902 final screenshotName = 'ie_screenshot_${date}.png'; | 1902 final screenshotName = 'ie_screenshot_${date}.png'; |
1903 | 1903 |
1904 // The "capture_screen.ps1" script is next to "test.dart" in "tools/" | 1904 // The "capture_screen.ps1" script is next to "test.dart" in "tools/" |
1905 final powerShellScript = | 1905 final powerShellScript = |
1906 Platform.script.resolve('capture_screenshot.ps1').toFilePath(); | 1906 Platform.script.resolve('capture_screenshot.ps1').toFilePath(); |
1907 final screenshotFile = | 1907 final screenshotFile = |
1908 Platform.script.resolve('../$screenshotName').toFilePath(); | 1908 Platform.script.resolve('../$screenshotName').toFilePath(); |
1909 | 1909 |
1910 final args = [powerShellScript, screenshotFile]; | 1910 final args = [ |
1911 '-ExecutionPolicy', | |
1912 'ByPass', | |
1913 '-File ', | |
ricow1
2017/04/12 10:25:42
nit: remove space after -File?
kustermann
2017/04/12 10:27:00
Done.
| |
1914 powerShellScript, | |
1915 screenshotFile | |
1916 ]; | |
1911 final ProcessResult result = | 1917 final ProcessResult result = |
1912 await Process.run('powershell.exe', args, runInShell: true); | 1918 await Process.run('powershell.exe', args, runInShell: true); |
1913 if (result.exitCode != 0) { | 1919 if (result.exitCode != 0) { |
1914 print('[$message] Failed to capture IE screenshot on windows: ' | 1920 print('[$message] Failed to capture IE screenshot on windows: ' |
1915 'powershell.exe "${args.join(' ')}" returned with:\n' | 1921 'powershell.exe "${args.join(' ')}" returned with:\n' |
1916 'exit code: ${result.exitCode}\n' | 1922 'exit code: ${result.exitCode}\n' |
1917 'stdout: ${result.stdout}\n' | 1923 'stdout: ${result.stdout}\n' |
1918 'stderr: ${result.stderr}'); | 1924 'stderr: ${result.stderr}'); |
1919 } else { | 1925 } else { |
1920 final storageUrl = 'gs://dart-temp-crash-archive/$screenshotName'; | 1926 final storageUrl = 'gs://dart-temp-crash-archive/$screenshotName'; |
(...skipping 10 matching lines...) Expand all Loading... | |
1931 'exit code: ${result.exitCode}\n' | 1937 'exit code: ${result.exitCode}\n' |
1932 'stdout: ${result.stdout}\n' | 1938 'stdout: ${result.stdout}\n' |
1933 'stderr: ${result.stderr}'); | 1939 'stderr: ${result.stderr}'); |
1934 } else { | 1940 } else { |
1935 print('[$message] Successfully uploaded screenshot to $storageUrl'); | 1941 print('[$message] Successfully uploaded screenshot to $storageUrl'); |
1936 } | 1942 } |
1937 new File(screenshotFile).deleteSync(); | 1943 new File(screenshotFile).deleteSync(); |
1938 } | 1944 } |
1939 print('--------------------------------------------------------------------'); | 1945 print('--------------------------------------------------------------------'); |
1940 } | 1946 } |
OLD | NEW |