diff options
author | Tobias Markmann <tm@ayena.de> | 2012-03-20 00:05:55 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2012-03-20 19:13:43 (GMT) |
commit | 3d6694b0c698fff63d11f8bb4aa995c1df882315 (patch) | |
tree | a46ccace647f23a65100cf69c951345aa6dea7ab /Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp | |
parent | 3d27d98ccc232ae7bfacfd5a3f85f44b6c2e9cc9 (diff) | |
download | swift-contrib-3d6694b0c698fff63d11f8bb4aa995c1df882315.zip swift-contrib-3d6694b0c698fff63d11f8bb4aa995c1df882315.tar.bz2 |
boost::shared_ptr<?>(new ?(...)) -> boost::make_shared<?>(...) transformation where possible.
License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php
Diffstat (limited to 'Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp')
-rw-r--r-- | Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp b/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp index 8123c00..a6098f1 100644 --- a/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp +++ b/Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp @@ -51,71 +51,71 @@ class XMPPLayerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, errorReceived_); } void testResetParser() { testling_->onElement.connect(boost::bind(&XMPPLayerTest::handleElement, this, _1)); testling_->onError.connect(boost::bind(&XMPPLayerTest::handleError, this)); testling_->handleDataRead(createSafeByteArray("<stream:stream to=\"example.com\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" >")); testling_->resetParser(); testling_->handleDataRead(createSafeByteArray("<stream:stream to=\"example.com\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" >")); testling_->handleDataRead(createSafeByteArray("<presence/>")); CPPUNIT_ASSERT_EQUAL(1, elementsReceived_); CPPUNIT_ASSERT_EQUAL(0, errorReceived_); } void testResetParser_FromSlot() { testling_->onElement.connect(boost::bind(&XMPPLayerTest::handleElementAndReset, this, _1)); testling_->handleDataRead(createSafeByteArray("<stream:stream to=\"example.com\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" ><presence/>")); testling_->handleDataRead(createSafeByteArray("<stream:stream to=\"example.com\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" ><presence/>")); CPPUNIT_ASSERT_EQUAL(2, elementsReceived_); CPPUNIT_ASSERT_EQUAL(0, errorReceived_); } void testWriteHeader() { ProtocolHeader header; header.setTo("example.com"); testling_->writeHeader(header); CPPUNIT_ASSERT_EQUAL(std::string("<?xml version=\"1.0\"?><stream:stream xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" to=\"example.com\" version=\"1.0\">"), lowLayer_->writtenData); } void testWriteElement() { - testling_->writeElement(boost::shared_ptr<Presence>(new Presence())); + testling_->writeElement(boost::make_shared<Presence>()); CPPUNIT_ASSERT_EQUAL(std::string("<presence/>"), lowLayer_->writtenData); } void testWriteFooter() { testling_->writeFooter(); CPPUNIT_ASSERT_EQUAL(std::string("</stream:stream>"), lowLayer_->writtenData); } void handleElement(boost::shared_ptr<Element>) { ++elementsReceived_; } void handleElementAndReset(boost::shared_ptr<Element>) { ++elementsReceived_; testling_->resetParser(); } void handleError() { ++errorReceived_; } private: class XMPPLayerExposed : public XMPPLayer { public: XMPPLayerExposed( PayloadParserFactoryCollection* payloadParserFactories, PayloadSerializerCollection* payloadSerializers, XMLParserFactory* xmlParserFactory, StreamType streamType) : XMPPLayer(payloadParserFactories, payloadSerializers, xmlParserFactory, streamType) {} using XMPPLayer::handleDataRead; using HighLayer::setChildLayer; }; |