Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Unified Diff: remoting/protocol/webrtc_transport_unittest.cc

Issue 1843333002: Fix WebRTC transport to normalize SDP messages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/webrtc_transport.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/webrtc_transport_unittest.cc
diff --git a/remoting/protocol/webrtc_transport_unittest.cc b/remoting/protocol/webrtc_transport_unittest.cc
index 431cc0f2bc094b6f8964d71cf631e2d8ac561179..ca0725af8c80578604168247b7069de2b846df58 100644
--- a/remoting/protocol/webrtc_transport_unittest.cc
+++ b/remoting/protocol/webrtc_transport_unittest.cc
@@ -9,6 +9,7 @@
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
+#include "base/strings/string_util.h"
#include "jingle/glue/thread_wrapper.h"
#include "net/base/io_buffer.h"
#include "net/url_request/url_request_context_getter.h"
@@ -94,8 +95,17 @@ class WebrtcTransportTest : public testing::Test {
}
void ProcessTransportInfo(scoped_ptr<WebrtcTransport>* target_transport,
+ bool normalize_line_endings,
scoped_ptr<buzz::XmlElement> transport_info) {
ASSERT_TRUE(target_transport);
+
+ // Reformat the message to normalize line endings by removing CR symbol.
+ if (normalize_line_endings) {
+ std::string xml = transport_info->Str();
+ base::ReplaceChars(xml, "\r", std::string(), &xml);
+ transport_info.reset(buzz::XmlElement::ForStr(xml));
+ }
+
EXPECT_TRUE(
(*target_transport)->ProcessTransportInfo(transport_info.get()));
}
@@ -133,11 +143,11 @@ class WebrtcTransportTest : public testing::Test {
host_transport_->Start(
host_authenticator_.get(),
base::Bind(&WebrtcTransportTest::ProcessTransportInfo,
- base::Unretained(this), &client_transport_));
+ base::Unretained(this), &client_transport_, true));
client_transport_->Start(
client_authenticator_.get(),
base::Bind(&WebrtcTransportTest::ProcessTransportInfo,
- base::Unretained(this), &host_transport_));
+ base::Unretained(this), &host_transport_, false));
}
void WaitUntilConnected() {
« no previous file with comments | « remoting/protocol/webrtc_transport.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698