Skip to content

Commit

Permalink
Merge pull request mozilla#15 from docfaraday/multistream_unit_tests
Browse files Browse the repository at this point in the history
Multistream unit tests
  • Loading branch information
martinthomson committed Sep 17, 2014
2 parents 45706ca + a8a93cc commit 4d46ab9
Show file tree
Hide file tree
Showing 13 changed files with 300 additions and 21 deletions.
4 changes: 3 additions & 1 deletion media/webrtc/signaling/src/sdp/Sdp.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
Expand Down Expand Up @@ -52,6 +54,6 @@ class SdpOrigin
virtual std::string GetAddress() const = 0;
};

}
} // namespace mozilla

#endif
2 changes: 2 additions & 0 deletions media/webrtc/signaling/src/sdp/SdpAttribute.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
Expand Down
2 changes: 2 additions & 0 deletions media/webrtc/signaling/src/sdp/SdpEnum.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
Expand Down
2 changes: 2 additions & 0 deletions media/webrtc/signaling/src/sdp/SdpMediaSection.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
Expand Down
24 changes: 24 additions & 0 deletions media/webrtc/signaling/src/sdp/SipccSdp.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
Expand All @@ -6,14 +8,36 @@

namespace mozilla {

SdpOrigin
SipccSdp::GetOrigin() const {
return SdpOrigin();
}

std::string
SipccSdp::GetSessionName() const {
return "TODO";
}

std::string
SipccSdp::GetBandwidth(std::string type) const {
return "TODO";
}

const SdpMediaSection &
SipccSdp::GetMediaSection(uint16_t level) const
{
if (level >= mMediaSections.size()) {
MOZ_CRASH();
}
return mMediaSections[level];
}

SdpMediaSection &
SipccSdp::GetMediaSection(uint16_t level)
{
if (level >= mMediaSections.size()) {
MOZ_CRASH();
}
return mMediaSections[level];
}

Expand Down
32 changes: 18 additions & 14 deletions media/webrtc/signaling/src/sdp/SipccSdp.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
Expand Down Expand Up @@ -28,26 +30,28 @@ class SipccSdp MOZ_FINAL : public Sdp
sdp_free_description(mSdp);
}

const SdpAttributeList& GetAttributeList() const {
return mAttributeList;
virtual SdpOrigin GetOrigin() const MOZ_OVERRIDE;
virtual std::string GetSessionName() const MOZ_OVERRIDE;
// Note: connection information is always retrieved from media sections
virtual std::string GetBandwidth(std::string type) const MOZ_OVERRIDE;

virtual uint16_t GetMediaSectionCount() const MOZ_OVERRIDE {
return static_cast<uint16_t>(mMediaSections.size());
}
SdpAttributeList& GetAttributeList() {

virtual const SdpAttributeList &GetAttributeList() const MOZ_OVERRIDE {
return mAttributeList;
}

const SdpMediaSection &GetMediaSection(uint16_t level) const {
if (level >= mMediaSections.length()) {
MOZ_CRASH();
}
return mMediaSections[level];
}
SdpMediaSection &GetMediaSection(uint16_t level) {
if (level >= mMediaSections.length()) {
MOZ_CRASH();
}
return mMediaSections[level];
virtual SdpAttributeList &GetAttributeList() MOZ_OVERRIDE {
return mAttributeList;
}

virtual const SdpMediaSection &GetMediaSection(
uint16_t level) const MOZ_OVERRIDE;

virtual SdpMediaSection &GetMediaSection(uint16_t level) MOZ_OVERRIDE;

private:
SipccSdp(sdp_t* sdp) : mSdp(sdp) {}

Expand Down
2 changes: 2 additions & 0 deletions media/webrtc/signaling/src/sdp/SipccSdpMediaSection.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
Expand Down
2 changes: 2 additions & 0 deletions media/webrtc/signaling/src/sdp/SipccSdpMediaSection.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
Expand Down
5 changes: 4 additions & 1 deletion media/webrtc/signaling/src/sdp/SipccSdpParser.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
Expand Down Expand Up @@ -57,4 +59,5 @@ sipcc_sdp_parser_error_handler(void *context, uint32_t line, const char *message

}

} // namespace
} // namespace mozilla

6 changes: 4 additions & 2 deletions media/webrtc/signaling/src/sdp/SipccSdpParser.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
Expand All @@ -18,7 +20,7 @@ class SipccSdpParser
{
public:
SipccSdpParser() {}
~SdpSdpParser() {}
~SipccSdpParser() {}

/**
* This parses the provided text into an SDP object.
Expand All @@ -39,6 +41,6 @@ class SipccSdpParser
std::vector<std::pair<uint32_t, const std::string> > mErrors;
};

}
} // namespace mozilla

#endif
35 changes: 35 additions & 0 deletions media/webrtc/signaling/test/jsep_session_unittest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#define GTEST_HAS_RTTI 0
#include "gtest/gtest.h"
#include "gtest_utils.h"

#include "signaling/src/jsep/JsepSession.h"
#include "signaling/src/sdp/SipccSdpParser.h"

//using mozilla::sdp::JsepSession;
using mozilla::SipccSdpParser;

namespace test {
class JsepSessionTest : public ::testing::Test {
public:
JsepSessionTest() {}

// JsepSession mSession;
SipccSdpParser mParser;
};

TEST_F(JsepSessionTest, CreateDestroy) {
}

} // namespace test

int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

5 changes: 4 additions & 1 deletion media/webrtc/signaling/test/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
CppUnitTests([
'jsep_session_unittest',
# 'mediaconduit_unittests',
# 'mediapipeline_unittest',
# 'sdp_unittests',
'sdp_unittests',
# 'signaling_unittests',
])

Expand Down Expand Up @@ -38,13 +39,15 @@ LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/share',
'/media/mtransport/third_party/nrappkit/src/stats',
'/media/mtransport/third_party/nrappkit/src/util/libekr',
'/media/webrtc',
'/media/webrtc/signaling/include',
'/media/webrtc/signaling/src/common/browser_logging',
'/media/webrtc/signaling/src/common/time_profiling',
'/media/webrtc/signaling/src/media',
'/media/webrtc/signaling/src/media-conduit',
'/media/webrtc/signaling/src/mediapipeline',
'/media/webrtc/signaling/src/peerconnection',
'/media/webrtc/signaling/src/sdp/sipcc',
'/media/webrtc/trunk',
'/media/webrtc/trunk/testing/gtest/include',
'/xpcom/base',
Expand Down
Loading

0 comments on commit 4d46ab9

Please sign in to comment.