Chromium Code Reviews| Index: remoting/protocol/fake_session.h |
| diff --git a/remoting/protocol/fake_session.h b/remoting/protocol/fake_session.h |
| index 658dc194866dcbd20f40bf3742aafaaddd05cd2e..b49cdc291528badbfe52c96eb202f39d8e9b3b1b 100644 |
| --- a/remoting/protocol/fake_session.h |
| +++ b/remoting/protocol/fake_session.h |
| @@ -10,6 +10,7 @@ |
| #include <vector> |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/memory/weak_ptr.h" |
| #include "remoting/protocol/fake_stream_socket.h" |
| #include "remoting/protocol/session.h" |
| #include "remoting/protocol/transport.h" |
| @@ -42,10 +43,10 @@ class FakeSession : public Session { |
| FakeSession(); |
| ~FakeSession() override; |
| - EventHandler* event_handler() { return event_handler_; } |
| + void SimulateConnection(FakeSession* peer); |
| + EventHandler* event_handler() { return event_handler_; } |
| void set_error(ErrorCode error) { error_ = error; } |
| - |
| bool is_closed() const { return closed_; } |
| // Session interface. |
| @@ -57,15 +58,19 @@ class FakeSession : public Session { |
| void Close(ErrorCode error) override; |
| public: |
|
joedow
2015/12/17 17:29:11
not part of your change, but why is public set twi
Sergey Ulanov
2015/12/17 17:36:18
Thanks for catching this!
|
| - EventHandler* event_handler_; |
| + EventHandler* event_handler_ = nullptr; |
| scoped_ptr<SessionConfig> config_; |
| std::string jid_; |
| FakeTransport transport_; |
| - ErrorCode error_; |
| - bool closed_; |
| + ErrorCode error_ = OK; |
| + bool closed_ = false; |
| + |
| + base::WeakPtr<FakeSession> peer_; |
| + |
| + base::WeakPtrFactory<FakeSession> weak_factory_; |
| DISALLOW_COPY_AND_ASSIGN(FakeSession); |
| }; |