| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/signaling/iq_sender.h" | 5 #include "remoting/signaling/iq_sender.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 TEST_F(IqSenderTest, Timeout) { | 123 TEST_F(IqSenderTest, Timeout) { |
| 124 ASSERT_NO_FATAL_FAILURE({ | 124 ASSERT_NO_FATAL_FAILURE({ |
| 125 SendTestMessage(); | 125 SendTestMessage(); |
| 126 }); | 126 }); |
| 127 | 127 |
| 128 request_->SetTimeout(base::TimeDelta::FromMilliseconds(2)); | 128 request_->SetTimeout(base::TimeDelta::FromMilliseconds(2)); |
| 129 | 129 |
| 130 EXPECT_CALL(callback_, OnReply(request_.get(), nullptr)) | 130 EXPECT_CALL(callback_, OnReply(request_.get(), nullptr)) |
| 131 .WillOnce( | 131 .WillOnce( |
| 132 InvokeWithoutArgs(&message_loop_, &base::MessageLoop::QuitWhenIdle)); | 132 InvokeWithoutArgs(&message_loop_, &base::MessageLoop::QuitWhenIdle)); |
| 133 message_loop_.Run(); | 133 base::RunLoop().Run(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 TEST_F(IqSenderTest, NotNormalizedJid) { | 136 TEST_F(IqSenderTest, NotNormalizedJid) { |
| 137 ASSERT_NO_FATAL_FAILURE({ | 137 ASSERT_NO_FATAL_FAILURE({ |
| 138 SendTestMessage(); | 138 SendTestMessage(); |
| 139 }); | 139 }); |
| 140 | 140 |
| 141 // Set upper-case from value, which is equivalent to kTo in the original | 141 // Set upper-case from value, which is equivalent to kTo in the original |
| 142 // message. | 142 // message. |
| 143 std::unique_ptr<XmlElement> response; | 143 std::unique_ptr<XmlElement> response; |
| 144 EXPECT_TRUE(FormatAndDeliverResponse("USER@domain.com", &response)); | 144 EXPECT_TRUE(FormatAndDeliverResponse("USER@domain.com", &response)); |
| 145 | 145 |
| 146 EXPECT_CALL(callback_, OnReply(request_.get(), XmlEq(response.get()))); | 146 EXPECT_CALL(callback_, OnReply(request_.get(), XmlEq(response.get()))); |
| 147 base::RunLoop().RunUntilIdle(); | 147 base::RunLoop().RunUntilIdle(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 TEST_F(IqSenderTest, InvalidFrom) { | 150 TEST_F(IqSenderTest, InvalidFrom) { |
| 151 ASSERT_NO_FATAL_FAILURE({ | 151 ASSERT_NO_FATAL_FAILURE({ |
| 152 SendTestMessage(); | 152 SendTestMessage(); |
| 153 }); | 153 }); |
| 154 | 154 |
| 155 EXPECT_FALSE(FormatAndDeliverResponse("different_user@domain.com", nullptr)); | 155 EXPECT_FALSE(FormatAndDeliverResponse("different_user@domain.com", nullptr)); |
| 156 | 156 |
| 157 EXPECT_CALL(callback_, OnReply(_, _)).Times(0); | 157 EXPECT_CALL(callback_, OnReply(_, _)).Times(0); |
| 158 base::RunLoop().RunUntilIdle(); | 158 base::RunLoop().RunUntilIdle(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace remoting | 161 } // namespace remoting |
| OLD | NEW |