Split android_junit_tests and move targets in the right package.

This is the first step to move //:android_junit_tests to the righ
package (the target is triggering presubmit errors every time //BUILD.gn
gets updated).

Next steps:
* Update recipes
* Remove //:android_junit_tests

Issues with GN formatting, introduced by [1] will be addressed
separately in a "format all" CL.

[1] - https://gn-review.googlesource.com/c/gn/+/6860

Bug: webrtc:11289
No-Presubmit: True
Change-Id: I70c0927d722911f82dd971c30c7ffb581aed69c0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/166603
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30328}
diff --git a/BUILD.gn b/BUILD.gn
index 49227d9..eded8ad 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -74,6 +74,8 @@
       if (is_android) {
         deps += [
           ":android_junit_tests",
+          "examples:android_examples_junit_tests",
+          "sdk/android:android_sdk_junit_tests",
           "sdk/android:android_instrumentation_test_apk",
         ]
       } else {
diff --git a/examples/BUILD.gn b/examples/BUILD.gn
index 2cc356c..dbcd84b 100644
--- a/examples/BUILD.gn
+++ b/examples/BUILD.gn
@@ -854,6 +854,25 @@
       "//third_party/android_deps:com_android_support_support_annotations_java",
     ]
   }
+
+  junit_binary("android_examples_junit_tests") {
+    sources = [
+      "androidjunit/src/org/appspot/apprtc/BluetoothManagerTest.java",
+      "androidjunit/src/org/appspot/apprtc/DirectRTCClientTest.java",
+      "androidjunit/src/org/appspot/apprtc/TCPChannelClientTest.java",
+    ]
+
+    deps = [
+      ":AppRTCMobile_javalib",
+      "//base:base_java_test_support",
+      "//third_party/google-truth:google_truth_java",
+    ]
+
+    additional_jar_files = [ [
+          "../sdk/android/tests/resources/robolectric.properties",
+          "robolectric.properties",
+        ] ]
+  }
 }
 
 if (!build_with_chromium) {
diff --git a/examples/androidjunit/README b/examples/androidjunit/README
index 1753f50..03902a7 100644
--- a/examples/androidjunit/README
+++ b/examples/androidjunit/README
@@ -2,7 +2,7 @@
 Many of these test utilize Robolectric to mock Android classes.
 
 To compile:
-ninja -C out/Debug android_junit_tests
+ninja -C out/Debug android_examples_junit_tests
 
 To run:
-out/Debug/bin/run_android_junit_tests
+out/Debug/bin/run_android_examples_junit_tests
diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn
index 8b61ecf..f8eb79a 100644
--- a/sdk/android/BUILD.gn
+++ b/sdk/android/BUILD.gn
@@ -1564,4 +1564,29 @@
     namespace = "webrtc::jni"
     jni_generator_include = "//sdk/android/src/jni/jni_generator_helper.h"
   }
+
+  junit_binary("android_sdk_junit_tests") {
+    sources = [
+      "tests/src/org/webrtc/AndroidVideoDecoderTest.java",
+      "tests/src/org/webrtc/CameraEnumerationTest.java",
+      "tests/src/org/webrtc/CodecTestHelper.java",
+      "tests/src/org/webrtc/CryptoOptionsTest.java",
+      "tests/src/org/webrtc/FakeMediaCodecWrapper.java",
+      "tests/src/org/webrtc/GlGenericDrawerTest.java",
+      "tests/src/org/webrtc/HardwareVideoEncoderTest.java",
+      "tests/src/org/webrtc/IceCandidateTest.java",
+      "tests/src/org/webrtc/ScalingSettingsTest.java",
+    ]
+
+    deps = [
+      ":libjingle_peerconnection_java",
+      "//base:base_java_test_support",
+      "//third_party/google-truth:google_truth_java",
+    ]
+
+    additional_jar_files = [ [
+          "tests/resources/robolectric.properties",
+          "robolectric.properties",
+        ] ]
+  }
 }