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

Unified Diff: remoting/host/host_experiment_session_plugin_unittest.cc

Issue 2586133002: [Chromoting] Implement HostExperimentSessionPlugin (Closed)
Patch Set: Resolve review comments Created 3 years, 11 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/host/host_experiment_session_plugin.cc ('k') | remoting/protocol/session_plugin.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/host_experiment_session_plugin_unittest.cc
diff --git a/remoting/host/host_experiment_session_plugin_unittest.cc b/remoting/host/host_experiment_session_plugin_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cc6b5a5999918fa348a8226025a17820c005d5ea
--- /dev/null
+++ b/remoting/host/host_experiment_session_plugin_unittest.cc
@@ -0,0 +1,64 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/host/host_experiment_session_plugin.h"
+
+#include <memory>
+
+#include "base/bind.h"
+#include "remoting/base/constants.h"
+#include "remoting/host/host_attributes.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
+
+using buzz::QName;
+using buzz::XmlElement;
+
+namespace remoting {
+
+TEST(HostExperimentSessionPluginTest, AttachAttributes) {
+ HostExperimentSessionPlugin plugin;
+ std::unique_ptr<XmlElement> attachments = plugin.GetNextMessage();
+ ASSERT_TRUE(attachments);
+ ASSERT_EQ(attachments->Name(),
+ QName(kChromotingXmlNamespace, "host-attributes"));
+ ASSERT_EQ(attachments->BodyText(), GetHostAttributes());
+
+ attachments.reset();
+ attachments = plugin.GetNextMessage();
+ ASSERT_FALSE(attachments);
+}
+
+TEST(HostExperimentSessionPluginTest, LoadConfiguration) {
+ std::unique_ptr<XmlElement> attachment(
+ new XmlElement(QName(kChromotingXmlNamespace, "attachments")));
+ XmlElement* configuration =
+ new XmlElement(QName(kChromotingXmlNamespace, "host-configuration"));
+ configuration->SetBodyText("This Is A Test Configuration");
+ attachment->AddElement(configuration);
+ HostExperimentSessionPlugin plugin;
+ plugin.OnIncomingMessage(*attachment);
+ ASSERT_TRUE(plugin.configuration_received());
+ ASSERT_EQ(plugin.configuration(), "This Is A Test Configuration");
+}
+
+TEST(HostExperimentSessionPluginTest, IgnoreSecondConfiguration) {
+ std::unique_ptr<XmlElement> attachment(
+ new XmlElement(QName(kChromotingXmlNamespace, "attachments")));
+ XmlElement* configuration =
+ new XmlElement(QName(kChromotingXmlNamespace, "host-configuration"));
+ attachment->AddElement(configuration);
+ configuration->SetBodyText("config1");
+ HostExperimentSessionPlugin plugin;
+ plugin.OnIncomingMessage(*attachment);
+ ASSERT_TRUE(plugin.configuration_received());
+ ASSERT_EQ(plugin.configuration(), "config1");
+
+ configuration->SetBodyText("config2");
+ plugin.OnIncomingMessage(*attachment);
+ ASSERT_TRUE(plugin.configuration_received());
+ ASSERT_EQ(plugin.configuration(), "config1");
+}
+
+} // namespace remoting
« no previous file with comments | « remoting/host/host_experiment_session_plugin.cc ('k') | remoting/protocol/session_plugin.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698