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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "remoting/signaling/iq_sender.h" | 10 #include "remoting/signaling/iq_sender.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 base::RunLoop().RunUntilIdle(); | 106 base::RunLoop().RunUntilIdle(); |
107 } | 107 } |
108 | 108 |
109 TEST_F(IqSenderTest, Timeout) { | 109 TEST_F(IqSenderTest, Timeout) { |
110 ASSERT_NO_FATAL_FAILURE({ | 110 ASSERT_NO_FATAL_FAILURE({ |
111 SendTestMessage(); | 111 SendTestMessage(); |
112 }); | 112 }); |
113 | 113 |
114 request_->SetTimeout(base::TimeDelta::FromMilliseconds(2)); | 114 request_->SetTimeout(base::TimeDelta::FromMilliseconds(2)); |
115 | 115 |
116 EXPECT_CALL(callback_, OnReply(request_.get(), NULL)) | 116 EXPECT_CALL(callback_, OnReply(request_.get(), nullptr)) |
117 .WillOnce(InvokeWithoutArgs(&message_loop_, &base::MessageLoop::Quit)); | 117 .WillOnce(InvokeWithoutArgs(&message_loop_, &base::MessageLoop::Quit)); |
118 message_loop_.Run(); | 118 message_loop_.Run(); |
119 } | 119 } |
120 | 120 |
121 TEST_F(IqSenderTest, InvalidFrom) { | 121 TEST_F(IqSenderTest, InvalidFrom) { |
122 ASSERT_NO_FATAL_FAILURE({ | 122 ASSERT_NO_FATAL_FAILURE({ |
123 SendTestMessage(); | 123 SendTestMessage(); |
124 }); | 124 }); |
125 | 125 |
126 scoped_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ)); | 126 scoped_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ)); |
127 response->AddAttr(QName(std::string(), "type"), "result"); | 127 response->AddAttr(QName(std::string(), "type"), "result"); |
128 response->AddAttr(QName(std::string(), "id"), kStanzaId); | 128 response->AddAttr(QName(std::string(), "id"), kStanzaId); |
129 response->AddAttr(QName(std::string(), "from"), "different_user@domain.com"); | 129 response->AddAttr(QName(std::string(), "from"), "different_user@domain.com"); |
130 | 130 |
131 XmlElement* result = new XmlElement( | 131 XmlElement* result = new XmlElement( |
132 QName("test:namespace", "response-body")); | 132 QName("test:namespace", "response-body")); |
133 response->AddElement(result); | 133 response->AddElement(result); |
134 | 134 |
135 EXPECT_CALL(callback_, OnReply(_, _)) | 135 EXPECT_CALL(callback_, OnReply(_, _)) |
136 .Times(0); | 136 .Times(0); |
137 EXPECT_FALSE(sender_->OnSignalStrategyIncomingStanza(response.get())); | 137 EXPECT_FALSE(sender_->OnSignalStrategyIncomingStanza(response.get())); |
138 base::RunLoop().RunUntilIdle(); | 138 base::RunLoop().RunUntilIdle(); |
139 } | 139 } |
140 | 140 |
141 } // namespace remoting | 141 } // namespace remoting |
OLD | NEW |