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

Unified Diff: chrome/utility/local_discovery/service_discovery_client_unittest.cc

Issue 21534003: avoid char+'\xHH' as it's too easy to use values > 127 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: corresponding change in chrome unit tests Created 7 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
« no previous file with comments | « chrome/utility/local_discovery/local_domain_resolver_unittest.cc ('k') | net/dns/mdns_client_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/utility/local_discovery/service_discovery_client_unittest.cc
diff --git a/chrome/utility/local_discovery/service_discovery_client_unittest.cc b/chrome/utility/local_discovery/service_discovery_client_unittest.cc
index b79d86ebcbe2a8c33f4861153af561897a18d762..2f7a15db4a6774ad0fc39740732c281f0e639d25 100644
--- a/chrome/utility/local_discovery/service_discovery_client_unittest.cc
+++ b/chrome/utility/local_discovery/service_discovery_client_unittest.cc
@@ -26,113 +26,113 @@ namespace local_discovery {
namespace {
-const char kSamplePacketPTR[] = {
+const uint8 kSamplePacketPTR[] = {
// Header
- '\x00', '\x00', // ID is zeroed out
- '\x81', '\x80', // Standard query response, RA, no error
- '\x00', '\x00', // No questions (for simplicity)
- '\x00', '\x01', // 1 RR (answers)
- '\x00', '\x00', // 0 authority RRs
- '\x00', '\x00', // 0 additional RRs
-
- '\x07', '_', 'p', 'r', 'i', 'v', 'e', 't',
- '\x04', '_', 't', 'c', 'p',
- '\x05', 'l', 'o', 'c', 'a', 'l',
- '\x00',
- '\x00', '\x0c', // TYPE is PTR.
- '\x00', '\x01', // CLASS is IN.
- '\x00', '\x00', // TTL (4 bytes) is 1 second.
- '\x00', '\x01',
- '\x00', '\x08', // RDLENGTH is 8 bytes.
- '\x05', 'h', 'e', 'l', 'l', 'o',
- '\xc0', '\x0c'
+ 0x00, 0x00, // ID is zeroed out
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x00, // No questions (for simplicity)
+ 0x00, 0x01, // 1 RR (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
+
+ 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.
+ 0x00, 0x00, // TTL (4 bytes) is 1 second.
+ 0x00, 0x01,
+ 0x00, 0x08, // RDLENGTH is 8 bytes.
+ 0x05, 'h', 'e', 'l', 'l', 'o',
+ 0xc0, 0x0c
};
-const char kSamplePacketSRV[] = {
+const uint8 kSamplePacketSRV[] = {
// Header
- '\x00', '\x00', // ID is zeroed out
- '\x81', '\x80', // Standard query response, RA, no error
- '\x00', '\x00', // No questions (for simplicity)
- '\x00', '\x01', // 1 RR (answers)
- '\x00', '\x00', // 0 authority RRs
- '\x00', '\x00', // 0 additional RRs
-
- '\x05', 'h', 'e', 'l', 'l', 'o',
- '\x07', '_', 'p', 'r', 'i', 'v', 'e', 't',
- '\x04', '_', 't', 'c', 'p',
- '\x05', 'l', 'o', 'c', 'a', 'l',
- '\x00',
- '\x00', '\x21', // TYPE is SRV.
- '\x00', '\x01', // CLASS is IN.
- '\x00', '\x00', // TTL (4 bytes) is 1 second.
- '\x00', '\x01',
- '\x00', '\x15', // RDLENGTH is 21 bytes.
- '\x00', '\x00',
- '\x00', '\x00',
- '\x22', '\xb8', // port 8888
- '\x07', 'm', 'y', 'h', 'e', 'l', 'l', 'o',
- '\x05', 'l', 'o', 'c', 'a', 'l',
- '\x00',
+ 0x00, 0x00, // ID is zeroed out
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x00, // No questions (for simplicity)
+ 0x00, 0x01, // 1 RR (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
+
+ 0x05, 'h', 'e', 'l', 'l', 'o',
+ 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't',
+ 0x04, '_', 't', 'c', 'p',
+ 0x05, 'l', 'o', 'c', 'a', 'l',
+ 0x00,
+ 0x00, 0x21, // TYPE is SRV.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x00, // TTL (4 bytes) is 1 second.
+ 0x00, 0x01,
+ 0x00, 0x15, // RDLENGTH is 21 bytes.
+ 0x00, 0x00,
+ 0x00, 0x00,
+ 0x22, 0xb8, // port 8888
+ 0x07, 'm', 'y', 'h', 'e', 'l', 'l', 'o',
+ 0x05, 'l', 'o', 'c', 'a', 'l',
+ 0x00,
};
-const char kSamplePacketTXT[] = {
+const uint8 kSamplePacketTXT[] = {
// Header
- '\x00', '\x00', // ID is zeroed out
- '\x81', '\x80', // Standard query response, RA, no error
- '\x00', '\x00', // No questions (for simplicity)
- '\x00', '\x01', // 1 RR (answers)
- '\x00', '\x00', // 0 authority RRs
- '\x00', '\x00', // 0 additional RRs
-
- '\x05', 'h', 'e', 'l', 'l', 'o',
- '\x07', '_', 'p', 'r', 'i', 'v', 'e', 't',
- '\x04', '_', 't', 'c', 'p',
- '\x05', 'l', 'o', 'c', 'a', 'l',
- '\x00',
- '\x00', '\x10', // TYPE is PTR.
- '\x00', '\x01', // CLASS is IN.
- '\x00', '\x00', // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
- '\x00', '\x01',
- '\x00', '\x06', // RDLENGTH is 21 bytes.
- '\x05', 'h', 'e', 'l', 'l', 'o'
+ 0x00, 0x00, // ID is zeroed out
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x00, // No questions (for simplicity)
+ 0x00, 0x01, // 1 RR (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
+
+ 0x05, 'h', 'e', 'l', 'l', 'o',
+ 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't',
+ 0x04, '_', 't', 'c', 'p',
+ 0x05, 'l', 'o', 'c', 'a', 'l',
+ 0x00,
+ 0x00, 0x10, // TYPE is PTR.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x00, // TTL (4 bytes) is 20 hours, 47 minutes, 48 seconds.
+ 0x00, 0x01,
+ 0x00, 0x06, // RDLENGTH is 21 bytes.
+ 0x05, 'h', 'e', 'l', 'l', 'o'
};
-const char kSamplePacketSRVA[] = {
+const uint8 kSamplePacketSRVA[] = {
// Header
- '\x00', '\x00', // ID is zeroed out
- '\x81', '\x80', // Standard query response, RA, no error
- '\x00', '\x00', // No questions (for simplicity)
- '\x00', '\x02', // 2 RR (answers)
- '\x00', '\x00', // 0 authority RRs
- '\x00', '\x00', // 0 additional RRs
-
- '\x05', 'h', 'e', 'l', 'l', 'o',
- '\x07', '_', 'p', 'r', 'i', 'v', 'e', 't',
- '\x04', '_', 't', 'c', 'p',
- '\x05', 'l', 'o', 'c', 'a', 'l',
- '\x00',
- '\x00', '\x21', // TYPE is SRV.
- '\x00', '\x01', // CLASS is IN.
- '\x00', '\x00', // TTL (4 bytes) is 16 seconds.
- '\x00', '\x10',
- '\x00', '\x15', // RDLENGTH is 21 bytes.
- '\x00', '\x00',
- '\x00', '\x00',
- '\x22', '\xb8', // port 8888
- '\x07', 'm', 'y', 'h', 'e', 'l', 'l', 'o',
- '\x05', 'l', 'o', 'c', 'a', 'l',
- '\x00',
-
- '\x07', 'm', 'y', 'h', 'e', 'l', 'l', 'o',
- '\x05', 'l', 'o', 'c', 'a', 'l',
- '\x00',
- '\x00', '\x01', // TYPE is A.
- '\x00', '\x01', // CLASS is IN.
- '\x00', '\x00', // TTL (4 bytes) is 16 seconds.
- '\x00', '\x10',
- '\x00', '\x04', // RDLENGTH is 4 bytes.
- '\x01', '\x02',
- '\x03', '\x04',
+ 0x00, 0x00, // ID is zeroed out
+ 0x81, 0x80, // Standard query response, RA, no error
+ 0x00, 0x00, // No questions (for simplicity)
+ 0x00, 0x02, // 2 RR (answers)
+ 0x00, 0x00, // 0 authority RRs
+ 0x00, 0x00, // 0 additional RRs
+
+ 0x05, 'h', 'e', 'l', 'l', 'o',
+ 0x07, '_', 'p', 'r', 'i', 'v', 'e', 't',
+ 0x04, '_', 't', 'c', 'p',
+ 0x05, 'l', 'o', 'c', 'a', 'l',
+ 0x00,
+ 0x00, 0x21, // TYPE is SRV.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x00, // TTL (4 bytes) is 16 seconds.
+ 0x00, 0x10,
+ 0x00, 0x15, // RDLENGTH is 21 bytes.
+ 0x00, 0x00,
+ 0x00, 0x00,
+ 0x22, 0xb8, // port 8888
+ 0x07, 'm', 'y', 'h', 'e', 'l', 'l', 'o',
+ 0x05, 'l', 'o', 'c', 'a', 'l',
+ 0x00,
+
+ 0x07, 'm', 'y', 'h', 'e', 'l', 'l', 'o',
+ 0x05, 'l', 'o', 'c', 'a', 'l',
+ 0x00,
+ 0x00, 0x01, // TYPE is A.
+ 0x00, 0x01, // CLASS is IN.
+ 0x00, 0x00, // TTL (4 bytes) is 16 seconds.
+ 0x00, 0x10,
+ 0x00, 0x04, // RDLENGTH is 4 bytes.
+ 0x01, 0x02,
+ 0x03, 0x04,
};
class MockServiceWatcherClient {
« no previous file with comments | « chrome/utility/local_discovery/local_domain_resolver_unittest.cc ('k') | net/dns/mdns_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698