Rewrite PeerConnection integration tests using better testing practices.
Also renames "peerconnection_unittests" to "peerconnection_integrationtests",
and moves the ICE URL parsing code to separate files.
The main problem previously was that the test assertions
occurred in various places in the main test class, and this shared test
code was overly complex and stateful. As a result, it was difficult to
tell what a test even does, let alone what assertions it's meant to be
making. And writing a new test that does what you want can be a
frustrating ordeal.
The new code still uses helper methods, but they have intuitive names
and a smaller role; all of the important parts of the test's logic are
in the test case itself.
We're planning on merging PeerConnection and WebRtcSession at some point
soon, so it seemed valuable to do this, so that the WebRtcSession tests
can be rewritten as PeerConnection tests using better patterns.
BUG=None
Review-Url: https://codereview.webrtc.org/2738353003
Cr-Commit-Position: refs/heads/master@{#17458}
diff --git a/webrtc/pc/iceserverparsing.h b/webrtc/pc/iceserverparsing.h
new file mode 100644
index 0000000..c8feefd
--- /dev/null
+++ b/webrtc/pc/iceserverparsing.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2017 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_PC_ICESERVERPARSING_H_
+#define WEBRTC_PC_ICESERVERPARSING_H_
+
+#include <vector>
+
+#include "webrtc/api/peerconnectioninterface.h"
+#include "webrtc/api/rtcerror.h"
+
+namespace webrtc {
+
+// Parses the URLs for each server in |servers| to build |stun_servers| and
+// |turn_servers|. Can return SYNTAX_ERROR if the URL is malformed, or
+// INVALID_PARAMETER if a TURN server is missing |username| or |password|.
+//
+// Intended to be used to convert/validate the servers passed into a
+// PeerConnection through RTCConfiguration.
+RTCErrorType ParseIceServers(
+ const PeerConnectionInterface::IceServers& servers,
+ cricket::ServerAddresses* stun_servers,
+ std::vector<cricket::RelayServerConfig>* turn_servers);
+
+} // namespace webrtc
+
+#endif // WEBRTC_PC_ICESERVERPARSING_H_