Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_UTILITY_MEDIA_ROUTER_DIAL_DEVICE_DESCRIPTION_PARSER_IMPL_H_ | |
| 6 #define CHROME_UTILITY_MEDIA_ROUTER_DIAL_DEVICE_DESCRIPTION_PARSER_IMPL_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "chrome/common/media_router/dial_device_description_parser.mojom.h" | |
| 10 | |
| 11 namespace media_router { | |
| 12 | |
| 13 // Implementation of Mojo DialDeviceDescriptionParser. It accepts device | |
| 14 // description parsing request from browser process, and handles it in utility | |
| 15 // process. Class must be created and destroyed on utility thread. | |
| 16 class DialDeviceDescriptionParserImpl | |
| 17 : public chrome::mojom::DialDeviceDescriptionParser { | |
| 18 public: | |
| 19 DialDeviceDescriptionParserImpl(); | |
| 20 ~DialDeviceDescriptionParserImpl() override; | |
| 21 | |
| 22 static void Create(chrome::mojom::DialDeviceDescriptionParserRequest request); | |
| 23 | |
| 24 private: | |
| 25 FRIEND_TEST_ALL_PREFIXES(DialDeviceDescriptionParserImplTest, TestInvalidXml); | |
| 26 FRIEND_TEST_ALL_PREFIXES(DialDeviceDescriptionParserImplTest, | |
| 27 TestScrubXmlForLogging); | |
| 28 FRIEND_TEST_ALL_PREFIXES(DialDeviceDescriptionParserImplTest, TestParse); | |
| 29 FRIEND_TEST_ALL_PREFIXES(DialDeviceDescriptionParserImplTest, | |
| 30 TestParseWithSpecialCharacter); | |
| 31 FRIEND_TEST_ALL_PREFIXES(DialDeviceDescriptionParserImplTest, | |
| 32 TestParseWithoutFriendlyNameModelName); | |
| 33 FRIEND_TEST_ALL_PREFIXES(DialDeviceDescriptionParserImplTest, | |
| 34 TestParseWithoutFriendlyName); | |
|
dcheng
2017/03/22 09:53:02
FWIW, it might be easier to just add a test fixtur
zhaobin
2017/03/22 19:18:52
Done.
| |
| 35 | |
| 36 // extensions::mojom::DialDeviceDescriptionParser: | |
| 37 void ParseDialDeviceDescription( | |
| 38 const std::string& device_description_xml_data, | |
| 39 const ParseDialDeviceDescriptionCallback& callback) override; | |
| 40 | |
| 41 // Processes the result of getting device description. Returns true and | |
| 42 // populates corresponding fields in |dial_device_description_| if processing | |
| 43 // succeeds; otherwise returns false. | |
| 44 // |xml|: The device description xml text. | |
| 45 // |out|: Parsed device description object. | |
| 46 bool Parse(const std::string& xml, media_router::DialDeviceDescription* out); | |
| 47 | |
| 48 base::ThreadChecker thread_checker_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(DialDeviceDescriptionParserImpl); | |
| 51 }; | |
| 52 | |
| 53 } // namespace media_router | |
| 54 | |
| 55 #endif // CHROME_UTILITY_MEDIA_ROUTER_DIAL_DEVICE_DESCRIPTION_PARSER_IMPL_H_ | |
| OLD | NEW |