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

Side by Side Diff: chrome/browser/media/cast_remoting_connector_unittest.cc

Issue 2706463002: [Presentation API] Mojo typemap for content::PresentationConnectionMessage (Closed)
Patch Set: Remove TODO Created 3 years, 9 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/media/cast_remoting_connector.h" 5 #include "chrome/browser/media/cast_remoting_connector.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 message_observer_ = observer; 158 message_observer_ = observer;
159 CHECK(message_observer_); 159 CHECK(message_observer_);
160 } 160 }
161 161
162 void UnregisterRouteMessageObserver(RouteMessageObserver* observer) final { 162 void UnregisterRouteMessageObserver(RouteMessageObserver* observer) final {
163 CHECK_EQ(message_observer_, observer); 163 CHECK_EQ(message_observer_, observer);
164 message_observer_ = nullptr; 164 message_observer_ = nullptr;
165 } 165 }
166 166
167 void SendRouteMessage(const MediaRoute::Id& route_id, 167 void SendRouteMessage(const MediaRoute::Id& route_id,
168 const std::string& text, 168 std::string text,
169 const SendRouteMessageCallback& callback) final { 169 const SendRouteMessageCallback& callback) final {
170 EXPECT_EQ(message_observer_->route_id(), route_id); 170 EXPECT_EQ(message_observer_->route_id(), route_id);
171 ASSERT_FALSE(callback.is_null()); 171 ASSERT_FALSE(callback.is_null());
172 RouteMessage message; 172 RouteMessage message;
173 message.type = RouteMessage::TEXT; 173 message.type = RouteMessage::TEXT;
174 message.text = text; 174 message.text = text;
dcheng 2017/02/28 06:45:26 Either use std::move() or pass by const ref. Given
mark a. foltz 2017/02/28 18:35:20 Done.
175 outbound_messages_.push_back(std::make_pair(message, callback)); 175 outbound_messages_.push_back(std::make_pair(message, callback));
176 } 176 }
177 177
178 void SendRouteBinaryMessage( 178 void SendRouteBinaryMessage(const MediaRoute::Id& route_id,
179 const MediaRoute::Id& route_id, 179 std::vector<uint8_t> data,
180 std::unique_ptr<std::vector<uint8_t>> data, 180 const SendRouteMessageCallback& callback) final {
181 const SendRouteMessageCallback& callback) final {
182 EXPECT_EQ(message_observer_->route_id(), route_id); 181 EXPECT_EQ(message_observer_->route_id(), route_id);
183 ASSERT_TRUE(!!data);
184 ASSERT_FALSE(callback.is_null()); 182 ASSERT_FALSE(callback.is_null());
185 RouteMessage message; 183 RouteMessage message;
186 message.type = RouteMessage::BINARY; 184 message.type = RouteMessage::BINARY;
187 message.binary = std::move(*data); 185 message.binary = data;
188 outbound_messages_.push_back(std::make_pair(message, callback)); 186 outbound_messages_.push_back(std::make_pair(message, callback));
189 } 187 }
190 188
191 private: 189 private:
192 // Asynchronous callback to notify the MediaRoutesObserver of a change in 190 // Asynchronous callback to notify the MediaRoutesObserver of a change in
193 // routes. 191 // routes.
194 void DoUpdateRoutes() { 192 void DoUpdateRoutes() {
195 if (routes_observer_) 193 if (routes_observer_)
196 routes_observer_->OnRoutesUpdated(routes_, std::vector<MediaRoute::Id>()); 194 routes_observer_->OnRoutesUpdated(routes_, std::vector<MediaRoute::Id>());
197 } 195 }
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 break; 608 break;
611 } 609 }
612 } 610 }
613 } 611 }
614 612
615 INSTANTIATE_TEST_CASE_P(, CastRemotingConnectorFullSessionTest, 613 INSTANTIATE_TEST_CASE_P(, CastRemotingConnectorFullSessionTest,
616 ::testing::Values(SOURCE_TERMINATES, 614 ::testing::Values(SOURCE_TERMINATES,
617 MOJO_PIPE_CLOSES, 615 MOJO_PIPE_CLOSES,
618 ROUTE_TERMINATES, 616 ROUTE_TERMINATES,
619 EXTERNAL_FAILURE)); 617 EXTERNAL_FAILURE));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698