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

Side by Side Diff: remoting/host/host_experiment_servant_unittest.cc

Issue 2615113005: [Chromoting] Use HostExperimentSessionPlugin in host (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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/host/host_experiment_session_plugin.h" 5 #include "remoting/host/host_experiment_servant.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "remoting/base/constants.h" 10 #include "remoting/base/constants.h"
11 #include "remoting/host/host_attributes.h" 11 #include "remoting/host/host_attributes.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" 13 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
14 14
15 using buzz::QName; 15 using buzz::QName;
16 using buzz::XmlElement; 16 using buzz::XmlElement;
17 17
18 namespace remoting { 18 namespace remoting {
19 19
20 TEST(HostExperimentSessionPluginTest, AttachAttributes) { 20 TEST(HostExperimentServantTest, AttachAttributes) {
21 HostExperimentSessionPlugin plugin; 21 HostExperimentServant plugin;
22 std::unique_ptr<XmlElement> attachments = plugin.GetNextMessage(); 22 std::unique_ptr<XmlElement> attachments = plugin.GetNextMessage();
23 ASSERT_TRUE(attachments); 23 ASSERT_TRUE(attachments);
24 ASSERT_EQ(attachments->Name(), 24 ASSERT_EQ(attachments->Name(),
25 QName(kChromotingXmlNamespace, "host-attributes")); 25 QName(kChromotingXmlNamespace, "host-attributes"));
26 ASSERT_EQ(attachments->BodyText(), GetHostAttributes()); 26 ASSERT_EQ(attachments->BodyText(), GetHostAttributes());
27 27
28 attachments.reset(); 28 attachments.reset();
29 attachments = plugin.GetNextMessage(); 29 attachments = plugin.GetNextMessage();
30 ASSERT_FALSE(attachments); 30 ASSERT_FALSE(attachments);
31 } 31 }
32 32
33 TEST(HostExperimentSessionPluginTest, LoadConfiguration) { 33 TEST(HostExperimentServantTest, LoadConfiguration) {
34 std::unique_ptr<XmlElement> attachment( 34 std::unique_ptr<XmlElement> attachment(
35 new XmlElement(QName(kChromotingXmlNamespace, "attachments"))); 35 new XmlElement(QName(kChromotingXmlNamespace, "attachments")));
36 XmlElement* configuration = 36 XmlElement* configuration =
37 new XmlElement(QName(kChromotingXmlNamespace, "host-configuration")); 37 new XmlElement(QName(kChromotingXmlNamespace, "host-configuration"));
38 configuration->SetBodyText("This Is A Test Configuration"); 38 configuration->SetBodyText("This Is A Test Configuration");
39 attachment->AddElement(configuration); 39 attachment->AddElement(configuration);
40 HostExperimentSessionPlugin plugin; 40 HostExperimentServant plugin;
41 plugin.OnIncomingMessage(*attachment); 41 plugin.OnIncomingMessage(*attachment);
42 ASSERT_TRUE(plugin.configuration_received()); 42 ASSERT_TRUE(plugin.configuration_received());
43 ASSERT_EQ(plugin.configuration(), "This Is A Test Configuration"); 43 ASSERT_EQ(plugin.configuration(), "This Is A Test Configuration");
44 } 44 }
45 45
46 TEST(HostExperimentSessionPluginTest, IgnoreSecondConfiguration) { 46 TEST(HostExperimentServantTest, IgnoreSecondConfiguration) {
47 std::unique_ptr<XmlElement> attachment( 47 std::unique_ptr<XmlElement> attachment(
48 new XmlElement(QName(kChromotingXmlNamespace, "attachments"))); 48 new XmlElement(QName(kChromotingXmlNamespace, "attachments")));
49 XmlElement* configuration = 49 XmlElement* configuration =
50 new XmlElement(QName(kChromotingXmlNamespace, "host-configuration")); 50 new XmlElement(QName(kChromotingXmlNamespace, "host-configuration"));
51 attachment->AddElement(configuration); 51 attachment->AddElement(configuration);
52 configuration->SetBodyText("config1"); 52 configuration->SetBodyText("config1");
53 HostExperimentSessionPlugin plugin; 53 HostExperimentServant plugin;
54 plugin.OnIncomingMessage(*attachment); 54 plugin.OnIncomingMessage(*attachment);
55 ASSERT_TRUE(plugin.configuration_received()); 55 ASSERT_TRUE(plugin.configuration_received());
56 ASSERT_EQ(plugin.configuration(), "config1"); 56 ASSERT_EQ(plugin.configuration(), "config1");
57 57
58 configuration->SetBodyText("config2"); 58 configuration->SetBodyText("config2");
59 plugin.OnIncomingMessage(*attachment); 59 plugin.OnIncomingMessage(*attachment);
60 ASSERT_TRUE(plugin.configuration_received()); 60 ASSERT_TRUE(plugin.configuration_received());
61 ASSERT_EQ(plugin.configuration(), "config1"); 61 ASSERT_EQ(plugin.configuration(), "config1");
62 } 62 }
63 63
64 } // namespace remoting 64 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698