Repository: flutter
Issue: WebFlutterDriver.requestData command doesn't work with JSON string input
Labels: t: flutter driver,platform-web,P3,team-web,triaged-web

## Steps to Reproduce
1. Add logging (`print(message);`) to `flutter/packages/flutter_driver/lib/src/extension/_extension_web.dart#registerWebServiceExtension` so you can monitor incoming flutter_driver commands in browser console.
2. In flutter_driver **(web)** test use `await driver.requestData(jsonEncode(command));` where command is a map. It will send stringified JSON command to app.

**Expected results:**
Request JSON string is escaped correctly in `request_data` command `message` and can be parsed successfully.

**Actual results:** <!-- what did you see? -->
Request JSON is broken (double quoation marks not escaped), for example: `{"command":"request_data","message":"{"command":"setDataItem","objectId":"Element223","value":2}"}`. It should be like this instead: `{"command":"request_data","message":"{\"command\":\"setDataItem\",\"objectId\":\"Element223\",\"value\":2}"}`.
Exception such as `FormatException: SyntaxError: Unexpected token c in JSON at position 39` is thrown in `_extension_web.dart:25`

## Additional information
Exactly same (JSON encoded) `request_data` messages are working with mobile FlutterDriver.

## Work-around
Do replacements explicitly if using WebFlutterDriver:
```
String _prepareJsonCommand(Map<String, dynamic> command) {
  if (Platform.environment['FLUTTER_WEB_TEST'] != null) {
    return jsonEncode(command).replaceAll('"', '\\"');
  }
  return jsonEncode(command);
}
```

<details>
  <summary>flutter doctor -v</summary>

```
[✓] Flutter (Channel unknown, 1.22.2, on Mac OS X 10.15.6 19G2021, locale en-EE)
    • Flutter version 1.22.2 at /Users/siim/git/flutter
    • Framework revision 84f3d28555 (6 weeks ago), 2020-10-15 16:26:19 -0700
    • Engine revision b8752bbfff
    • Dart version 2.10.2

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/siim/Library/Android/sdk
    • Platform android-30, build-tools 29.0.2
    • ANDROID_HOME = /Users/siim/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

 
[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0.1, Build version 12A7300
    • CocoaPods version 1.9.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[!] IntelliJ IDEA Community Edition (version 2020.2.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[✓] Connected device (2 available)
    • Web Server (web) • web-server • web-javascript • Flutter Tools
    • Chrome (web)     • chrome     • web-javascript • Google Chrome 86.0.4240.198
    ! Error: Siim’s iPhone is not connected. Xcode will continue when Siim’s iPhone is connected. (code -13)

! Doctor found issues in 2 categories.
```

</details>