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

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

Issue 387453002: Re-submit of https://codereview.chromium.org/356613002 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Thu 07/10/2014 2:23:32.16 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..bd502da2b7ed4336abd3b254b28d5f1595b3ffef 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,18 @@ IN_PROC_BROWSER_TEST_F(GcdPrivateAPITest, AddRemove) {
EXPECT_TRUE(RunExtensionSubtest("gcd_private/api", "remove_device.html"));
}
+IN_PROC_BROWSER_TEST_F(GcdPrivateAPITest, SendQuery) {
+// TODO(noamsml): Win Dbg has a workaround that makes RunExtensionSubtest
+// always return true without actually running the test. Remove when fixed.
+// See http://crbug.com/177163 for details.
+#if !defined(OS_WIN) || defined(NDEBUG)
+ EXPECT_CALL(*test_service_discovery_client_,
+ OnSendTo(std::string(reinterpret_cast<const char*>(kQueryPacket),
+ sizeof(kQueryPacket)))).Times(2);
+#endif
+ EXPECT_TRUE(RunExtensionSubtest("gcd_private/api", "send_query.html"));
+}
+
#endif // ENABLE_MDNS
} // namespace

Powered by Google App Engine
This is Rietveld 408576698