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

Side by Side Diff: chrome/browser/media/router/mojo/media_router_mojo_impl_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 SendMessageCallbackHandler handler; 882 SendMessageCallbackHandler handler;
883 EXPECT_CALL(handler, Invoke(true)) 883 EXPECT_CALL(handler, Invoke(true))
884 .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); 884 .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); }));
885 router()->SendRouteMessage(kRouteId, kMessage, 885 router()->SendRouteMessage(kRouteId, kMessage,
886 base::Bind(&SendMessageCallbackHandler::Invoke, 886 base::Bind(&SendMessageCallbackHandler::Invoke,
887 base::Unretained(&handler))); 887 base::Unretained(&handler)));
888 run_loop.Run(); 888 run_loop.Run();
889 } 889 }
890 890
891 TEST_F(MediaRouterMojoImplTest, SendRouteBinaryMessage) { 891 TEST_F(MediaRouterMojoImplTest, SendRouteBinaryMessage) {
892 std::unique_ptr<std::vector<uint8_t>> expected_binary_data( 892 std::vector<uint8_t> expected_binary_data(
893 new std::vector<uint8_t>(kBinaryMessage, 893 kBinaryMessage, kBinaryMessage + arraysize(kBinaryMessage));
894 kBinaryMessage + arraysize(kBinaryMessage)));
895 894
896 EXPECT_CALL(mock_media_route_provider_, 895 EXPECT_CALL(mock_media_route_provider_,
897 SendRouteBinaryMessageInternal(kRouteId, _, _)) 896 SendRouteBinaryMessage(kRouteId, _, _))
898 .WillOnce(Invoke([]( 897 .WillOnce(Invoke([](
899 const MediaRoute::Id& route_id, const std::vector<uint8_t>& data, 898 const MediaRoute::Id& route_id, const std::vector<uint8_t>& data,
900 const mojom::MediaRouteProvider::SendRouteMessageCallback& cb) { 899 const mojom::MediaRouteProvider::SendRouteMessageCallback& cb) {
901 EXPECT_EQ( 900 EXPECT_EQ(
902 0, memcmp(kBinaryMessage, &(data[0]), arraysize(kBinaryMessage))); 901 0, memcmp(kBinaryMessage, &(data[0]), arraysize(kBinaryMessage)));
903 cb.Run(true); 902 cb.Run(true);
904 })); 903 }));
905 904
906 base::RunLoop run_loop; 905 base::RunLoop run_loop;
907 SendMessageCallbackHandler handler; 906 SendMessageCallbackHandler handler;
908 EXPECT_CALL(handler, Invoke(true)) 907 EXPECT_CALL(handler, Invoke(true))
909 .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); 908 .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); }));
910 router()->SendRouteBinaryMessage( 909 router()->SendRouteBinaryMessage(
911 kRouteId, std::move(expected_binary_data), 910 kRouteId, expected_binary_data,
912 base::Bind(&SendMessageCallbackHandler::Invoke, 911 base::Bind(&SendMessageCallbackHandler::Invoke,
913 base::Unretained(&handler))); 912 base::Unretained(&handler)));
914 run_loop.Run(); 913 run_loop.Run();
915 } 914 }
916 915
917 namespace { 916 namespace {
918 917
919 // Used in the RouteMessages* tests to populate the messages that will be 918 // Used in the RouteMessages* tests to populate the messages that will be
920 // processed and dispatched to RouteMessageObservers. 919 // processed and dispatched to RouteMessageObservers.
921 void PopulateRouteMessages(std::vector<RouteMessage>* batch1, 920 void PopulateRouteMessages(std::vector<RouteMessage>* batch1,
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 EXPECT_CALL(mock_media_route_provider_, 1513 EXPECT_CALL(mock_media_route_provider_,
1515 UpdateMediaSinks(MediaSourceForDesktop().id())) 1514 UpdateMediaSinks(MediaSourceForDesktop().id()))
1516 .WillOnce(InvokeWithoutArgs([&run_loop2]() { 1515 .WillOnce(InvokeWithoutArgs([&run_loop2]() {
1517 run_loop2.Quit(); 1516 run_loop2.Quit();
1518 })); 1517 }));
1519 1518
1520 run_loop2.Run(); 1519 run_loop2.Run();
1521 } 1520 }
1522 1521
1523 } // namespace media_router 1522 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698