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

Side by Side Diff: util/mac/launchd_test.mm

Issue 1565873002: Update mini_chromium to a43fee120b10ed71df4e55a370948ca461d78232 (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « util/mac/launchd.mm ('k') | util/mac/service_management.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 @0x8000000000000000, 55 @0x8000000000000000,
56 @0xffffffffffffffff, 56 @0xffffffffffffffff,
57 @0x0123456789abcdef, 57 @0x0123456789abcdef,
58 @0xfedcba9876543210, 58 @0xfedcba9876543210,
59 }; 59 };
60 60
61 for (size_t index = 0; index < arraysize(integer_nses); ++index) { 61 for (size_t index = 0; index < arraysize(integer_nses); ++index) {
62 NSNumber* integer_ns = integer_nses[index]; 62 NSNumber* integer_ns = integer_nses[index];
63 launch_data.reset(CFPropertyToLaunchData(integer_ns)); 63 launch_data.reset(CFPropertyToLaunchData(integer_ns));
64 ASSERT_TRUE(launch_data.get()); 64 ASSERT_TRUE(launch_data.get());
65 ASSERT_EQ(LAUNCH_DATA_INTEGER, LaunchDataGetType(launch_data)); 65 ASSERT_EQ(LAUNCH_DATA_INTEGER, LaunchDataGetType(launch_data.get()));
66 EXPECT_EQ([integer_ns longLongValue], LaunchDataGetInteger(launch_data)) 66 EXPECT_EQ([integer_ns longLongValue],
67 LaunchDataGetInteger(launch_data.get()))
67 << "index " << index; 68 << "index " << index;
68 } 69 }
69 } 70 }
70 } 71 }
71 72
72 TEST(Launchd, CFPropertyToLaunchData_FloatingPoint) { 73 TEST(Launchd, CFPropertyToLaunchData_FloatingPoint) {
73 @autoreleasepool { 74 @autoreleasepool {
74 base::mac::ScopedLaunchData launch_data; 75 base::mac::ScopedLaunchData launch_data;
75 76
76 NSNumber* double_nses[] = { 77 NSNumber* double_nses[] = {
77 @0.0, 78 @0.0,
78 @1.0, 79 @1.0,
79 @-1.0, 80 @-1.0,
80 [NSNumber numberWithFloat:std::numeric_limits<float>::min()], 81 [NSNumber numberWithFloat:std::numeric_limits<float>::min()],
81 [NSNumber numberWithFloat:std::numeric_limits<float>::max()], 82 [NSNumber numberWithFloat:std::numeric_limits<float>::max()],
82 [NSNumber numberWithDouble:std::numeric_limits<double>::min()], 83 [NSNumber numberWithDouble:std::numeric_limits<double>::min()],
83 [NSNumber numberWithDouble:std::numeric_limits<double>::max()], 84 [NSNumber numberWithDouble:std::numeric_limits<double>::max()],
84 @3.1415926535897932, 85 @3.1415926535897932,
85 [NSNumber numberWithDouble:std::numeric_limits<double>::infinity()], 86 [NSNumber numberWithDouble:std::numeric_limits<double>::infinity()],
86 [NSNumber numberWithDouble:std::numeric_limits<double>::quiet_NaN()], 87 [NSNumber numberWithDouble:std::numeric_limits<double>::quiet_NaN()],
87 [NSNumber numberWithDouble:std::numeric_limits<double>::signaling_NaN()], 88 [NSNumber numberWithDouble:std::numeric_limits<double>::signaling_NaN()],
88 }; 89 };
89 90
90 for (size_t index = 0; index < arraysize(double_nses); ++index) { 91 for (size_t index = 0; index < arraysize(double_nses); ++index) {
91 NSNumber* double_ns = double_nses[index]; 92 NSNumber* double_ns = double_nses[index];
92 launch_data.reset(CFPropertyToLaunchData(double_ns)); 93 launch_data.reset(CFPropertyToLaunchData(double_ns));
93 ASSERT_TRUE(launch_data.get()); 94 ASSERT_TRUE(launch_data.get());
94 ASSERT_EQ(LAUNCH_DATA_REAL, LaunchDataGetType(launch_data)); 95 ASSERT_EQ(LAUNCH_DATA_REAL, LaunchDataGetType(launch_data.get()));
95 double expected_double_value = [double_ns doubleValue]; 96 double expected_double_value = [double_ns doubleValue];
96 double observed_double_value = LaunchDataGetReal(launch_data); 97 double observed_double_value = LaunchDataGetReal(launch_data.get());
97 bool expected_is_nan = std::isnan(expected_double_value); 98 bool expected_is_nan = std::isnan(expected_double_value);
98 EXPECT_EQ(expected_is_nan, std::isnan(observed_double_value)); 99 EXPECT_EQ(expected_is_nan, std::isnan(observed_double_value));
99 if (!expected_is_nan) { 100 if (!expected_is_nan) {
100 EXPECT_DOUBLE_EQ(expected_double_value, observed_double_value) 101 EXPECT_DOUBLE_EQ(expected_double_value, observed_double_value)
101 << "index " << index; 102 << "index " << index;
102 } 103 }
103 } 104 }
104 } 105 }
105 } 106 }
106 107
107 TEST(Launchd, CFPropertyToLaunchData_Boolean) { 108 TEST(Launchd, CFPropertyToLaunchData_Boolean) {
108 @autoreleasepool { 109 @autoreleasepool {
109 base::mac::ScopedLaunchData launch_data; 110 base::mac::ScopedLaunchData launch_data;
110 111
111 NSNumber* bool_nses[] = { 112 NSNumber* bool_nses[] = {
112 @NO, 113 @NO,
113 @YES, 114 @YES,
114 }; 115 };
115 116
116 for (size_t index = 0; index < arraysize(bool_nses); ++index) { 117 for (size_t index = 0; index < arraysize(bool_nses); ++index) {
117 NSNumber* bool_ns = bool_nses[index]; 118 NSNumber* bool_ns = bool_nses[index];
118 launch_data.reset(CFPropertyToLaunchData(bool_ns)); 119 launch_data.reset(CFPropertyToLaunchData(bool_ns));
119 ASSERT_TRUE(launch_data.get()); 120 ASSERT_TRUE(launch_data.get());
120 ASSERT_EQ(LAUNCH_DATA_BOOL, LaunchDataGetType(launch_data)); 121 ASSERT_EQ(LAUNCH_DATA_BOOL, LaunchDataGetType(launch_data.get()));
121 if ([bool_ns boolValue]) { 122 if ([bool_ns boolValue]) {
122 EXPECT_TRUE(LaunchDataGetBool(launch_data)); 123 EXPECT_TRUE(LaunchDataGetBool(launch_data.get()));
123 } else { 124 } else {
124 EXPECT_FALSE(LaunchDataGetBool(launch_data)); 125 EXPECT_FALSE(LaunchDataGetBool(launch_data.get()));
125 } 126 }
126 } 127 }
127 } 128 }
128 } 129 }
129 130
130 TEST(Launchd, CFPropertyToLaunchData_String) { 131 TEST(Launchd, CFPropertyToLaunchData_String) {
131 @autoreleasepool { 132 @autoreleasepool {
132 base::mac::ScopedLaunchData launch_data; 133 base::mac::ScopedLaunchData launch_data;
133 134
134 NSString* string_nses[] = { 135 NSString* string_nses[] = {
135 @"", 136 @"",
136 @"string", 137 @"string",
137 @"Üñîçø∂é", 138 @"Üñîçø∂é",
138 }; 139 };
139 140
140 for (size_t index = 0; index < arraysize(string_nses); ++index) { 141 for (size_t index = 0; index < arraysize(string_nses); ++index) {
141 NSString* string_ns = string_nses[index]; 142 NSString* string_ns = string_nses[index];
142 launch_data.reset(CFPropertyToLaunchData(string_ns)); 143 launch_data.reset(CFPropertyToLaunchData(string_ns));
143 ASSERT_TRUE(launch_data.get()); 144 ASSERT_TRUE(launch_data.get());
144 ASSERT_EQ(LAUNCH_DATA_STRING, LaunchDataGetType(launch_data)); 145 ASSERT_EQ(LAUNCH_DATA_STRING, LaunchDataGetType(launch_data.get()));
145 EXPECT_STREQ([string_ns UTF8String], LaunchDataGetString(launch_data)); 146 EXPECT_STREQ([string_ns UTF8String],
147 LaunchDataGetString(launch_data.get()));
146 } 148 }
147 } 149 }
148 } 150 }
149 151
150 TEST(Launchd, CFPropertyToLaunchData_Data) { 152 TEST(Launchd, CFPropertyToLaunchData_Data) {
151 @autoreleasepool { 153 @autoreleasepool {
152 base::mac::ScopedLaunchData launch_data; 154 base::mac::ScopedLaunchData launch_data;
153 155
154 const uint8_t data_c[] = { 156 const uint8_t data_c[] = {
155 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 9, 8, 7, 6, 5, 4, 3, 2}; 157 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 9, 8, 7, 6, 5, 4, 3, 2};
156 NSData* data_ns = [NSData dataWithBytes:data_c length:sizeof(data_c)]; 158 NSData* data_ns = [NSData dataWithBytes:data_c length:sizeof(data_c)];
157 launch_data.reset(CFPropertyToLaunchData(data_ns)); 159 launch_data.reset(CFPropertyToLaunchData(data_ns));
158 ASSERT_TRUE(launch_data.get()); 160 ASSERT_TRUE(launch_data.get());
159 ASSERT_EQ(LAUNCH_DATA_OPAQUE, LaunchDataGetType(launch_data)); 161 ASSERT_EQ(LAUNCH_DATA_OPAQUE, LaunchDataGetType(launch_data.get()));
160 EXPECT_EQ(sizeof(data_c), LaunchDataGetOpaqueSize(launch_data)); 162 EXPECT_EQ(sizeof(data_c), LaunchDataGetOpaqueSize(launch_data.get()));
161 EXPECT_EQ(0, 163 EXPECT_EQ(
162 memcmp(LaunchDataGetOpaque(launch_data), data_c, sizeof(data_c))); 164 0,
165 memcmp(LaunchDataGetOpaque(launch_data.get()), data_c, sizeof(data_c)));
163 } 166 }
164 } 167 }
165 168
166 TEST(Launchd, CFPropertyToLaunchData_Dictionary) { 169 TEST(Launchd, CFPropertyToLaunchData_Dictionary) {
167 @autoreleasepool { 170 @autoreleasepool {
168 base::mac::ScopedLaunchData launch_data; 171 base::mac::ScopedLaunchData launch_data;
169 172
170 NSDictionary* dictionary_ns = @{ 173 NSDictionary* dictionary_ns = @{
171 @"key" : @"value", 174 @"key" : @"value",
172 }; 175 };
173 176
174 launch_data.reset(CFPropertyToLaunchData(dictionary_ns)); 177 launch_data.reset(CFPropertyToLaunchData(dictionary_ns));
175 ASSERT_TRUE(launch_data.get()); 178 ASSERT_TRUE(launch_data.get());
176 ASSERT_EQ(LAUNCH_DATA_DICTIONARY, LaunchDataGetType(launch_data)); 179 ASSERT_EQ(LAUNCH_DATA_DICTIONARY, LaunchDataGetType(launch_data.get()));
177 EXPECT_EQ([dictionary_ns count], LaunchDataDictGetCount(launch_data)); 180 EXPECT_EQ([dictionary_ns count], LaunchDataDictGetCount(launch_data.get()));
178 181
179 launch_data_t launch_lookup_data = LaunchDataDictLookup(launch_data, "key"); 182 launch_data_t launch_lookup_data =
183 LaunchDataDictLookup(launch_data.get(), "key");
180 ASSERT_TRUE(launch_lookup_data); 184 ASSERT_TRUE(launch_lookup_data);
181 ASSERT_EQ(LAUNCH_DATA_STRING, LaunchDataGetType(launch_lookup_data)); 185 ASSERT_EQ(LAUNCH_DATA_STRING, LaunchDataGetType(launch_lookup_data));
182 EXPECT_STREQ("value", LaunchDataGetString(launch_lookup_data)); 186 EXPECT_STREQ("value", LaunchDataGetString(launch_lookup_data));
183 } 187 }
184 } 188 }
185 189
186 TEST(Launchd, CFPropertyToLaunchData_Array) { 190 TEST(Launchd, CFPropertyToLaunchData_Array) {
187 @autoreleasepool { 191 @autoreleasepool {
188 base::mac::ScopedLaunchData launch_data; 192 base::mac::ScopedLaunchData launch_data;
189 193
190 NSArray* array_ns = @[ @"element_1", @"element_2", ]; 194 NSArray* array_ns = @[ @"element_1", @"element_2", ];
191 195
192 launch_data.reset(CFPropertyToLaunchData(array_ns)); 196 launch_data.reset(CFPropertyToLaunchData(array_ns));
193 ASSERT_TRUE(launch_data.get()); 197 ASSERT_TRUE(launch_data.get());
194 ASSERT_EQ(LAUNCH_DATA_ARRAY, LaunchDataGetType(launch_data)); 198 ASSERT_EQ(LAUNCH_DATA_ARRAY, LaunchDataGetType(launch_data.get()));
195 EXPECT_EQ([array_ns count], LaunchDataArrayGetCount(launch_data)); 199 EXPECT_EQ([array_ns count], LaunchDataArrayGetCount(launch_data.get()));
196 200
197 launch_data_t launch_lookup_data = LaunchDataArrayGetIndex(launch_data, 0); 201 launch_data_t launch_lookup_data =
202 LaunchDataArrayGetIndex(launch_data.get(), 0);
198 ASSERT_TRUE(launch_lookup_data); 203 ASSERT_TRUE(launch_lookup_data);
199 ASSERT_EQ(LAUNCH_DATA_STRING, LaunchDataGetType(launch_lookup_data)); 204 ASSERT_EQ(LAUNCH_DATA_STRING, LaunchDataGetType(launch_lookup_data));
200 EXPECT_STREQ("element_1", LaunchDataGetString(launch_lookup_data)); 205 EXPECT_STREQ("element_1", LaunchDataGetString(launch_lookup_data));
201 206
202 launch_lookup_data = LaunchDataArrayGetIndex(launch_data, 1); 207 launch_lookup_data = LaunchDataArrayGetIndex(launch_data.get(), 1);
203 ASSERT_TRUE(launch_lookup_data); 208 ASSERT_TRUE(launch_lookup_data);
204 ASSERT_EQ(LAUNCH_DATA_STRING, LaunchDataGetType(launch_lookup_data)); 209 ASSERT_EQ(LAUNCH_DATA_STRING, LaunchDataGetType(launch_lookup_data));
205 EXPECT_STREQ("element_2", LaunchDataGetString(launch_lookup_data)); 210 EXPECT_STREQ("element_2", LaunchDataGetString(launch_lookup_data));
206 } 211 }
207 } 212 }
208 213
209 TEST(Launchd, CFPropertyToLaunchData_NSDate) { 214 TEST(Launchd, CFPropertyToLaunchData_NSDate) {
210 // Test that NSDate conversions fail as advertised. There’s no type for 215 // Test that NSDate conversions fail as advertised. There’s no type for
211 // storing date values in a launch_data_t. 216 // storing date values in a launch_data_t.
212 217
213 @autoreleasepool { 218 @autoreleasepool {
214 base::mac::ScopedLaunchData launch_data; 219 base::mac::ScopedLaunchData launch_data;
215 220
216 NSDate* date = [NSDate date]; 221 NSDate* date = [NSDate date];
217 launch_data.reset(CFPropertyToLaunchData(date)); 222 launch_data.reset(CFPropertyToLaunchData(date));
218 EXPECT_FALSE(launch_data); 223 EXPECT_FALSE(launch_data.get());
219 224
220 NSDictionary* date_dictionary = @{ 225 NSDictionary* date_dictionary = @{
221 @"key" : @"value", 226 @"key" : @"value",
222 @"date" : date, 227 @"date" : date,
223 }; 228 };
224 launch_data.reset(CFPropertyToLaunchData(date_dictionary)); 229 launch_data.reset(CFPropertyToLaunchData(date_dictionary));
225 EXPECT_FALSE(launch_data); 230 EXPECT_FALSE(launch_data.get());
226 231
227 NSArray* date_array = @[ @"string_1", date, @"string_2", ]; 232 NSArray* date_array = @[ @"string_1", date, @"string_2", ];
228 launch_data.reset(CFPropertyToLaunchData(date_array)); 233 launch_data.reset(CFPropertyToLaunchData(date_array));
229 EXPECT_FALSE(launch_data); 234 EXPECT_FALSE(launch_data.get());
230 } 235 }
231 } 236 }
232 237
233 TEST(Launchd, CFPropertyToLaunchData_RealWorldJobDictionary) { 238 TEST(Launchd, CFPropertyToLaunchData_RealWorldJobDictionary) {
234 @autoreleasepool { 239 @autoreleasepool {
235 base::mac::ScopedLaunchData launch_data; 240 base::mac::ScopedLaunchData launch_data;
236 241
237 NSDictionary* job_dictionary = @{ 242 NSDictionary* job_dictionary = @{
238 @LAUNCH_JOBKEY_LABEL : @"com.example.job.rebooter", 243 @LAUNCH_JOBKEY_LABEL : @"com.example.job.rebooter",
239 @LAUNCH_JOBKEY_ONDEMAND : @YES, 244 @LAUNCH_JOBKEY_ONDEMAND : @YES,
240 @LAUNCH_JOBKEY_PROGRAMARGUMENTS : 245 @LAUNCH_JOBKEY_PROGRAMARGUMENTS :
241 @[ @"/bin/bash", @"-c", @"/sbin/reboot", ], 246 @[ @"/bin/bash", @"-c", @"/sbin/reboot", ],
242 @LAUNCH_JOBKEY_MACHSERVICES : @{ 247 @LAUNCH_JOBKEY_MACHSERVICES : @{
243 @"com.example.service.rebooter" : @YES, 248 @"com.example.service.rebooter" : @YES,
244 }, 249 },
245 }; 250 };
246 251
247 launch_data.reset(CFPropertyToLaunchData(job_dictionary)); 252 launch_data.reset(CFPropertyToLaunchData(job_dictionary));
248 ASSERT_TRUE(launch_data.get()); 253 ASSERT_TRUE(launch_data.get());
249 ASSERT_EQ(LAUNCH_DATA_DICTIONARY, LaunchDataGetType(launch_data)); 254 ASSERT_EQ(LAUNCH_DATA_DICTIONARY, LaunchDataGetType(launch_data.get()));
250 EXPECT_EQ(4u, LaunchDataDictGetCount(launch_data)); 255 EXPECT_EQ(4u, LaunchDataDictGetCount(launch_data.get()));
251 256
252 launch_data_t launch_lookup_data = 257 launch_data_t launch_lookup_data =
253 LaunchDataDictLookup(launch_data, LAUNCH_JOBKEY_LABEL); 258 LaunchDataDictLookup(launch_data.get(), LAUNCH_JOBKEY_LABEL);
254 ASSERT_TRUE(launch_lookup_data); 259 ASSERT_TRUE(launch_lookup_data);
255 ASSERT_EQ(LAUNCH_DATA_STRING, LaunchDataGetType(launch_lookup_data)); 260 ASSERT_EQ(LAUNCH_DATA_STRING, LaunchDataGetType(launch_lookup_data));
256 EXPECT_STREQ("com.example.job.rebooter", 261 EXPECT_STREQ("com.example.job.rebooter",
257 LaunchDataGetString(launch_lookup_data)); 262 LaunchDataGetString(launch_lookup_data));
258 263
259 launch_lookup_data = 264 launch_lookup_data =
260 LaunchDataDictLookup(launch_data, LAUNCH_JOBKEY_ONDEMAND); 265 LaunchDataDictLookup(launch_data.get(), LAUNCH_JOBKEY_ONDEMAND);
261 ASSERT_TRUE(launch_lookup_data); 266 ASSERT_TRUE(launch_lookup_data);
262 ASSERT_EQ(LAUNCH_DATA_BOOL, LaunchDataGetType(launch_lookup_data)); 267 ASSERT_EQ(LAUNCH_DATA_BOOL, LaunchDataGetType(launch_lookup_data));
263 EXPECT_TRUE(LaunchDataGetBool(launch_lookup_data)); 268 EXPECT_TRUE(LaunchDataGetBool(launch_lookup_data));
264 269
265 launch_lookup_data = 270 launch_lookup_data =
266 LaunchDataDictLookup(launch_data, LAUNCH_JOBKEY_PROGRAMARGUMENTS); 271 LaunchDataDictLookup(launch_data.get(), LAUNCH_JOBKEY_PROGRAMARGUMENTS);
267 ASSERT_TRUE(launch_lookup_data); 272 ASSERT_TRUE(launch_lookup_data);
268 ASSERT_EQ(LAUNCH_DATA_ARRAY, LaunchDataGetType(launch_lookup_data)); 273 ASSERT_EQ(LAUNCH_DATA_ARRAY, LaunchDataGetType(launch_lookup_data));
269 EXPECT_EQ(3u, LaunchDataArrayGetCount(launch_lookup_data)); 274 EXPECT_EQ(3u, LaunchDataArrayGetCount(launch_lookup_data));
270 275
271 launch_data_t launch_sublookup_data = 276 launch_data_t launch_sublookup_data =
272 LaunchDataArrayGetIndex(launch_lookup_data, 0); 277 LaunchDataArrayGetIndex(launch_lookup_data, 0);
273 ASSERT_TRUE(launch_sublookup_data); 278 ASSERT_TRUE(launch_sublookup_data);
274 ASSERT_EQ(LAUNCH_DATA_STRING, LaunchDataGetType(launch_sublookup_data)); 279 ASSERT_EQ(LAUNCH_DATA_STRING, LaunchDataGetType(launch_sublookup_data));
275 EXPECT_STREQ("/bin/bash", LaunchDataGetString(launch_sublookup_data)); 280 EXPECT_STREQ("/bin/bash", LaunchDataGetString(launch_sublookup_data));
276 281
277 launch_sublookup_data = LaunchDataArrayGetIndex(launch_lookup_data, 1); 282 launch_sublookup_data = LaunchDataArrayGetIndex(launch_lookup_data, 1);
278 ASSERT_TRUE(launch_sublookup_data); 283 ASSERT_TRUE(launch_sublookup_data);
279 ASSERT_EQ(LAUNCH_DATA_STRING, LaunchDataGetType(launch_sublookup_data)); 284 ASSERT_EQ(LAUNCH_DATA_STRING, LaunchDataGetType(launch_sublookup_data));
280 EXPECT_STREQ("-c", LaunchDataGetString(launch_sublookup_data)); 285 EXPECT_STREQ("-c", LaunchDataGetString(launch_sublookup_data));
281 286
282 launch_sublookup_data = LaunchDataArrayGetIndex(launch_lookup_data, 2); 287 launch_sublookup_data = LaunchDataArrayGetIndex(launch_lookup_data, 2);
283 ASSERT_TRUE(launch_sublookup_data); 288 ASSERT_TRUE(launch_sublookup_data);
284 ASSERT_EQ(LAUNCH_DATA_STRING, LaunchDataGetType(launch_sublookup_data)); 289 ASSERT_EQ(LAUNCH_DATA_STRING, LaunchDataGetType(launch_sublookup_data));
285 EXPECT_STREQ("/sbin/reboot", LaunchDataGetString(launch_sublookup_data)); 290 EXPECT_STREQ("/sbin/reboot", LaunchDataGetString(launch_sublookup_data));
286 291
287 launch_lookup_data = 292 launch_lookup_data =
288 LaunchDataDictLookup(launch_data, LAUNCH_JOBKEY_MACHSERVICES); 293 LaunchDataDictLookup(launch_data.get(), LAUNCH_JOBKEY_MACHSERVICES);
289 ASSERT_TRUE(launch_lookup_data); 294 ASSERT_TRUE(launch_lookup_data);
290 ASSERT_EQ(LAUNCH_DATA_DICTIONARY, LaunchDataGetType(launch_lookup_data)); 295 ASSERT_EQ(LAUNCH_DATA_DICTIONARY, LaunchDataGetType(launch_lookup_data));
291 EXPECT_EQ(1u, LaunchDataDictGetCount(launch_lookup_data)); 296 EXPECT_EQ(1u, LaunchDataDictGetCount(launch_lookup_data));
292 297
293 launch_sublookup_data = LaunchDataDictLookup( 298 launch_sublookup_data = LaunchDataDictLookup(
294 launch_lookup_data, "com.example.service.rebooter"); 299 launch_lookup_data, "com.example.service.rebooter");
295 ASSERT_TRUE(launch_sublookup_data); 300 ASSERT_TRUE(launch_sublookup_data);
296 ASSERT_EQ(LAUNCH_DATA_BOOL, LaunchDataGetType(launch_sublookup_data)); 301 ASSERT_EQ(LAUNCH_DATA_BOOL, LaunchDataGetType(launch_sublookup_data));
297 EXPECT_TRUE(LaunchDataGetBool(launch_sublookup_data)); 302 EXPECT_TRUE(LaunchDataGetBool(launch_sublookup_data));
298 } 303 }
299 } 304 }
300 305
301 } // namespace 306 } // namespace
302 } // namespace test 307 } // namespace test
303 } // namespace crashpad 308 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/mac/launchd.mm ('k') | util/mac/service_management.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698