OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_MEDIA_SINK_SERVICE_IMPL_
H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_MEDIA_SINK_SERVICE_IMPL_
H_ |
6 #define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_MEDIA_SINK_SERVICE_IMPL_
H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_MEDIA_SINK_SERVICE_IMPL_
H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 void SetDialRegistryForTest(DialRegistry* dial_registry); | 40 void SetDialRegistryForTest(DialRegistry* dial_registry); |
41 void SetDescriptionServiceForTest( | 41 void SetDescriptionServiceForTest( |
42 std::unique_ptr<DeviceDescriptionService> description_service); | 42 std::unique_ptr<DeviceDescriptionService> description_service); |
43 | 43 |
44 private: | 44 private: |
45 friend class DialMediaSinkServiceImplTest; | 45 friend class DialMediaSinkServiceImplTest; |
46 FRIEND_TEST_ALL_PREFIXES(DialMediaSinkServiceImplTest, TestStart); | 46 FRIEND_TEST_ALL_PREFIXES(DialMediaSinkServiceImplTest, TestStart); |
47 FRIEND_TEST_ALL_PREFIXES(DialMediaSinkServiceImplTest, TestTimer); | 47 FRIEND_TEST_ALL_PREFIXES(DialMediaSinkServiceImplTest, TestTimer); |
48 FRIEND_TEST_ALL_PREFIXES(DialMediaSinkServiceImplTest, | 48 FRIEND_TEST_ALL_PREFIXES(DialMediaSinkServiceImplTest, |
49 TestOnDeviceDescriptionAvailable); | 49 TestOnDeviceDescriptionAvailable); |
| 50 FRIEND_TEST_ALL_PREFIXES(DialMediaSinkServiceImplTest, TestRestartAfterStop); |
50 | 51 |
51 // api::dial::DialRegistry::Observer implementation | 52 // api::dial::DialRegistry::Observer implementation |
52 void OnDialDeviceEvent(const DialRegistry::DeviceList& devices) override; | 53 void OnDialDeviceEvent(const DialRegistry::DeviceList& devices) override; |
53 void OnDialError(DialRegistry::DialErrorCode type) override; | 54 void OnDialError(DialRegistry::DialErrorCode type) override; |
54 | 55 |
55 // Called when description service successfully fetches and parses device | 56 // Called when description service successfully fetches and parses device |
56 // description XML. Restart |finish_timer_| if it is not running. | 57 // description XML. Restart |finish_timer_| if it is not running. |
57 void OnDeviceDescriptionAvailable( | 58 void OnDeviceDescriptionAvailable( |
58 const DialDeviceData& device_data, | 59 const DialDeviceData& device_data, |
59 const ParsedDialDeviceDescription& description_data); | 60 const ParsedDialDeviceDescription& description_data); |
60 | 61 |
61 // Called when fails to fetch or parse device description XML. | 62 // Called when fails to fetch or parse device description XML. |
62 void OnDeviceDescriptionError(const DialDeviceData& device, | 63 void OnDeviceDescriptionError(const DialDeviceData& device, |
63 const std::string& error_message); | 64 const std::string& error_message); |
64 | 65 |
65 std::unique_ptr<DeviceDescriptionService> description_service_; | 66 std::unique_ptr<DeviceDescriptionService> description_service_; |
66 | 67 |
67 // Raw pointer to DialRegistry singleton. | 68 // Raw pointer to DialRegistry singleton. |
68 DialRegistry* dial_registry_ = nullptr; | 69 DialRegistry* dial_registry_ = nullptr; |
69 | 70 |
| 71 // DialRegistry for unit test. |
| 72 DialRegistry* test_dial_registry_ = nullptr; |
| 73 |
70 // Device data list from current round of discovery. | 74 // Device data list from current round of discovery. |
71 DialRegistry::DeviceList current_devices_; | 75 DialRegistry::DeviceList current_devices_; |
72 | 76 |
73 scoped_refptr<net::URLRequestContextGetter> request_context_; | 77 scoped_refptr<net::URLRequestContextGetter> request_context_; |
74 }; | 78 }; |
75 | 79 |
76 } // namespace media_router | 80 } // namespace media_router |
77 | 81 |
78 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_MEDIA_SINK_SERVICE_IM
PL_H_ | 82 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_DIAL_DIAL_MEDIA_SINK_SERVICE_IM
PL_H_ |
OLD | NEW |