1 // Copyright 2019 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 CAST_COMMON_PUBLIC_TESTING_DISCOVERY_UTILS_H_ 6 #define CAST_COMMON_PUBLIC_TESTING_DISCOVERY_UTILS_H_ 7 8 #include <string> 9 10 #include "cast/common/public/service_info.h" 11 #include "discovery/dnssd/public/dns_sd_txt_record.h" 12 #include "gmock/gmock.h" 13 #include "gtest/gtest.h" 14 #include "platform/base/ip_address.h" 15 16 namespace openscreen { 17 namespace cast { 18 19 // Constants used for testing. 20 extern const IPAddress kAddressV4; 21 extern const IPAddress kAddressV6; 22 constexpr uint16_t kPort = 80; 23 extern const IPEndpoint kEndpointV4; 24 extern const IPEndpoint kEndpointV6; 25 constexpr char kTestUniqueId[] = "1234"; 26 constexpr char kFriendlyName[] = "Friendly Name 123"; 27 constexpr char kModelName[] = "Openscreen"; 28 constexpr char kInstanceId[] = "Openscreen-1234"; 29 constexpr uint8_t kTestVersion = 5; 30 constexpr char kCapabilitiesString[] = "3"; 31 constexpr char kCapabilitiesStringLong[] = "000003"; 32 constexpr uint64_t kCapabilitiesParsed = 0x03; 33 constexpr uint8_t kStatus = 0x01; 34 constexpr ReceiverStatus kStatusParsed = ReceiverStatus::kBusy; 35 36 discovery::DnsSdTxtRecord CreateValidTxt(); 37 38 void CompareTxtString(const discovery::DnsSdTxtRecord& txt, 39 const std::string& key, 40 const std::string& expected); 41 42 void CompareTxtInt(const discovery::DnsSdTxtRecord& txt, 43 const std::string& key, 44 int expected); 45 46 } // namespace cast 47 } // namespace openscreen 48 49 #endif // CAST_COMMON_PUBLIC_TESTING_DISCOVERY_UTILS_H_ 50