Chromium Code Reviews| Index: tools/testing/dart/browser_controller.dart |
| =================================================================== |
| --- tools/testing/dart/browser_controller.dart (revision 23276) |
| +++ tools/testing/dart/browser_controller.dart (working copy) |
| @@ -198,6 +198,22 @@ |
| */ |
| const String versionFile = "/Applications/Safari.app/Contents/version.plist"; |
| + |
| + Future<bool> allowPopUps() { |
| + var command = "defaults"; |
| + var args = ["write", "com.apple.safari", |
| + "com.apple.Safari.ContentPageGroupIdentifier." // No , |
|
kustermann
2013/05/28 15:07:52
What is this "// no," ?
|
| + "WebKit2JavaScriptCanOpenWindowsAutomatically", |
| + "1"]; |
| + return Process.run(command, args).then((result) { |
| + if (result.exitCode != 0) { |
| + _logEvent("Could not disable pop-up blocking for safari"); |
| + return false; |
| + } |
| + return true; |
| + }); |
| + } |
| + |
| Future<String> getVersion() { |
| /** |
| * Example of the file: |
| @@ -242,18 +258,23 @@ |
| Future<bool> start(String url) { |
| _logEvent("Starting Safari browser on: $url"); |
| // Get the version and log that. |
| - return getVersion().then((version) { |
| - _logEvent("Got version: $version"); |
| - var args = ["'$url'"]; |
| - return new Directory('').createTemp().then((userDir) { |
| - _cleanup = () { userDir.delete(recursive: true); }; |
| - _createLaunchHTML(userDir.path, url); |
| - var args = ["${userDir.path}/launch.html"]; |
| - return startBrowser(binary, args); |
| + return allowPopUps().then((success) { |
| + if (!success) { |
| + return new Future.immediate(false); |
| + } |
| + return .getVersion().then((version) { |
| + _logEvent("Got version: $version"); |
| + var args = ["'$url'"]; |
| + return new Directory('').createTemp().then((userDir) { |
| + _cleanup = () { userDir.delete(recursive: true); }; |
| + _createLaunchHTML(userDir.path, url); |
| + var args = ["${userDir.path}/launch.html"]; |
| + return startBrowser(binary, args); |
| + }); |
| + }).catchError((e) { |
| + _logEvent("Running $binary --version failed with $e"); |
| + return false; |
| }); |
| - }).catchError((e) { |
| - _logEvent("Running $binary --version failed with $e"); |
| - return false; |
| }); |
| } |