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 193a498c686c814297bf72a4f863e5a0c75b262a..563d9df23a8912d340ff4c70860a71cfeba30b16 100644 |
--- a/chrome/browser/extensions/api/gcd_private/gcd_private_apitest.cc |
+++ b/chrome/browser/extensions/api/gcd_private/gcd_private_apitest.cc |
@@ -130,6 +130,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. |
@@ -254,6 +270,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 |
} // namespace |