Index: chrome/browser/extensions/api/gcd_private/gcd_private_apitest.cc |
diff --git a/chrome/browser/extensions/api/gcd_private/gcd_private_apitest.cc b/chrome/browser/extensions/api/gcd_private/gcd_private_apitest.cc |
index 35967120dda53aa11892a3799d0f8960a83c10d2..1476f24d1ef6c92c464fdd598efb0ea5afb95833 100644 |
--- a/chrome/browser/extensions/api/gcd_private/gcd_private_apitest.cc |
+++ b/chrome/browser/extensions/api/gcd_private/gcd_private_apitest.cc |
@@ -138,6 +138,22 @@ const uint8 kGoodbyePacket[] = { |
'o', 'c', 'a', 'l', 0x00, |
}; |
+const uint8 kQueryPacket[] = { |
+ // Header |
+ 0x00, 0x00, // ID is zeroed out |
+ 0x00, 0x00, // No flags. |
+ 0x00, 0x01, // One question. |
+ 0x00, 0x00, // 0 RRs (answers) |
+ 0x00, 0x00, // 0 authority RRs |
+ 0x00, 0x00, // 0 additional RRs |
+ |
+ // Question |
+ // This part is echoed back from the respective query. |
+ 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't', 0x04, '_', 't', 'c', |
+ 'p', 0x05, 'l', 'o', 'c', 'a', 'l', 0x00, 0x00, 0x0c, // TYPE is PTR. |
+ 0x00, 0x01, // CLASS is IN. |
+}; |
+ |
#endif // ENABLE_MDNS |
// Sentinel value to signify the request should fail. |
@@ -308,6 +324,14 @@ IN_PROC_BROWSER_TEST_F(GcdPrivateAPITest, AddRemove) { |
EXPECT_TRUE(RunExtensionSubtest("gcd_private/api", "remove_device.html")); |
} |
+IN_PROC_BROWSER_TEST_F(GcdPrivateAPITest, SendQuery) { |
+ EXPECT_CALL(*test_service_discovery_client_, |
+ OnSendTo(std::string(reinterpret_cast<const char*>(kQueryPacket), |
+ sizeof(kQueryPacket)))).Times(2); |
+ |
+ EXPECT_TRUE(RunExtensionSubtest("gcd_private/api", "send_query.html")); |
+} |
+ |
#endif // ENABLE_MDNS |
#if defined(ENABLE_WIFI_BOOTSTRAPPING) |
@@ -331,6 +355,7 @@ IN_PROC_BROWSER_TEST_F(GcdPrivateAPITest, WifiAddRemove) { |
EXPECT_TRUE( |
RunExtensionSubtest("gcd_private/api", "remove_wifi_device.html")); |
} |
+ |
#endif |
} // namespace |