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

Side by Side Diff: extensions/browser/api/cast_channel/cast_channel_apitest.cc

Issue 417403002: Remove weak pointers from CastSocket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactor to use CancelableCallback Created 6 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/extensions/extension_function_test_utils.h" 9 #include "chrome/browser/extensions/extension_function_test_utils.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 class MockCastSocket : public CastSocket { 62 class MockCastSocket : public CastSocket {
63 public: 63 public:
64 explicit MockCastSocket(CastSocket::Delegate* delegate, 64 explicit MockCastSocket(CastSocket::Delegate* delegate,
65 net::IPEndPoint ip_endpoint, 65 net::IPEndPoint ip_endpoint,
66 net::NetLog* net_log) 66 net::NetLog* net_log)
67 : CastSocket(kTestExtensionId, ip_endpoint, 67 : CastSocket(kTestExtensionId, ip_endpoint,
68 cast_channel::CHANNEL_AUTH_TYPE_SSL, delegate, net_log, 68 cast_channel::CHANNEL_AUTH_TYPE_SSL, delegate, net_log,
69 base::TimeDelta::FromMilliseconds(kTimeoutMs)) {} 69 base::TimeDelta::FromMilliseconds(kTimeoutMs)) {}
70 virtual ~MockCastSocket() {} 70 virtual ~MockCastSocket() {}
71 71
72 virtual bool CalledOnValidThread() const OVERRIDE {
73 // Always return true in testing.
74 return true;
75 }
76
77 MOCK_METHOD1(Connect, void(const net::CompletionCallback& callback)); 72 MOCK_METHOD1(Connect, void(const net::CompletionCallback& callback));
78 MOCK_METHOD2(SendMessage, void(const MessageInfo& message, 73 MOCK_METHOD2(SendMessage, void(const MessageInfo& message,
79 const net::CompletionCallback& callback)); 74 const net::CompletionCallback& callback));
80 MOCK_METHOD1(Close, void(const net::CompletionCallback& callback)); 75 MOCK_METHOD1(Close, void(const net::CompletionCallback& callback));
81 MOCK_CONST_METHOD0(ready_state, cast_channel::ReadyState()); 76 MOCK_CONST_METHOD0(ready_state, cast_channel::ReadyState());
82 MOCK_CONST_METHOD0(error_state, cast_channel::ChannelError()); 77 MOCK_CONST_METHOD0(error_state, cast_channel::ChannelError());
83 }; 78 };
84 79
85 } // namespace 80 } // namespace
86 81
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 cast_channel_send_function.get(), 370 cast_channel_send_function.get(),
376 "[{\"channelId\": 1, \"url\": \"cast://127.0.0.1:8009\", " 371 "[{\"channelId\": 1, \"url\": \"cast://127.0.0.1:8009\", "
377 "\"connectInfo\": " 372 "\"connectInfo\": "
378 "{\"ipAddress\": \"127.0.0.1\", \"port\": 8009, " 373 "{\"ipAddress\": \"127.0.0.1\", \"port\": 8009, "
379 "\"auth\": \"ssl\"}, \"readyState\": \"open\"}, " 374 "\"auth\": \"ssl\"}, \"readyState\": \"open\"}, "
380 "{\"namespace_\": \"foo\", \"sourceId\": \"src\", " 375 "{\"namespace_\": \"foo\", \"sourceId\": \"src\", "
381 "\"destinationId\": \"\", \"data\": \"data\"}]", 376 "\"destinationId\": \"\", \"data\": \"data\"}]",
382 browser()); 377 browser());
383 EXPECT_EQ(error, "message_info.destination_id is required"); 378 EXPECT_EQ(error, "message_info.destination_id is required");
384 } 379 }
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/api/cast_channel/cast_socket.h » ('j') | extensions/browser/api/cast_channel/cast_socket.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698