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

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

Issue 9447087: Revert 123635 - Implement timeouts for IQ requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « remoting/host/register_support_host_request.cc ('k') | remoting/jingle_glue/iq_sender.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/register_support_host_request.h" 5 #include "remoting/host/register_support_host_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 .WillRepeatedly(Return(kTestJid)); 67 .WillRepeatedly(Return(kTestJid));
68 } 68 }
69 69
70 MessageLoop message_loop_; 70 MessageLoop message_loop_;
71 MockSignalStrategy signal_strategy_; 71 MockSignalStrategy signal_strategy_;
72 ObserverList<SignalStrategy::Listener, true> signal_strategy_listeners_; 72 ObserverList<SignalStrategy::Listener, true> signal_strategy_listeners_;
73 HostKeyPair key_pair_; 73 HostKeyPair key_pair_;
74 MockCallback callback_; 74 MockCallback callback_;
75 }; 75 };
76 76
77
77 TEST_F(RegisterSupportHostRequestTest, Send) { 78 TEST_F(RegisterSupportHostRequestTest, Send) {
78 // |iq_request| is freed by RegisterSupportHostRequest. 79 // |iq_request| is freed by RegisterSupportHostRequest.
79 int64 start_time = static_cast<int64>(base::Time::Now().ToDoubleT()); 80 int64 start_time = static_cast<int64>(base::Time::Now().ToDoubleT());
80 81
81 scoped_ptr<RegisterSupportHostRequest> request( 82 scoped_ptr<RegisterSupportHostRequest> request(
82 new RegisterSupportHostRequest(&signal_strategy_, &key_pair_, 83 new RegisterSupportHostRequest(&signal_strategy_, &key_pair_,
83 base::Bind(&MockCallback::OnResponse, 84 base::Bind(&MockCallback::OnResponse,
84 base::Unretained(&callback_)))); 85 base::Unretained(&callback_))));
85 86
86 XmlElement* sent_iq = NULL; 87 XmlElement* sent_iq = NULL;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 key_pair.LoadFromString(kTestHostKeyPair); 121 key_pair.LoadFromString(kTestHostKeyPair);
121 std::string expected_signature = 122 std::string expected_signature =
122 key_pair.GetSignature(std::string(kTestJid) + ' ' + time_str); 123 key_pair.GetSignature(std::string(kTestJid) + ' ' + time_str);
123 EXPECT_EQ(expected_signature, signature->BodyText()); 124 EXPECT_EQ(expected_signature, signature->BodyText());
124 125
125 // Generate response and verify that callback is called. 126 // Generate response and verify that callback is called.
126 EXPECT_CALL(callback_, OnResponse(true, kSupportId, 127 EXPECT_CALL(callback_, OnResponse(true, kSupportId,
127 base::TimeDelta::FromSeconds(300))); 128 base::TimeDelta::FromSeconds(300)));
128 129
129 scoped_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ)); 130 scoped_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ));
130 response->AddAttr(QName("", "from"), kChromotingBotJid);
131 response->AddAttr(QName("", "type"), "result"); 131 response->AddAttr(QName("", "type"), "result");
132 response->AddAttr(QName("", "id"), kStanzaId); 132 response->AddAttr(QName("", "id"), kStanzaId);
133 133
134 XmlElement* result = new XmlElement( 134 XmlElement* result = new XmlElement(
135 QName(kChromotingXmlNamespace, "register-support-host-result")); 135 QName(kChromotingXmlNamespace, "register-support-host-result"));
136 response->AddElement(result); 136 response->AddElement(result);
137 137
138 XmlElement* support_id = new XmlElement( 138 XmlElement* support_id = new XmlElement(
139 QName(kChromotingXmlNamespace, "support-id")); 139 QName(kChromotingXmlNamespace, "support-id"));
140 support_id->AddText(kSupportId); 140 support_id->AddText(kSupportId);
(...skipping 11 matching lines...) Expand all
152 while ((listener = it.GetNext()) != NULL) { 152 while ((listener = it.GetNext()) != NULL) {
153 if (listener->OnSignalStrategyIncomingStanza(response.get())) 153 if (listener->OnSignalStrategyIncomingStanza(response.get()))
154 consumed++; 154 consumed++;
155 } 155 }
156 EXPECT_EQ(1, consumed); 156 EXPECT_EQ(1, consumed);
157 157
158 message_loop_.RunAllPending(); 158 message_loop_.RunAllPending();
159 } 159 }
160 160
161 } // namespace remoting 161 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/register_support_host_request.cc ('k') | remoting/jingle_glue/iq_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698