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

Side by Side Diff: remoting/jingle_glue/mock_objects.h

Issue 7809003: Simplify IqRequest interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix windows Created 9 years, 3 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/jingle_glue/jingle_info_request.cc ('k') | remoting/jingle_glue/xmpp_iq_request.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "remoting/jingle_glue/iq_request.h" 6 #include "remoting/jingle_glue/iq_request.h"
7 #include "remoting/jingle_glue/signal_strategy.h" 7 #include "remoting/jingle_glue/signal_strategy.h"
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 9
10 namespace remoting { 10 namespace remoting {
11 11
12 class MockSignalStrategy : public SignalStrategy { 12 class MockSignalStrategy : public SignalStrategy {
13 public: 13 public:
14 MockSignalStrategy(); 14 MockSignalStrategy();
15 virtual ~MockSignalStrategy(); 15 virtual ~MockSignalStrategy();
16 16
17 MOCK_METHOD1(Init, void(StatusObserver*)); 17 MOCK_METHOD1(Init, void(StatusObserver*));
18 MOCK_METHOD0(Close, void()); 18 MOCK_METHOD0(Close, void());
19 MOCK_METHOD1(SetListener, void(Listener* listener)); 19 MOCK_METHOD1(SetListener, void(Listener* listener));
20 MOCK_METHOD1(SendStanza, void(buzz::XmlElement* stanza)); 20 MOCK_METHOD1(SendStanza, void(buzz::XmlElement* stanza));
21 MOCK_METHOD0(GetNextId, std::string()); 21 MOCK_METHOD0(GetNextId, std::string());
22 MOCK_METHOD0(CreateIqRequest, IqRequest*()); 22 MOCK_METHOD0(CreateIqRequest, IqRequest*());
23 }; 23 };
24 24
25 class MockIqRequest : public IqRequest { 25 class MockIqRequest : public IqRequest {
26 public: 26 public:
27 MockIqRequest(); 27 MockIqRequest();
28 virtual ~MockIqRequest(); 28 virtual ~MockIqRequest();
29 29
30 MOCK_METHOD3(SendIq, void(const std::string& type, 30 MOCK_METHOD1(SendIq, void(buzz::XmlElement* stanza));
31 const std::string& addressee,
32 buzz::XmlElement* iq_body));
33 MOCK_METHOD1(set_callback, void(const IqRequest::ReplyCallback&)); 31 MOCK_METHOD1(set_callback, void(const IqRequest::ReplyCallback&));
34 32
35 // Ensure this takes ownership of the pointer, as the real IqRequest object 33 // Ensure this takes ownership of the pointer, as the real IqRequest object
36 // would, to avoid memory-leak. 34 // would, to avoid memory-leak.
37 void set_callback_hook(const IqRequest::ReplyCallback& callback) { 35 void set_callback_hook(const IqRequest::ReplyCallback& callback) {
38 callback_ = callback; 36 callback_ = callback;
39 } 37 }
40 38
41 void Init() { 39 void Init() {
42 ON_CALL(*this, set_callback(testing::_)) 40 ON_CALL(*this, set_callback(testing::_))
43 .WillByDefault(testing::Invoke( 41 .WillByDefault(testing::Invoke(
44 this, &MockIqRequest::set_callback_hook)); 42 this, &MockIqRequest::set_callback_hook));
45 } 43 }
46 44
47 ReplyCallback& callback() { return callback_; } 45 ReplyCallback& callback() { return callback_; }
48 46
49 private: 47 private:
50 ReplyCallback callback_; 48 ReplyCallback callback_;
51 }; 49 };
52 50
53 } // namespace remoting 51 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/jingle_glue/jingle_info_request.cc ('k') | remoting/jingle_glue/xmpp_iq_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698