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

Unified Diff: remoting/protocol/fake_session.h

Issue 1531983002: Replace ice_connection_to_client_unittest.cc with connection_unittest.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/connection_unittest.cc ('k') | remoting/protocol/fake_session.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/fake_session.h
diff --git a/remoting/protocol/fake_session.h b/remoting/protocol/fake_session.h
index 658dc194866dcbd20f40bf3742aafaaddd05cd2e..7301840f4bef14986c04a15b84bdb878e0030aeb 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.
@@ -56,16 +57,20 @@ class FakeSession : public Session {
FakeTransport* GetTransport() override;
void Close(ErrorCode error) override;
- public:
- EventHandler* event_handler_;
+ private:
+ 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);
};
« no previous file with comments | « remoting/protocol/connection_unittest.cc ('k') | remoting/protocol/fake_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698