[vm/service] Fix service/bad_reload_test

The test was incorrectly assuming the format of response for the
failed hot-reload and that expression evaluation can be performed
on top of the failed hot reload.

Fixes https://github.com/dart-lang/sdk/issues/44976
Fixes https://github.com/dart-lang/sdk/issues/43514

TEST=service/bad_reload_test
Change-Id: Iac9109371e2bc0b89e7c26ab008e0a174ecb754a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196984
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
diff --git a/runtime/observatory/tests/service/bad_reload_test.dart b/runtime/observatory/tests/service/bad_reload_test.dart
index eb40b71..3825f85 100644
--- a/runtime/observatory/tests/service/bad_reload_test.dart
+++ b/runtime/observatory/tests/service/bad_reload_test.dart
@@ -2,6 +2,9 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
+// OtherResources=bad_reload/v1/main.dart
+// OtherResources=bad_reload/v2/main.dart
+
 import 'test_helper.dart';
 import 'dart:async';
 import 'dart:developer';
@@ -37,6 +40,14 @@
   return result.valueAsString as String;
 }
 
+Future<void> invokeTestWithError(Isolate isolate) async {
+  await isolate.reload();
+  Library lib = isolate.rootLibrary;
+  await lib.load();
+  final result = await lib.evaluate('test()');
+  expect(result.isError, isTrue);
+}
+
 var tests = <IsolateTest>[
   // Stopped at 'debugger' statement.
   hasStoppedAtBreakpoint,
@@ -65,14 +76,13 @@
     );
     // Observe that it failed.
     expect(response['success'], isFalse);
-    List notices = response['details']['notices'];
+    List notices = response['notices'];
     expect(notices.length, equals(1));
     Map<String, dynamic> reasonForCancelling = notices[0];
     expect(reasonForCancelling['type'], equals('ReasonForCancelling'));
     expect(reasonForCancelling['message'], contains('library_isnt_here_man'));
 
-    String v2 = await invokeTest(spawnedIsolate);
-    expect(v2, 'apple');
+    await invokeTestWithError(spawnedIsolate);
   }
 ];
 
diff --git a/runtime/observatory/tests/service/service_kernel.status b/runtime/observatory/tests/service/service_kernel.status
index a06ae74..62bdfcc 100644
--- a/runtime/observatory/tests/service/service_kernel.status
+++ b/runtime/observatory/tests/service/service_kernel.status
@@ -7,7 +7,6 @@
 [ $compiler == app_jitk ]
 add_breakpoint_rpc_kernel_test: SkipByDesign # No incremental compiler available.
 async_generator_breakpoint_test: SkipByDesign # No incremental compiler available.
-bad_reload_test: RuntimeError
 break_on_activation_test: SkipByDesign # No incremental compiler available.
 complex_reload_test: RuntimeError
 debugger_inspect_test: SkipByDesign # No incremental compiler available.
@@ -24,7 +23,6 @@
 sigquit_starts_service_test: SkipByDesign # Spawns a secondary process using Platform.executable.
 
 [ $compiler == dartk ]
-bad_reload_test: RuntimeError # Issue 34025
 coverage_optimized_function_test: Pass, Slow
 evaluate_activation_test/instance: RuntimeError # http://dartbug.com/20047
 evaluate_activation_test/scope: RuntimeError # http://dartbug.com/20047
diff --git a/runtime/observatory_2/tests/service_2/bad_reload_test.dart b/runtime/observatory_2/tests/service_2/bad_reload_test.dart
index 1aad2dc..0dab172 100644
--- a/runtime/observatory_2/tests/service_2/bad_reload_test.dart
+++ b/runtime/observatory_2/tests/service_2/bad_reload_test.dart
@@ -2,6 +2,9 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
+// OtherResources=bad_reload/v1/main.dart
+// OtherResources=bad_reload/v2/main.dart
+
 import 'test_helper.dart';
 import 'dart:async';
 import 'dart:developer';
@@ -37,6 +40,14 @@
   return result.valueAsString;
 }
 
+Future<void> invokeTestWithError(Isolate isolate) async {
+  await isolate.reload();
+  Library lib = isolate.rootLibrary;
+  await lib.load();
+  final result = await lib.evaluate('test()');
+  expect(result.isError, isTrue);
+}
+
 var tests = <IsolateTest>[
   // Stopped at 'debugger' statement.
   hasStoppedAtBreakpoint,
@@ -65,14 +76,13 @@
     );
     // Observe that it failed.
     expect(response['success'], isFalse);
-    List notices = response['details']['notices'];
+    List notices = response['notices'];
     expect(notices.length, equals(1));
     Map<String, dynamic> reasonForCancelling = notices[0];
     expect(reasonForCancelling['type'], equals('ReasonForCancelling'));
     expect(reasonForCancelling['message'], contains('library_isnt_here_man'));
 
-    String v2 = await invokeTest(spawnedIsolate);
-    expect(v2, 'apple');
+    await invokeTestWithError(spawnedIsolate);
   }
 ];
 
diff --git a/runtime/observatory_2/tests/service_2/service_2_kernel.status b/runtime/observatory_2/tests/service_2/service_2_kernel.status
index a06ae74..62bdfcc 100644
--- a/runtime/observatory_2/tests/service_2/service_2_kernel.status
+++ b/runtime/observatory_2/tests/service_2/service_2_kernel.status
@@ -7,7 +7,6 @@
 [ $compiler == app_jitk ]
 add_breakpoint_rpc_kernel_test: SkipByDesign # No incremental compiler available.
 async_generator_breakpoint_test: SkipByDesign # No incremental compiler available.
-bad_reload_test: RuntimeError
 break_on_activation_test: SkipByDesign # No incremental compiler available.
 complex_reload_test: RuntimeError
 debugger_inspect_test: SkipByDesign # No incremental compiler available.
@@ -24,7 +23,6 @@
 sigquit_starts_service_test: SkipByDesign # Spawns a secondary process using Platform.executable.
 
 [ $compiler == dartk ]
-bad_reload_test: RuntimeError # Issue 34025
 coverage_optimized_function_test: Pass, Slow
 evaluate_activation_test/instance: RuntimeError # http://dartbug.com/20047
 evaluate_activation_test/scope: RuntimeError # http://dartbug.com/20047