OLD | NEW |
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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "chrome/browser/media/router/offscreen_presentation_manager.h" | 9 #include "chrome/browser/media/router/offscreen_presentation_manager.h" |
10 #include "chrome/browser/media/router/test_helper.h" | 10 #include "chrome/browser/media/router/test_helper.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 using testing::_; | 15 using testing::_; |
16 | 16 |
17 namespace media_router { | 17 namespace media_router { |
18 | 18 |
19 namespace { | 19 namespace { |
20 const char kPresentationId[] = "presentationId"; | 20 const char kPresentationId[] = "presentationId"; |
21 const char kPresentationId2[] = "presentationId2"; | 21 const char kPresentationId2[] = "presentationId2"; |
22 const char kPresentationUrl[] = "http://www.example.com/presentation.html"; | 22 const char kPresentationUrl[] = "http://www.example.com/presentation.html"; |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 class MockReceiverConnectionAvailableCallback { | 25 class MockReceiverConnectionAvailableCallback { |
26 public: | 26 public: |
27 void OnReceiverConnectionAvailable( | 27 void OnReceiverConnectionAvailable( |
28 const content::PresentationSessionInfo& session_info, | 28 const content::PresentationSessionInfo& session_info, |
29 content::PresentationConnectionPtr connection_ptr) { | 29 content::PresentationConnectionPtr connection_ptr) { |
30 OnReceiverConnectionAvailableRaw(session_info, connection_ptr); | 30 OnReceiverConnectionAvailableRaw(session_info, connection_ptr.get()); |
31 } | 31 } |
32 | 32 |
33 MOCK_METHOD2(OnReceiverConnectionAvailableRaw, | 33 MOCK_METHOD2(OnReceiverConnectionAvailableRaw, |
34 void(const content::PresentationSessionInfo&, | 34 void(const content::PresentationSessionInfo&, |
35 content::PresentationConnectionPtr)); | 35 blink::mojom::PresentationConnection*)); |
36 }; | 36 }; |
37 | 37 |
38 class OffscreenPresentationManagerTest : public ::testing::Test { | 38 class OffscreenPresentationManagerTest : public ::testing::Test { |
39 public: | 39 public: |
40 OffscreenPresentationManagerTest() | 40 OffscreenPresentationManagerTest() |
41 : render_frame_host_id_(1, 1), presentation_url_(kPresentationUrl) {} | 41 : render_frame_host_id_(1, 1), presentation_url_(kPresentationUrl) {} |
42 | 42 |
43 OffscreenPresentationManager* manager() { return &manager_; } | 43 OffscreenPresentationManager* manager() { return &manager_; } |
44 | 44 |
45 void VerifyPresentationsSize(size_t expected) { | 45 void VerifyPresentationsSize(size_t expected) { |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 .Times(1); | 288 .Times(1); |
289 RegisterReceiver(kPresentationId2, receiver_callback2); | 289 RegisterReceiver(kPresentationId2, receiver_callback2); |
290 | 290 |
291 VerifyPresentationsSize(2); | 291 VerifyPresentationsSize(2); |
292 | 292 |
293 UnregisterReceiver(); | 293 UnregisterReceiver(); |
294 VerifyPresentationsSize(1); | 294 VerifyPresentationsSize(1); |
295 } | 295 } |
296 | 296 |
297 } // namespace media_router | 297 } // namespace media_router |
OLD | NEW |