Index: dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/mobile/MobileLaunchConfigurationDelegate.java |
=================================================================== |
--- dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/mobile/MobileLaunchConfigurationDelegate.java (revision 37301) |
+++ dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/mobile/MobileLaunchConfigurationDelegate.java (working copy) |
@@ -16,6 +16,7 @@ |
import com.google.dart.engine.utilities.instrumentation.InstrumentationBuilder; |
import com.google.dart.tools.core.mobile.AndroidDebugBridge; |
import com.google.dart.tools.core.mobile.AndroidDevice; |
+import com.google.dart.tools.core.mobile.MobileUrlConnectionException; |
import com.google.dart.tools.debug.core.DartDebugCorePlugin; |
import com.google.dart.tools.debug.core.DartLaunchConfigWrapper; |
import com.google.dart.tools.debug.core.DartLaunchConfigurationDelegate; |
@@ -106,9 +107,12 @@ |
try { |
String launchUrl = result.getResult(); |
launchOnMobile(launchUrl, true, new NullProgressMonitor()); |
+ } catch (MobileUrlConnectionException e) { |
+ // DartDebugCorePlugin.logError(e); |
+ DebugUIHelper.getHelper().showError("Dartium Launch Error", e); |
} catch (CoreException e) { |
DartDebugCorePlugin.logError(e); |
- DebugUIHelper.getHelper().showError("Dartium Launch Error", e.getMessage()); |
+ DebugUIHelper.getHelper().showError("Dartium Launch Error", e); |
} |
} |
@@ -230,8 +234,14 @@ |
"Unauthorized device detected.\n\nAuthorize device and try again.")); |
} |
+ if (!devBridge.isHtmlPageAccessible(device, launchUrl).isOK()) { |
+ // pub serve is always localhost over USB while old dev server is always over wifi |
+ boolean localhostOverUsb = usePubServe; |
+ throw new MobileUrlConnectionException(launchUrl, localhostOverUsb); |
+ } |
+ |
if (wrapper.getInstallContentShell()) { |
- if (!devBridge.installContentShellApk(device.getDeviceId())) { |
+ if (!devBridge.installContentShellApk(device)) { |
throw new CoreException(new Status( |
IStatus.ERROR, |
DartDebugCorePlugin.PLUGIN_ID, |
@@ -243,7 +253,12 @@ |
// check if remote connection is alive |
if (!isRemoteConnected()) { |
devBridge.setupPortForwarding(Integer.toString(REMOTE_DEBUG_PORT)); |
- // TODO(keertip): check if host needs to be the ip for wifi connections |
+ // wait for content shell to open to get the tabs to connect |
+ try { |
+ Thread.sleep(500); |
+ } catch (InterruptedException e) { |
+ |
+ } |
performRemoteConnection("localhost", REMOTE_DEBUG_PORT, monitor, usePubServe); |
} |
} |