Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5149)

Unified Diff: chrome/browser/extensions/api/gcd_private/gcd_private_apitest.cc

Issue 356613002: Add queryForNewLocalDevices to gcdPrivate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « chrome/browser/extensions/api/gcd_private/gcd_private_api.cc ('k') | chrome/common/extensions/api/gcd_private.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698