| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_status_sender.h" | 5 #include "remoting/host/host_status_sender.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "remoting/base/constants.h" | 9 #include "remoting/base/constants.h" |
| 10 #include "remoting/base/logging.h" | 10 #include "remoting/base/logging.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 const char kStanzaId[] = "123"; | 34 const char kStanzaId[] = "123"; |
| 35 | 35 |
| 36 const HostExitCodes kTestExitCode = kInvalidHostConfigurationExitCode; | 36 const HostExitCodes kTestExitCode = kInvalidHostConfigurationExitCode; |
| 37 const char kTestExitCodeString[] = "INVALID_HOST_CONFIGURATION"; | 37 const char kTestExitCodeString[] = "INVALID_HOST_CONFIGURATION"; |
| 38 | 38 |
| 39 } // namespace | 39 } // namespace |
| 40 | 40 |
| 41 class HostStatusSenderTest | 41 class HostStatusSenderTest |
| 42 : public testing::Test { | 42 : public testing::Test { |
| 43 protected: | 43 protected: |
| 44 virtual void SetUp() override { | 44 void SetUp() override { |
| 45 key_pair_ = RsaKeyPair::FromString(kTestRsaKeyPair); | 45 key_pair_ = RsaKeyPair::FromString(kTestRsaKeyPair); |
| 46 ASSERT_TRUE(key_pair_.get()); | 46 ASSERT_TRUE(key_pair_.get()); |
| 47 | 47 |
| 48 host_status_sender_.reset(new HostStatusSender( | 48 host_status_sender_.reset(new HostStatusSender( |
| 49 kHostId, &signal_strategy_, key_pair_, kTestBotJid)); | 49 kHostId, &signal_strategy_, key_pair_, kTestBotJid)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 virtual void TearDown() override { | 52 void TearDown() override { host_status_sender_.reset(); } |
| 53 host_status_sender_.reset(); | |
| 54 } | |
| 55 | 53 |
| 56 void ValidateHostStatusStanza(XmlElement* stanza, | 54 void ValidateHostStatusStanza(XmlElement* stanza, |
| 57 HostStatusSender::HostStatus status); | 55 HostStatusSender::HostStatus status); |
| 58 | 56 |
| 59 void ValidateSignature( | 57 void ValidateSignature( |
| 60 XmlElement* signature, HostStatusSender::HostStatus status); | 58 XmlElement* signature, HostStatusSender::HostStatus status); |
| 61 | 59 |
| 62 MockSignalStrategy signal_strategy_; | 60 MockSignalStrategy signal_strategy_; |
| 63 scoped_refptr<RsaKeyPair> key_pair_; | 61 scoped_refptr<RsaKeyPair> key_pair_; |
| 64 scoped_ptr<HostStatusSender> host_status_sender_; | 62 scoped_ptr<HostStatusSender> host_status_sender_; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 185 |
| 188 scoped_refptr<RsaKeyPair> key_pair = RsaKeyPair::FromString(kTestRsaKeyPair); | 186 scoped_refptr<RsaKeyPair> key_pair = RsaKeyPair::FromString(kTestRsaKeyPair); |
| 189 ASSERT_TRUE(key_pair.get()); | 187 ASSERT_TRUE(key_pair.get()); |
| 190 | 188 |
| 191 std::string expected_signature = | 189 std::string expected_signature = |
| 192 key_pair->SignMessage(message); | 190 key_pair->SignMessage(message); |
| 193 EXPECT_EQ(expected_signature, signature->BodyText()); | 191 EXPECT_EQ(expected_signature, signature->BodyText()); |
| 194 } | 192 } |
| 195 | 193 |
| 196 } // namespace remoting | 194 } // namespace remoting |
| OLD | NEW |