diff --git a/tests/daemon/mgmt/channel-status-common.hpp b/tests/daemon/mgmt/channel-status-common.hpp
new file mode 100644
index 0000000..4954cc3
--- /dev/null
+++ b/tests/daemon/mgmt/channel-status-common.hpp
@@ -0,0 +1,97 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014,  Regents of the University of California,
+ *                      Arizona Board of Regents,
+ *                      Colorado State University,
+ *                      University Pierre & Marie Curie, Sorbonne University,
+ *                      Washington University in St. Louis,
+ *                      Beijing Institute of Technology,
+ *                      The University of Memphis
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NFD_TESTS_NFD_MGMT_CHANNEL_STATUS_COMMON_HPP
+#define NFD_TESTS_NFD_MGMT_CHANNEL_STATUS_COMMON_HPP
+
+#include "face/protocol-factory.hpp"
+#include "face/channel.hpp"
+
+#include "tests/test-common.hpp"
+
+#include <ndn-cxx/management/nfd-channel-status.hpp>
+
+
+
+namespace nfd {
+namespace tests {
+
+class DummyChannel : public Channel
+{
+public:
+
+  DummyChannel(const std::string& uri)
+  {
+    setUri(FaceUri(uri));
+  }
+
+  virtual
+  ~DummyChannel()
+  {
+  }
+};
+
+class DummyProtocolFactory : public ProtocolFactory
+{
+public:
+
+  DummyProtocolFactory()
+  {
+
+  }
+
+  virtual void
+  createFace(const FaceUri& uri,
+             const FaceCreatedCallback& onCreated,
+             const FaceConnectFailedCallback& onConnectFailed)
+  {
+  }
+
+  virtual void
+  addChannel(const std::string& channelUri)
+  {
+    m_channels.push_back(make_shared<DummyChannel>(channelUri));
+  }
+
+  virtual std::list<shared_ptr<const Channel> >
+  getChannels() const
+  {
+    return m_channels;
+  }
+
+  virtual size_t
+  getNChannels() const
+  {
+    return m_channels.size();
+  }
+
+private:
+  std::list<shared_ptr<const Channel> > m_channels;
+};
+
+} // namespace tests
+} // namespace nfd
+
+#endif // NFD_TESTS_NFD_MGMT_CHANNEL_STATUS_COMMON_HPP
diff --git a/tests/daemon/mgmt/channel-status-publisher.cpp b/tests/daemon/mgmt/channel-status-publisher.cpp
new file mode 100644
index 0000000..04625af
--- /dev/null
+++ b/tests/daemon/mgmt/channel-status-publisher.cpp
@@ -0,0 +1,185 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014,  Regents of the University of California,
+ *                      Arizona Board of Regents,
+ *                      Colorado State University,
+ *                      University Pierre & Marie Curie, Sorbonne University,
+ *                      Washington University in St. Louis,
+ *                      Beijing Institute of Technology,
+ *                      The University of Memphis
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "mgmt/channel-status-publisher.hpp"
+#include "mgmt/internal-face.hpp"
+
+#include "channel-status-common.hpp"
+
+#include "core/logger.hpp"
+NFD_LOG_INIT("TestChannelStatusPublisher");
+
+namespace nfd {
+namespace tests {
+
+class ChannelStatusPublisherFixture : BaseFixture
+{
+public:
+  ChannelStatusPublisherFixture()
+    : m_face(make_shared<InternalFace>())
+    , m_publisher(m_factories, m_face, "/localhost/nfd/faces/channels")
+    , m_finished(false)
+  {
+  }
+
+  virtual
+  ~ChannelStatusPublisherFixture()
+  {
+  }
+
+  // virtual shared_ptr<DummyProtocolFactory>
+  // addProtocolFactory(const std::string& protocol)
+  // {
+  //   shared_ptr<DummyProtocolFactory> factory(make_shared<DummyProtocolFactory>());
+  //   m_factories[protocol] = factory;
+
+  //   return factory;
+  // }
+
+  void
+  validatePublish(const Data& data)
+  {
+    Block payload = data.getContent();
+
+    m_buffer.appendByteArray(payload.value(), payload.value_size());
+
+    BOOST_CHECK_NO_THROW(data.getName()[-1].toSegment());
+    if (data.getFinalBlockId() != data.getName()[-1])
+      {
+        return;
+      }
+
+    // wrap the Channel Status entries in a single Content TLV for easy parsing
+    m_buffer.prependVarNumber(m_buffer.size());
+    m_buffer.prependVarNumber(ndn::Tlv::Content);
+
+    ndn::Block parser(m_buffer.buf(), m_buffer.size());
+    parser.parse();
+
+    BOOST_REQUIRE_EQUAL(parser.elements_size(), m_expectedEntries.size());
+
+    for (Block::element_const_iterator i = parser.elements_begin();
+         i != parser.elements_end();
+         ++i)
+      {
+        if (i->type() != ndn::tlv::nfd::ChannelStatus)
+          {
+            BOOST_FAIL("expected ChannelStatus, got type #" << i->type());
+          }
+
+        ndn::nfd::ChannelStatus entry(*i);
+
+        NFD_LOG_DEBUG("looking for channelstatus " << entry.getLocalUri());
+
+        std::map<std::string, ndn::nfd::ChannelStatus>::const_iterator expectedEntryPos =
+          m_expectedEntries.find(entry.getLocalUri());
+
+        BOOST_REQUIRE(expectedEntryPos != m_expectedEntries.end());
+        const ndn::nfd::ChannelStatus& expectedEntry = expectedEntryPos->second;
+
+        BOOST_CHECK_EQUAL(entry.getLocalUri(), expectedEntry.getLocalUri());
+
+        m_matchedEntries.insert(entry.getLocalUri());
+      }
+
+    BOOST_CHECK_EQUAL(m_matchedEntries.size(), m_expectedEntries.size());
+
+    m_finished = true;
+  }
+
+protected:
+  ChannelStatusPublisher::FactoryMap m_factories;
+  shared_ptr<InternalFace> m_face;
+  ChannelStatusPublisher m_publisher;
+
+  ndn::EncodingBuffer m_buffer;
+
+  std::map<std::string, ndn::nfd::ChannelStatus> m_expectedEntries;
+  std::set<std::string> m_matchedEntries;
+
+  bool m_finished;
+};
+
+BOOST_FIXTURE_TEST_SUITE(MgmtChannelStatusPublisher, ChannelStatusPublisherFixture)
+
+BOOST_AUTO_TEST_CASE(Publish)
+{
+  const std::string protocol = "dummy";
+
+  shared_ptr<DummyProtocolFactory> factory(make_shared<DummyProtocolFactory>());
+  m_factories[protocol] = factory;
+
+  for (int i = 0; i < 10; ++i)
+    {
+      const std::string uri = protocol + "://path" + boost::lexical_cast<std::string>(i);
+      factory->addChannel(uri);
+
+      ndn::nfd::ChannelStatus expectedEntry;
+      expectedEntry.setLocalUri(DummyChannel(uri).getUri().toString());
+
+      m_expectedEntries[expectedEntry.getLocalUri()] = expectedEntry;
+    }
+
+  m_face->onReceiveData +=
+    bind(&ChannelStatusPublisherFixture::validatePublish, this, _1);
+
+  m_publisher.publish();
+  BOOST_REQUIRE(m_finished);
+}
+
+BOOST_AUTO_TEST_CASE(DuplicateFactories)
+{
+  const std::string protocol1 = "dummy1";
+  const std::string protocol2 = "dummy2";
+
+  shared_ptr<DummyProtocolFactory> factory(make_shared<DummyProtocolFactory>());
+  m_factories[protocol1] = factory;
+  m_factories[protocol2] = factory;
+
+  for (int i = 0; i < 10; ++i)
+    {
+      ndn::nfd::ChannelStatus expectedEntry;
+      const std::string uri = protocol1 + "://path" + boost::lexical_cast<std::string>(i);
+
+      factory->addChannel(uri);
+
+      expectedEntry.setLocalUri(DummyChannel(uri).getUri().toString());
+      m_expectedEntries[expectedEntry.getLocalUri()] = expectedEntry;
+    }
+
+  m_face->onReceiveData +=
+    bind(&ChannelStatusPublisherFixture::validatePublish, this, _1);
+
+  m_publisher.publish();
+  BOOST_REQUIRE(m_finished);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+
+
+
+} // namespace nfd
diff --git a/tests/daemon/mgmt/face-manager.cpp b/tests/daemon/mgmt/face-manager.cpp
index 0f53b93..92ec987 100644
--- a/tests/daemon/mgmt/face-manager.cpp
+++ b/tests/daemon/mgmt/face-manager.cpp
@@ -1,11 +1,12 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014  Regents of the University of California,
- *                     Arizona Board of Regents,
- *                     Colorado State University,
- *                     University Pierre & Marie Curie, Sorbonne University,
- *                     Washington University in St. Louis,
- *                     Beijing Institute of Technology
+ * Copyright (c) 2014,  Regents of the University of California,
+ *                      Arizona Board of Regents,
+ *                      Colorado State University,
+ *                      University Pierre & Marie Curie, Sorbonne University,
+ *                      Washington University in St. Louis,
+ *                      Beijing Institute of Technology,
+ *                      The University of Memphis
  *
  * This file is part of NFD (Named Data Networking Forwarding Daemon).
  * See AUTHORS.md for complete list of NFD authors and contributors.
@@ -20,7 +21,7 @@
  *
  * You should have received a copy of the GNU General Public License along with
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
 
 #include "mgmt/face-manager.hpp"
 #include "mgmt/internal-face.hpp"
@@ -37,6 +38,7 @@
 #include "tests/test-common.hpp"
 #include "validation-common.hpp"
 #include "face-status-publisher-common.hpp"
+#include "channel-status-common.hpp"
 
 #include <ndn-cxx/encoding/tlv.hpp>
 #include <ndn-cxx/management/nfd-face-event-notification.hpp>
@@ -254,8 +256,6 @@
 
 protected:
   shared_ptr<InternalFace> m_face;
-
-private:
   bool m_callbackFired;
 };
 
@@ -311,7 +311,7 @@
     m_faceTable.reset();
   }
 
-private:
+protected:
   FaceManager m_manager;
   ConfigFile m_config;
 };
@@ -1690,7 +1690,6 @@
 };
 
 BOOST_FIXTURE_TEST_CASE(TestFaceList, FaceListFixture)
-
 {
   Name commandName("/localhost/nfd/faces/list");
   shared_ptr<Interest> command(make_shared<Interest>(commandName));
@@ -1730,6 +1729,46 @@
   BOOST_REQUIRE(m_finished);
 }
 
+class ChannelStatusFixture : public FaceManagerFixture
+{
+public:
+  void
+  validatePublish(const Data& data, const ndn::nfd::ChannelStatus& expectedEntry)
+  {
+    m_callbackFired = true;
+    Block b = data.getContent().blockFromValue();
+    ndn::nfd::ChannelStatus entry(b);
+    BOOST_CHECK_EQUAL(entry.getLocalUri(), expectedEntry.getLocalUri());
+  }
+
+  virtual shared_ptr<DummyProtocolFactory>
+  addProtocolFactory(const std::string& protocol)
+  {
+    shared_ptr<DummyProtocolFactory> factory(make_shared<DummyProtocolFactory>());
+    m_manager.m_factories[protocol] = factory;
+
+    return factory;
+  }
+};
+
+BOOST_FIXTURE_TEST_CASE(TestChannelStatus, ChannelStatusFixture)
+{
+  shared_ptr<DummyProtocolFactory> factory(addProtocolFactory("dummy"));
+  factory->addChannel("dummy://");
+
+  Name requestName("/localhost/nfd/faces/channels");
+  shared_ptr<Interest> request(make_shared<Interest>(requestName));
+
+  ndn::nfd::ChannelStatus expectedEntry;
+  expectedEntry.setLocalUri(DummyChannel("dummy://").getUri().toString());
+
+  m_face->onReceiveData +=
+    bind(&ChannelStatusFixture::validatePublish, this, _1, expectedEntry);
+
+  m_manager.listChannels(*request);
+  BOOST_REQUIRE(m_callbackFired);
+}
+
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace tests
