[e2e][dart][sl4f][sdk] Moving Dart SL4F client to SDK

DX-1315 #comment

This moves //src/testing/sl4f/client to //sdk/testing/sl4f/client. A redirect
is left in //src... to soften the transition.

Test: Changed a dependent to depend on //sdk/testing/sl4f/client, and not
Change-Id: I548dbe7abe6db6924ef93c7284634f97bf9946cf
diff --git a/scripts/dart/update_3p_packages.py b/scripts/dart/update_3p_packages.py
index f2eb55c..0649c78 100755
--- a/scripts/dart/update_3p_packages.py
+++ b/scripts/dart/update_3p_packages.py
@@ -28,7 +28,7 @@
 # These are the locations of yaml files listing the Dart dependencies of a git
 # project.
 PROJECT_DEPENDENCIES = [
-    'src/testing/sl4f/client',
+    'sdk/testing/sl4f/client',
     'topaz/public/dart/widgets',
     'topaz/public/lib',
     'topaz/tools',
diff --git a/sdk/testing/BUILD.gn b/sdk/testing/BUILD.gn
new file mode 100644
index 0000000..1332926a
--- /dev/null
+++ b/sdk/testing/BUILD.gn
@@ -0,0 +1,17 @@
+# Copyright 2019 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+group("testing") {
+  testonly = true
+  deps = [
+    ":tests",
+    "sl4f",
+  ]
+}
+
+group("tests") {
+  testonly = true
+
+  data_deps = []
+}
diff --git a/sdk/testing/sl4f/BUILD.gn b/sdk/testing/sl4f/BUILD.gn
new file mode 100644
index 0000000..0b7b054
--- /dev/null
+++ b/sdk/testing/sl4f/BUILD.gn
@@ -0,0 +1,10 @@
+# Copyright 2019 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+group("sl4f") {
+  testonly = true
+  deps = [
+    "client",
+  ]
+}
diff --git a/sdk/testing/sl4f/client/BUILD.gn b/sdk/testing/sl4f/client/BUILD.gn
new file mode 100644
index 0000000..d951e13
--- /dev/null
+++ b/sdk/testing/sl4f/client/BUILD.gn
@@ -0,0 +1,23 @@
+# Copyright 2019 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/dart/dart_library.gni")
+
+dart_library("client") {
+  package_name = "sl4f"
+
+  sources = [
+    "sl4f.dart",
+    "src/audio.dart",
+    "src/dump.dart",
+    "src/exceptions.dart",
+    "src/scenic.dart",
+    "src/sl4f_client.dart",
+  ]
+
+  deps = [
+    "//third_party/dart-pkg/pub/http",
+    "//third_party/dart-pkg/pub/image",
+  ]
+}
diff --git a/sdk/testing/sl4f/client/OWNERS b/sdk/testing/sl4f/client/OWNERS
new file mode 100644
index 0000000..b337e34
--- /dev/null
+++ b/sdk/testing/sl4f/client/OWNERS
@@ -0,0 +1,3 @@
+isma@google.com
+perley@google.com
+rosswang@google.com
\ No newline at end of file
diff --git a/sdk/testing/sl4f/client/analysis_options.yaml b/sdk/testing/sl4f/client/analysis_options.yaml
new file mode 100644
index 0000000..ece9960
--- /dev/null
+++ b/sdk/testing/sl4f/client/analysis_options.yaml
@@ -0,0 +1,150 @@
+# Copyright 2019 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This is a copy of //topaz/tools/analysis_options.yaml; we should revisit
+# importing this instead after the flower shuffle.
+
+analyzer:
+  language:
+    enableSuperMixins: true
+  exclude:
+    - '**/generated/**'
+linter:
+  # Full list available at http://dart-lang.github.io/linter/lints/options/options.html.
+  rules:
+    - always_declare_return_types
+    - always_put_control_body_on_new_line
+    - always_put_required_named_parameters_first
+    - always_require_non_null_named_parameters
+    # No longer useful with Dart 2.
+    # - always_specify_types
+    - annotate_overrides
+    # Actively discouraged with Dart 2.
+    # - avoid_annotating_with_dynamic
+    - avoid_as
+    - avoid_bool_literals_in_conditional_expressions
+    - avoid_catches_without_on_clauses
+    - avoid_catching_errors
+    - avoid_classes_with_only_static_members
+    # JS only.
+    # - avoid_double_and_int_checks
+    - avoid_empty_else
+    # Not compatible with VS Code yet.
+    # - avoid_field_initializers_in_const_classes
+    - avoid_function_literals_in_foreach_calls
+    - avoid_init_to_null
+    # JS only.
+    # - avoid_js_rounded_ints
+    - avoid_null_checks_in_equality_operators
+    - avoid_positional_boolean_parameters
+    - avoid_private_typedef_functions
+    - avoid_relative_lib_imports
+    # This puts an unnecessary burden on API clients.
+    # - avoid_renaming_method_parameters
+    - avoid_return_types_on_setters
+    - avoid_returning_null
+    - avoid_returning_this
+    - avoid_single_cascade_in_expression_statements
+    # Conflicts with our dependency injection convention.
+    # - avoid_setters_without_getters
+    - avoid_slow_async_io
+    - avoid_types_as_parameter_names
+    # Not requiring this yet as it requires extensive changes to code base.
+    # - avoid_types_on_closure_parameters
+    - avoid_unused_constructor_parameters
+    - await_only_futures
+    - camel_case_types
+    - cancel_subscriptions
+    - cascade_invocations
+    - close_sinks
+    - constant_identifier_names
+    - control_flow_in_finally
+    - directives_ordering
+    - empty_catches
+    - empty_constructor_bodies
+    - empty_statements
+    - hash_and_equals
+    - implementation_imports
+    - invariant_booleans
+    - iterable_contains_unrelated_type
+    - join_return_with_assignment
+    - library_names
+    - library_prefixes
+    - list_remove_unrelated_type
+    - literal_only_boolean_expressions
+    - no_adjacent_strings_in_list
+    - no_duplicate_case_values
+    - non_constant_identifier_names
+    # Not requiring this yet as it requires extensive changes to code base.
+    # - omit_local_variable_types
+    - one_member_abstracts
+    - only_throw_errors
+    - overridden_fields
+    - package_api_docs
+    - package_names
+    - package_prefixed_library_names
+    - parameter_assignments
+    - prefer_adjacent_string_concatenation
+    - prefer_asserts_in_initializer_lists
+    - prefer_bool_in_asserts
+    - prefer_collection_literals
+    - prefer_conditional_assignment
+    # Disabled until bug is fixed
+    # https://github.com/dart-lang/linter/issues/995
+    # - prefer_const_constructors
+    - prefer_const_constructors_in_immutables
+    - prefer_const_declarations
+    # Disabled until bug is fixed
+    # https://github.com/dart-lang/linter/issues/995
+    # - prefer_const_literals_to_create_immutables
+    - prefer_constructors_over_static_methods
+    - prefer_contains
+    - prefer_equal_for_default_values
+    # Add this when 'short' is better defined.
+    # - prefer_expression_function_bodies
+    - prefer_final_fields
+    # The cruft/value ratio of this rule seems low.
+    # - prefer_final_locals
+    - prefer_foreach
+    - prefer_function_declarations_over_variables
+    - prefer_generic_function_type_aliases
+    - prefer_initializing_formals
+    - prefer_interpolation_to_compose_strings
+    - prefer_is_empty
+    - prefer_is_not_empty
+    - prefer_iterable_whereType
+    - prefer_single_quotes
+    - prefer_typing_uninitialized_variables
+    # This seems to create some cruft.
+    # Disable and evaluate if this is causing underdocumentation
+    # - public_member_api_docs
+    - recursive_getters
+    - slash_for_doc_comments
+    # Topaz codebase places fields before constructors
+    # - sort_constructors_first
+    - sort_unnamed_constructors_first
+    - super_goes_last
+    - test_types_in_equals
+    - throw_in_finally
+    - type_annotate_public_apis
+    - type_init_formals
+    - unawaited_futures
+    - unnecessary_brace_in_string_interps
+    - unnecessary_getters_setters
+    - unnecessary_lambdas
+    - unnecessary_null_aware_assignments
+    - unnecessary_null_in_if_null_operators
+    - unnecessary_overrides
+    # Turn on when https://github.com/dart-lang/linter/issues/997 is in flutter's version of dart.
+    # - unnecessary_parenthesis
+    - unnecessary_statements
+    - unnecessary_this
+    - unrelated_type_equality_checks
+    - use_rethrow_when_possible
+    - use_setters_to_change_properties
+    - use_string_buffers
+    - use_to_and_as_if_applicable
+    - valid_regexps
+    # Not compatible with VS Code yet.
+    # - void_checks
diff --git a/src/testing/sl4f/client/dart_dependencies.yaml b/sdk/testing/sl4f/client/dart_dependencies.yaml
similarity index 100%
rename from src/testing/sl4f/client/dart_dependencies.yaml
rename to sdk/testing/sl4f/client/dart_dependencies.yaml
diff --git a/src/testing/sl4f/client/lib/sl4f.dart b/sdk/testing/sl4f/client/lib/sl4f.dart
similarity index 100%
rename from src/testing/sl4f/client/lib/sl4f.dart
rename to sdk/testing/sl4f/client/lib/sl4f.dart
diff --git a/src/testing/sl4f/client/lib/src/audio.dart b/sdk/testing/sl4f/client/lib/src/audio.dart
similarity index 95%
rename from src/testing/sl4f/client/lib/src/audio.dart
rename to sdk/testing/sl4f/client/lib/src/audio.dart
index cdc1c59..089a1888 100644
--- a/src/testing/sl4f/client/lib/src/audio.dart
+++ b/sdk/testing/sl4f/client/lib/src/audio.dart
@@ -12,9 +12,9 @@
   final Sl4f _sl4f;
   final Dump _dump;
 
-  Audio([Sl4f sl4f, Dump dump]) :
-      _sl4f = sl4f ?? Sl4f.fromEnvironment(),
-      _dump = dump ?? Dump();
+  Audio([Sl4f sl4f, Dump dump])
+      : _sl4f = sl4f ?? Sl4f.fromEnvironment(),
+        _dump = dump ?? Dump();
 
   /// Closes the underlying HTTP client. This need not be called if the
   /// Sl4f client is closed instead.
diff --git a/src/testing/sl4f/client/lib/src/dump.dart b/sdk/testing/sl4f/client/lib/src/dump.dart
similarity index 76%
rename from src/testing/sl4f/client/lib/src/dump.dart
rename to sdk/testing/sl4f/client/lib/src/dump.dart
index 4e48cbc..df8e748 100644
--- a/src/testing/sl4f/client/lib/src/dump.dart
+++ b/sdk/testing/sl4f/client/lib/src/dump.dart
@@ -33,20 +33,22 @@
   ///
   /// To easily supply a path relative to the current working directory
   /// on the command line, use $(pwd).
-  Dump([String dumpDirectory]) : _dumpDirectory =
-      _notEmptyString(dumpDirectory) ? dumpDirectory :
-      Platform.environment[_dumpDirectoryEnvVar] {
-        if (_hasDumpDirectory) {
-          // See explanation above. Relative path would be ambiguous.
-          if (!_dumpDirectory.startsWith('/')) {
-            throw ArgumentError.value(_dumpDirectory, 'Must be absolute path');
-          }
+  Dump([String dumpDirectory])
+      : _dumpDirectory = _notEmptyString(dumpDirectory)
+            ? dumpDirectory
+            : Platform.environment[_dumpDirectoryEnvVar] {
+    if (_hasDumpDirectory) {
+      // See explanation above. Relative path would be ambiguous.
+      if (!_dumpDirectory.startsWith('/')) {
+        throw ArgumentError.value(_dumpDirectory, 'Must be absolute path');
+      }
 
-          // Has to be sync because this is a constructor.
-          if (!Directory(_dumpDirectory).existsSync()) {
-            throw FileSystemException('Not found or not a directory', _dumpDirectory);
-          }
-        }
+      // Has to be sync because this is a constructor.
+      if (!Directory(_dumpDirectory).existsSync()) {
+        throw FileSystemException(
+            'Not found or not a directory', _dumpDirectory);
+      }
+    }
   }
 
   /// Writes the bytes to the dump directory under a timestamp, the
@@ -63,5 +65,6 @@
 
   bool get _hasDumpDirectory => _notEmptyString(_dumpDirectory);
 
-  static bool _notEmptyString(final String value) => value != null && value.isNotEmpty;
+  static bool _notEmptyString(final String value) =>
+      value != null && value.isNotEmpty;
 }
diff --git a/src/testing/sl4f/client/lib/src/exceptions.dart b/sdk/testing/sl4f/client/lib/src/exceptions.dart
similarity index 100%
rename from src/testing/sl4f/client/lib/src/exceptions.dart
rename to sdk/testing/sl4f/client/lib/src/exceptions.dart
diff --git a/src/testing/sl4f/client/lib/src/scenic.dart b/sdk/testing/sl4f/client/lib/src/scenic.dart
similarity index 93%
rename from src/testing/sl4f/client/lib/src/scenic.dart
rename to sdk/testing/sl4f/client/lib/src/scenic.dart
index 0a90c56..285909b 100644
--- a/src/testing/sl4f/client/lib/src/scenic.dart
+++ b/sdk/testing/sl4f/client/lib/src/scenic.dart
@@ -18,9 +18,9 @@
   ///
   /// It can optionally take an [Sl4f] object, if not passed, one will be
   /// created using the environment variables to connect to the device.
-  Scenic([Sl4f sl4f, Dump dump]) :
-      _sl4f = sl4f ?? Sl4f.fromEnvironment(),
-      _dump = dump ?? Dump();
+  Scenic([Sl4f sl4f, Dump dump])
+      : _sl4f = sl4f ?? Sl4f.fromEnvironment(),
+        _dump = dump ?? Dump();
 
   /// Closes the underlying HTTP client. This need not be called if the
   /// Sl4f client is closed instead.
diff --git a/src/testing/sl4f/client/lib/src/sl4f_client.dart b/sdk/testing/sl4f/client/lib/src/sl4f_client.dart
similarity index 100%
rename from src/testing/sl4f/client/lib/src/sl4f_client.dart
rename to sdk/testing/sl4f/client/lib/src/sl4f_client.dart
diff --git a/sdk/testing/sl4f/client/pubspec.yaml b/sdk/testing/sl4f/client/pubspec.yaml
new file mode 100644
index 0000000..64e8f21
--- /dev/null
+++ b/sdk/testing/sl4f/client/pubspec.yaml
@@ -0,0 +1,3 @@
+# Copyright 2019 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
diff --git a/src/testing/sl4f/client/BUILD.gn b/src/testing/sl4f/client/BUILD.gn
index d951e13..fa561ed1 100644
--- a/src/testing/sl4f/client/BUILD.gn
+++ b/src/testing/sl4f/client/BUILD.gn
@@ -5,19 +5,13 @@
 import("//build/dart/dart_library.gni")
 
 dart_library("client") {
-  package_name = "sl4f"
+  package_name = "src_sl4f"
 
   sources = [
-    "sl4f.dart",
-    "src/audio.dart",
-    "src/dump.dart",
-    "src/exceptions.dart",
-    "src/scenic.dart",
-    "src/sl4f_client.dart",
+    "src_sl4f.dart",
   ]
 
   deps = [
-    "//third_party/dart-pkg/pub/http",
-    "//third_party/dart-pkg/pub/image",
+    "//sdk/testing/sl4f/client",
   ]
 }
diff --git a/src/testing/sl4f/client/analysis_options.yaml b/src/testing/sl4f/client/analysis_options.yaml
index ece9960..b237802 100644
--- a/src/testing/sl4f/client/analysis_options.yaml
+++ b/src/testing/sl4f/client/analysis_options.yaml
@@ -5,146 +5,4 @@
 # This is a copy of //topaz/tools/analysis_options.yaml; we should revisit
 # importing this instead after the flower shuffle.
 
-analyzer:
-  language:
-    enableSuperMixins: true
-  exclude:
-    - '**/generated/**'
-linter:
-  # Full list available at http://dart-lang.github.io/linter/lints/options/options.html.
-  rules:
-    - always_declare_return_types
-    - always_put_control_body_on_new_line
-    - always_put_required_named_parameters_first
-    - always_require_non_null_named_parameters
-    # No longer useful with Dart 2.
-    # - always_specify_types
-    - annotate_overrides
-    # Actively discouraged with Dart 2.
-    # - avoid_annotating_with_dynamic
-    - avoid_as
-    - avoid_bool_literals_in_conditional_expressions
-    - avoid_catches_without_on_clauses
-    - avoid_catching_errors
-    - avoid_classes_with_only_static_members
-    # JS only.
-    # - avoid_double_and_int_checks
-    - avoid_empty_else
-    # Not compatible with VS Code yet.
-    # - avoid_field_initializers_in_const_classes
-    - avoid_function_literals_in_foreach_calls
-    - avoid_init_to_null
-    # JS only.
-    # - avoid_js_rounded_ints
-    - avoid_null_checks_in_equality_operators
-    - avoid_positional_boolean_parameters
-    - avoid_private_typedef_functions
-    - avoid_relative_lib_imports
-    # This puts an unnecessary burden on API clients.
-    # - avoid_renaming_method_parameters
-    - avoid_return_types_on_setters
-    - avoid_returning_null
-    - avoid_returning_this
-    - avoid_single_cascade_in_expression_statements
-    # Conflicts with our dependency injection convention.
-    # - avoid_setters_without_getters
-    - avoid_slow_async_io
-    - avoid_types_as_parameter_names
-    # Not requiring this yet as it requires extensive changes to code base.
-    # - avoid_types_on_closure_parameters
-    - avoid_unused_constructor_parameters
-    - await_only_futures
-    - camel_case_types
-    - cancel_subscriptions
-    - cascade_invocations
-    - close_sinks
-    - constant_identifier_names
-    - control_flow_in_finally
-    - directives_ordering
-    - empty_catches
-    - empty_constructor_bodies
-    - empty_statements
-    - hash_and_equals
-    - implementation_imports
-    - invariant_booleans
-    - iterable_contains_unrelated_type
-    - join_return_with_assignment
-    - library_names
-    - library_prefixes
-    - list_remove_unrelated_type
-    - literal_only_boolean_expressions
-    - no_adjacent_strings_in_list
-    - no_duplicate_case_values
-    - non_constant_identifier_names
-    # Not requiring this yet as it requires extensive changes to code base.
-    # - omit_local_variable_types
-    - one_member_abstracts
-    - only_throw_errors
-    - overridden_fields
-    - package_api_docs
-    - package_names
-    - package_prefixed_library_names
-    - parameter_assignments
-    - prefer_adjacent_string_concatenation
-    - prefer_asserts_in_initializer_lists
-    - prefer_bool_in_asserts
-    - prefer_collection_literals
-    - prefer_conditional_assignment
-    # Disabled until bug is fixed
-    # https://github.com/dart-lang/linter/issues/995
-    # - prefer_const_constructors
-    - prefer_const_constructors_in_immutables
-    - prefer_const_declarations
-    # Disabled until bug is fixed
-    # https://github.com/dart-lang/linter/issues/995
-    # - prefer_const_literals_to_create_immutables
-    - prefer_constructors_over_static_methods
-    - prefer_contains
-    - prefer_equal_for_default_values
-    # Add this when 'short' is better defined.
-    # - prefer_expression_function_bodies
-    - prefer_final_fields
-    # The cruft/value ratio of this rule seems low.
-    # - prefer_final_locals
-    - prefer_foreach
-    - prefer_function_declarations_over_variables
-    - prefer_generic_function_type_aliases
-    - prefer_initializing_formals
-    - prefer_interpolation_to_compose_strings
-    - prefer_is_empty
-    - prefer_is_not_empty
-    - prefer_iterable_whereType
-    - prefer_single_quotes
-    - prefer_typing_uninitialized_variables
-    # This seems to create some cruft.
-    # Disable and evaluate if this is causing underdocumentation
-    # - public_member_api_docs
-    - recursive_getters
-    - slash_for_doc_comments
-    # Topaz codebase places fields before constructors
-    # - sort_constructors_first
-    - sort_unnamed_constructors_first
-    - super_goes_last
-    - test_types_in_equals
-    - throw_in_finally
-    - type_annotate_public_apis
-    - type_init_formals
-    - unawaited_futures
-    - unnecessary_brace_in_string_interps
-    - unnecessary_getters_setters
-    - unnecessary_lambdas
-    - unnecessary_null_aware_assignments
-    - unnecessary_null_in_if_null_operators
-    - unnecessary_overrides
-    # Turn on when https://github.com/dart-lang/linter/issues/997 is in flutter's version of dart.
-    # - unnecessary_parenthesis
-    - unnecessary_statements
-    - unnecessary_this
-    - unrelated_type_equality_checks
-    - use_rethrow_when_possible
-    - use_setters_to_change_properties
-    - use_string_buffers
-    - use_to_and_as_if_applicable
-    - valid_regexps
-    # Not compatible with VS Code yet.
-    # - void_checks
+include: ../../../../sdk/testing/sl4f/client/analysis_options.yaml
\ No newline at end of file
diff --git a/src/testing/sl4f/client/lib/src_sl4f.dart b/src/testing/sl4f/client/lib/src_sl4f.dart
new file mode 100644
index 0000000..7ab40fa
--- /dev/null
+++ b/src/testing/sl4f/client/lib/src_sl4f.dart
@@ -0,0 +1,5 @@
+// Copyright 2019 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/// This package has moved to //sdk/testing/sl4f/client
diff --git a/src/testing/sl4f/client/pubspec.yaml b/src/testing/sl4f/client/pubspec.yaml
index 1d6d7c3..64e8f21 100644
--- a/src/testing/sl4f/client/pubspec.yaml
+++ b/src/testing/sl4f/client/pubspec.yaml
@@ -1,7 +1,3 @@
 # Copyright 2019 The Fuchsia Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
-
-name:
-dependencies:
-  image: ^2.0.7
\ No newline at end of file