Upload WebRTC event logs over "unknown" connections

Previously, we were uploading only when CONNECTION_ETHERNET or
CONNECTION_WIFI were reported. However, it turns out that sometimes,
Wi-Fi connections are reported as CONNECTION_UNKNOWN.
We will therefore start uploading over any connection
other than NONE, 2G, 3G and 4G.

Bug: 944451
Change-Id: I9f8927a7f4c24dc1045225f98a9fafd0097d51a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1533939
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Commit-Queue: Elad Alon <eladalon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#642955}
diff --git a/chrome/browser/media/webrtc/webrtc_event_log_manager_remote.cc b/chrome/browser/media/webrtc/webrtc_event_log_manager_remote.cc
index 91f01967..2326052 100644
--- a/chrome/browser/media/webrtc/webrtc_event_log_manager_remote.cc
+++ b/chrome/browser/media/webrtc/webrtc_event_log_manager_remote.cc
@@ -91,16 +91,14 @@
 
 // Do not attempt to upload when there is no active connection.
 // Do not attempt to upload if the connection is known to be a mobile one.
-// Err on the side of caution with unknown connection types (by not uploading).
 // Note #1: A device may have multiple connections, so this is not bullet-proof.
 // Note #2: Does not attempt to recognize mobile hotspots.
 bool UploadSupportedUsingConnectionType(
     network::mojom::ConnectionType connection) {
-  if (connection == network::mojom::ConnectionType::CONNECTION_ETHERNET ||
-      connection == network::mojom::ConnectionType::CONNECTION_WIFI) {
-    return true;
-  }
-  return false;
+  return connection != network::mojom::ConnectionType::CONNECTION_NONE &&
+         connection != network::mojom::ConnectionType::CONNECTION_2G &&
+         connection != network::mojom::ConnectionType::CONNECTION_3G &&
+         connection != network::mojom::ConnectionType::CONNECTION_4G;
 }
 
 // Produce a history file for a given file.
diff --git a/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest.cc b/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest.cc
index 3061598..48bf87e 100644
--- a/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest.cc
+++ b/chrome/browser/media/webrtc/webrtc_event_log_manager_unittest.cc
@@ -4357,7 +4357,8 @@
         ::testing::Bool(),
         // The upload-supporting network type to be used.
         ::testing::Values(network::mojom::ConnectionType::CONNECTION_ETHERNET,
-                          network::mojom::ConnectionType::CONNECTION_WIFI),
+                          network::mojom::ConnectionType::CONNECTION_WIFI,
+                          network::mojom::ConnectionType::CONNECTION_UNKNOWN),
         // The upload-unsupporting network type to be used.
         ::testing::Values(network::mojom::ConnectionType::CONNECTION_NONE,
                           network::mojom::ConnectionType::CONNECTION_4G)));