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

Unified Diff: components/cast_channel/cast_test_util.h

Issue 2974523002: [cast_channel] Make CastSocketService a global leaky singleton (Closed)
Patch Set: merge with master Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/cast_channel/cast_socket_service_unittest.cc ('k') | components/cast_channel/cast_test_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cast_channel/cast_test_util.h
diff --git a/components/cast_channel/cast_test_util.h b/components/cast_channel/cast_test_util.h
index 66bac563872b031489810cbfbcc961208e2961a0..7e37ca45da188f8fc16d619ce8bb60d9079afac2 100644
--- a/components/cast_channel/cast_test_util.h
+++ b/components/cast_channel/cast_test_util.h
@@ -11,6 +11,7 @@
#include "base/macros.h"
#include "base/threading/thread_task_runner_handle.h"
#include "components/cast_channel/cast_socket.h"
+#include "components/cast_channel/cast_socket_service.h"
#include "components/cast_channel/cast_transport.h"
#include "components/cast_channel/proto/cast_channel.pb.h"
#include "net/base/ip_endpoint.h"
@@ -64,6 +65,19 @@ class MockCastSocketObserver : public CastSocket::Observer {
void(const CastSocket& socket, const CastMessage& message));
};
+class MockCastSocketService : public CastSocketService {
+ public:
+ MockCastSocketService();
+ ~MockCastSocketService() override;
+
+ MOCK_METHOD4(OpenSocket,
+ int(const net::IPEndPoint& ip_endpoint,
+ net::NetLog* net_log,
+ const CastSocket::OnOpenCallback& open_cb,
+ CastSocket::Observer* observer));
+ MOCK_CONST_METHOD1(GetSocket, CastSocket*(int channel_id));
+};
+
class MockCastSocket : public CastSocket {
public:
MockCastSocket();
@@ -73,6 +87,7 @@ class MockCastSocket : public CastSocket {
MOCK_METHOD1(Close, void(const net::CompletionCallback& callback));
MOCK_CONST_METHOD0(ready_state, ReadyState());
MOCK_METHOD1(AddObserver, void(Observer* observer));
+ MOCK_METHOD1(RemoveObserver, void(Observer* observer));
const net::IPEndPoint& ip_endpoint() const override { return ip_endpoint_; }
void SetIPEndpoint(const net::IPEndPoint& ip_endpoint) {
« no previous file with comments | « components/cast_channel/cast_socket_service_unittest.cc ('k') | components/cast_channel/cast_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698