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

Side by Side Diff: webrtc/base/win32regkey_unittest.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 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 | « webrtc/base/win32regkey.cc ('k') | webrtc/base/win32socketserver.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2003 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2003 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 EXPECT_STREQ(RegKey::GetParentKeyInfo(&temp_key).c_str(), 143 EXPECT_STREQ(RegKey::GetParentKeyInfo(&temp_key).c_str(),
144 L"HKEY_CLASSES_ROOT\\moon"); 144 L"HKEY_CLASSES_ROOT\\moon");
145 EXPECT_STREQ(temp_key.c_str(), L"doggy"); 145 EXPECT_STREQ(temp_key.c_str(), L"doggy");
146 146
147 // 147 //
148 // Test MultiSZBytesToStringArray 148 // Test MultiSZBytesToStringArray
149 // 149 //
150 150
151 std::vector<std::wstring> result; 151 std::vector<std::wstring> result;
152 EXPECT_SUCCEEDED(RegKey::MultiSZBytesToStringArray( 152 EXPECT_SUCCEEDED(RegKey::MultiSZBytesToStringArray(
153 reinterpret_cast<const uint8*>(kMultiSZ), sizeof(kMultiSZ), &result)); 153 reinterpret_cast<const uint8_t*>(kMultiSZ), sizeof(kMultiSZ), &result));
154 EXPECT_EQ(result.size(), 3); 154 EXPECT_EQ(result.size(), 3);
155 EXPECT_STREQ(result[0].c_str(), L"abc"); 155 EXPECT_STREQ(result[0].c_str(), L"abc");
156 EXPECT_STREQ(result[1].c_str(), L"def"); 156 EXPECT_STREQ(result[1].c_str(), L"def");
157 EXPECT_STREQ(result[2].c_str(), L"P12345"); 157 EXPECT_STREQ(result[2].c_str(), L"P12345");
158 158
159 EXPECT_SUCCEEDED(RegKey::MultiSZBytesToStringArray( 159 EXPECT_SUCCEEDED(RegKey::MultiSZBytesToStringArray(
160 reinterpret_cast<const uint8*>(kEmptyMultiSZ), 160 reinterpret_cast<const uint8_t*>(kEmptyMultiSZ), sizeof(kEmptyMultiSZ),
161 sizeof(kEmptyMultiSZ), &result)); 161 &result));
162 EXPECT_EQ(result.size(), 0); 162 EXPECT_EQ(result.size(), 0);
163 EXPECT_FALSE(SUCCEEDED(RegKey::MultiSZBytesToStringArray( 163 EXPECT_FALSE(SUCCEEDED(RegKey::MultiSZBytesToStringArray(
164 reinterpret_cast<const uint8*>(kInvalidMultiSZ), 164 reinterpret_cast<const uint8_t*>(kInvalidMultiSZ),
165 sizeof(kInvalidMultiSZ), &result))); 165 sizeof(kInvalidMultiSZ), &result)));
166 } 166 }
167 167
168 TEST(RegKeyTest, RegKeyHelperFunctionsTest) { 168 TEST(RegKeyTest, RegKeyHelperFunctionsTest) {
169 RegKeyHelperFunctionsTest(); 169 RegKeyHelperFunctionsTest();
170 } 170 }
171 171
172 void RegKeyNonStaticFunctionsTest() { 172 void RegKeyNonStaticFunctionsTest() {
173 DWORD int_val = 0; 173 DWORD int_val = 0;
174 DWORD64 int64_val = 0; 174 DWORD64 int64_val = 0;
175 wchar_t* str_val = NULL; 175 wchar_t* str_val = NULL;
176 uint8* binary_val = NULL; 176 uint8_t* binary_val = NULL;
177 DWORD uint8_count = 0; 177 DWORD uint8_count = 0;
178 178
179 // Just in case... 179 // Just in case...
180 // make sure the no test key residue is left from previous aborted runs 180 // make sure the no test key residue is left from previous aborted runs
181 RegKey::DeleteKey(kFullRkey1); 181 RegKey::DeleteKey(kFullRkey1);
182 182
183 // initial state 183 // initial state
184 RegKey r_key; 184 RegKey r_key;
185 EXPECT_TRUE(r_key.key() == NULL); 185 EXPECT_TRUE(r_key.key() == NULL);
186 186
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 delete[] str_val; 258 delete[] str_val;
259 259
260 // delete the value 260 // delete the value
261 EXPECT_SUCCEEDED(r_key.DeleteValue(kValNameStr)); 261 EXPECT_SUCCEEDED(r_key.DeleteValue(kValNameStr));
262 262
263 // check that the value is gone 263 // check that the value is gone
264 EXPECT_FALSE(r_key.HasValue(kValNameInt)); 264 EXPECT_FALSE(r_key.HasValue(kValNameInt));
265 265
266 // set a binary value 266 // set a binary value
267 EXPECT_SUCCEEDED(r_key.SetValue(kValNameBinary, 267 EXPECT_SUCCEEDED(r_key.SetValue(kValNameBinary,
268 reinterpret_cast<const uint8*>(kBinaryVal), sizeof(kBinaryVal) - 1)); 268 reinterpret_cast<const uint8_t*>(kBinaryVal),
269 sizeof(kBinaryVal) - 1));
269 270
270 // check that the value exists 271 // check that the value exists
271 EXPECT_TRUE(r_key.HasValue(kValNameBinary)); 272 EXPECT_TRUE(r_key.HasValue(kValNameBinary));
272 273
273 // read it back 274 // read it back
274 EXPECT_SUCCEEDED(r_key.GetValue(kValNameBinary, &binary_val, &uint8_count)); 275 EXPECT_SUCCEEDED(r_key.GetValue(kValNameBinary, &binary_val, &uint8_count));
275 EXPECT_TRUE(memcmp(binary_val, kBinaryVal, sizeof(kBinaryVal) - 1) == 0); 276 EXPECT_TRUE(memcmp(binary_val, kBinaryVal, sizeof(kBinaryVal) - 1) == 0);
276 delete[] binary_val; 277 delete[] binary_val;
277 278
278 // set it again 279 // set it again
279 EXPECT_SUCCEEDED(r_key.SetValue(kValNameBinary, 280 EXPECT_SUCCEEDED(r_key.SetValue(kValNameBinary,
280 reinterpret_cast<const uint8*>(kBinaryVal2), sizeof(kBinaryVal) - 1)); 281 reinterpret_cast<const uint8_t*>(kBinaryVal2),
282 sizeof(kBinaryVal) - 1));
281 283
282 // read it again 284 // read it again
283 EXPECT_SUCCEEDED(r_key.GetValue(kValNameBinary, &binary_val, &uint8_count)); 285 EXPECT_SUCCEEDED(r_key.GetValue(kValNameBinary, &binary_val, &uint8_count));
284 EXPECT_TRUE(memcmp(binary_val, kBinaryVal2, sizeof(kBinaryVal2) - 1) == 0); 286 EXPECT_TRUE(memcmp(binary_val, kBinaryVal2, sizeof(kBinaryVal2) - 1) == 0);
285 delete[] binary_val; 287 delete[] binary_val;
286 288
287 // delete the value 289 // delete the value
288 EXPECT_SUCCEEDED(r_key.DeleteValue(kValNameBinary)); 290 EXPECT_SUCCEEDED(r_key.DeleteValue(kValNameBinary));
289 291
290 // check that the value is gone 292 // check that the value is gone
291 EXPECT_FALSE(r_key.HasValue(kValNameBinary)); 293 EXPECT_FALSE(r_key.HasValue(kValNameBinary));
292 294
293 // set some values and check the total count 295 // set some values and check the total count
294 296
295 // set an INT 32 297 // set an INT 32
296 EXPECT_SUCCEEDED(r_key.SetValue(kValNameInt, kIntVal)); 298 EXPECT_SUCCEEDED(r_key.SetValue(kValNameInt, kIntVal));
297 299
298 // set an INT 64 300 // set an INT 64
299 EXPECT_SUCCEEDED(r_key.SetValue(kValNameInt64, kIntVal64)); 301 EXPECT_SUCCEEDED(r_key.SetValue(kValNameInt64, kIntVal64));
300 302
301 // set a string 303 // set a string
302 EXPECT_SUCCEEDED(r_key.SetValue(kValNameStr, kStrVal)); 304 EXPECT_SUCCEEDED(r_key.SetValue(kValNameStr, kStrVal));
303 305
304 // set a binary value 306 // set a binary value
305 EXPECT_SUCCEEDED(r_key.SetValue(kValNameBinary, 307 EXPECT_SUCCEEDED(r_key.SetValue(kValNameBinary,
306 reinterpret_cast<const uint8*>(kBinaryVal), sizeof(kBinaryVal) - 1)); 308 reinterpret_cast<const uint8_t*>(kBinaryVal),
309 sizeof(kBinaryVal) - 1));
307 310
308 // get the value count 311 // get the value count
309 uint32 value_count = r_key.GetValueCount(); 312 uint32_t value_count = r_key.GetValueCount();
310 EXPECT_EQ(value_count, 4); 313 EXPECT_EQ(value_count, 4);
311 314
312 // check the value names 315 // check the value names
313 std::wstring value_name; 316 std::wstring value_name;
314 DWORD type = 0; 317 DWORD type = 0;
315 318
316 EXPECT_SUCCEEDED(r_key.GetValueNameAt(0, &value_name, &type)); 319 EXPECT_SUCCEEDED(r_key.GetValueNameAt(0, &value_name, &type));
317 EXPECT_STREQ(value_name.c_str(), kValNameInt); 320 EXPECT_STREQ(value_name.c_str(), kValNameInt);
318 EXPECT_EQ(type, REG_DWORD); 321 EXPECT_EQ(type, REG_DWORD);
319 322
320 EXPECT_SUCCEEDED(r_key.GetValueNameAt(1, &value_name, &type)); 323 EXPECT_SUCCEEDED(r_key.GetValueNameAt(1, &value_name, &type));
321 EXPECT_STREQ(value_name.c_str(), kValNameInt64); 324 EXPECT_STREQ(value_name.c_str(), kValNameInt64);
322 EXPECT_EQ(type, REG_QWORD); 325 EXPECT_EQ(type, REG_QWORD);
323 326
324 EXPECT_SUCCEEDED(r_key.GetValueNameAt(2, &value_name, &type)); 327 EXPECT_SUCCEEDED(r_key.GetValueNameAt(2, &value_name, &type));
325 EXPECT_STREQ(value_name.c_str(), kValNameStr); 328 EXPECT_STREQ(value_name.c_str(), kValNameStr);
326 EXPECT_EQ(type, REG_SZ); 329 EXPECT_EQ(type, REG_SZ);
327 330
328 EXPECT_SUCCEEDED(r_key.GetValueNameAt(3, &value_name, &type)); 331 EXPECT_SUCCEEDED(r_key.GetValueNameAt(3, &value_name, &type));
329 EXPECT_STREQ(value_name.c_str(), kValNameBinary); 332 EXPECT_STREQ(value_name.c_str(), kValNameBinary);
330 EXPECT_EQ(type, REG_BINARY); 333 EXPECT_EQ(type, REG_BINARY);
331 334
332 // check that there are no more values 335 // check that there are no more values
333 EXPECT_FAILED(r_key.GetValueNameAt(4, &value_name, &type)); 336 EXPECT_FAILED(r_key.GetValueNameAt(4, &value_name, &type));
334 337
335 uint32 subkey_count = r_key.GetSubkeyCount(); 338 uint32_t subkey_count = r_key.GetSubkeyCount();
336 EXPECT_EQ(subkey_count, 0); 339 EXPECT_EQ(subkey_count, 0);
337 340
338 // now create a subkey and make sure we can get the name 341 // now create a subkey and make sure we can get the name
339 RegKey temp_key; 342 RegKey temp_key;
340 EXPECT_SUCCEEDED(temp_key.Create(HKEY_CURRENT_USER, kRkey1Subkey)); 343 EXPECT_SUCCEEDED(temp_key.Create(HKEY_CURRENT_USER, kRkey1Subkey));
341 344
342 // check the subkey exists 345 // check the subkey exists
343 EXPECT_TRUE(r_key.HasSubkey(kRkey1SubkeyName)); 346 EXPECT_TRUE(r_key.HasSubkey(kRkey1SubkeyName));
344 347
345 // check the name 348 // check the name
(...skipping 13 matching lines...) Expand all
359 EXPECT_SUCCEEDED(RegKey::DeleteKey(kFullRkey1)); 362 EXPECT_SUCCEEDED(RegKey::DeleteKey(kFullRkey1));
360 } 363 }
361 364
362 void RegKeyStaticFunctionsTest() { 365 void RegKeyStaticFunctionsTest() {
363 DWORD int_val = 0; 366 DWORD int_val = 0;
364 DWORD64 int64_val = 0; 367 DWORD64 int64_val = 0;
365 float float_val = 0; 368 float float_val = 0;
366 double double_val = 0; 369 double double_val = 0;
367 wchar_t* str_val = NULL; 370 wchar_t* str_val = NULL;
368 std::wstring wstr_val; 371 std::wstring wstr_val;
369 uint8* binary_val = NULL; 372 uint8_t* binary_val = NULL;
370 DWORD uint8_count = 0; 373 DWORD uint8_count = 0;
371 374
372 // Just in case... 375 // Just in case...
373 // make sure the no test key residue is left from previous aborted runs 376 // make sure the no test key residue is left from previous aborted runs
374 RegKey::DeleteKey(kFullRkey1); 377 RegKey::DeleteKey(kFullRkey1);
375 378
376 // get an in-existent value from an un-existent key 379 // get an in-existent value from an un-existent key
377 EXPECT_EQ(RegKey::GetValue(kFullRkey1, kValNameInt, &int_val), 380 EXPECT_EQ(RegKey::GetValue(kFullRkey1, kValNameInt, &int_val),
378 HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)); 381 HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND));
379 382
380 // set int32 383 // set int32_t
381 EXPECT_SUCCEEDED(RegKey::SetValue(kFullRkey1, kValNameInt, kIntVal)); 384 EXPECT_SUCCEEDED(RegKey::SetValue(kFullRkey1, kValNameInt, kIntVal));
382 385
383 // check that the value exists 386 // check that the value exists
384 EXPECT_TRUE(RegKey::HasValue(kFullRkey1, kValNameInt)); 387 EXPECT_TRUE(RegKey::HasValue(kFullRkey1, kValNameInt));
385 388
386 // get an in-existent value from an existent key 389 // get an in-existent value from an existent key
387 EXPECT_EQ(RegKey::GetValue(kFullRkey1, L"bogus", &int_val), 390 EXPECT_EQ(RegKey::GetValue(kFullRkey1, L"bogus", &int_val),
388 HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)); 391 HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND));
389 392
390 // read it back 393 // read it back
391 EXPECT_SUCCEEDED(RegKey::GetValue(kFullRkey1, kValNameInt, &int_val)); 394 EXPECT_SUCCEEDED(RegKey::GetValue(kFullRkey1, kValNameInt, &int_val));
392 EXPECT_EQ(int_val, kIntVal); 395 EXPECT_EQ(int_val, kIntVal);
393 396
394 // delete the value 397 // delete the value
395 EXPECT_SUCCEEDED(RegKey::DeleteValue(kFullRkey1, kValNameInt)); 398 EXPECT_SUCCEEDED(RegKey::DeleteValue(kFullRkey1, kValNameInt));
396 399
397 // check that the value is gone 400 // check that the value is gone
398 EXPECT_FALSE(RegKey::HasValue(kFullRkey1, kValNameInt)); 401 EXPECT_FALSE(RegKey::HasValue(kFullRkey1, kValNameInt));
399 402
400 // set int64 403 // set int64_t
401 EXPECT_SUCCEEDED(RegKey::SetValue(kFullRkey1, kValNameInt64, kIntVal64)); 404 EXPECT_SUCCEEDED(RegKey::SetValue(kFullRkey1, kValNameInt64, kIntVal64));
402 405
403 // check that the value exists 406 // check that the value exists
404 EXPECT_TRUE(RegKey::HasValue(kFullRkey1, kValNameInt64)); 407 EXPECT_TRUE(RegKey::HasValue(kFullRkey1, kValNameInt64));
405 408
406 // read it back 409 // read it back
407 EXPECT_SUCCEEDED(RegKey::GetValue(kFullRkey1, kValNameInt64, &int64_val)); 410 EXPECT_SUCCEEDED(RegKey::GetValue(kFullRkey1, kValNameInt64, &int64_val));
408 EXPECT_EQ(int64_val, kIntVal64); 411 EXPECT_EQ(int64_val, kIntVal64);
409 412
410 // delete the value 413 // delete the value
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 EXPECT_EQ(RegKey::GetValue(kFullRkey1, L"bogus", &str_val), 469 EXPECT_EQ(RegKey::GetValue(kFullRkey1, L"bogus", &str_val),
467 HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)); 470 HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND));
468 471
469 // delete the value 472 // delete the value
470 EXPECT_SUCCEEDED(RegKey::DeleteValue(kFullRkey1, kValNameStr)); 473 EXPECT_SUCCEEDED(RegKey::DeleteValue(kFullRkey1, kValNameStr));
471 474
472 // check that the value is gone 475 // check that the value is gone
473 EXPECT_FALSE(RegKey::HasValue(kFullRkey1, kValNameStr)); 476 EXPECT_FALSE(RegKey::HasValue(kFullRkey1, kValNameStr));
474 477
475 // set binary 478 // set binary
476 EXPECT_SUCCEEDED(RegKey::SetValue(kFullRkey1, kValNameBinary, 479 EXPECT_SUCCEEDED(RegKey::SetValue(
477 reinterpret_cast<const uint8*>(kBinaryVal), sizeof(kBinaryVal)-1)); 480 kFullRkey1, kValNameBinary, reinterpret_cast<const uint8_t*>(kBinaryVal),
481 sizeof(kBinaryVal) - 1));
478 482
479 // check that the value exists 483 // check that the value exists
480 EXPECT_TRUE(RegKey::HasValue(kFullRkey1, kValNameBinary)); 484 EXPECT_TRUE(RegKey::HasValue(kFullRkey1, kValNameBinary));
481 485
482 // read it back 486 // read it back
483 EXPECT_SUCCEEDED(RegKey::GetValue(kFullRkey1, kValNameBinary, 487 EXPECT_SUCCEEDED(RegKey::GetValue(kFullRkey1, kValNameBinary,
484 &binary_val, &uint8_count)); 488 &binary_val, &uint8_count));
485 EXPECT_TRUE(memcmp(binary_val, kBinaryVal, sizeof(kBinaryVal)-1) == 0); 489 EXPECT_TRUE(memcmp(binary_val, kBinaryVal, sizeof(kBinaryVal)-1) == 0);
486 delete[] binary_val; 490 delete[] binary_val;
487 491
488 // delete the value 492 // delete the value
489 EXPECT_SUCCEEDED(RegKey::DeleteValue(kFullRkey1, kValNameBinary)); 493 EXPECT_SUCCEEDED(RegKey::DeleteValue(kFullRkey1, kValNameBinary));
490 494
491 // check that the value is gone 495 // check that the value is gone
492 EXPECT_FALSE(RegKey::HasValue(kFullRkey1, kValNameBinary)); 496 EXPECT_FALSE(RegKey::HasValue(kFullRkey1, kValNameBinary));
493 497
494 // special case - set a binary value with length 0 498 // special case - set a binary value with length 0
495 EXPECT_SUCCEEDED(RegKey::SetValue(kFullRkey1, kValNameBinary, 499 EXPECT_SUCCEEDED(
496 reinterpret_cast<const uint8*>(kBinaryVal), 0)); 500 RegKey::SetValue(kFullRkey1, kValNameBinary,
501 reinterpret_cast<const uint8_t*>(kBinaryVal), 0));
497 502
498 // check that the value exists 503 // check that the value exists
499 EXPECT_TRUE(RegKey::HasValue(kFullRkey1, kValNameBinary)); 504 EXPECT_TRUE(RegKey::HasValue(kFullRkey1, kValNameBinary));
500 505
501 // read it back 506 // read it back
502 EXPECT_SUCCEEDED(RegKey::GetValue(kFullRkey1, kValNameBinary, 507 EXPECT_SUCCEEDED(RegKey::GetValue(kFullRkey1, kValNameBinary,
503 &binary_val, &uint8_count)); 508 &binary_val, &uint8_count));
504 EXPECT_EQ(uint8_count, 0); 509 EXPECT_EQ(uint8_count, 0);
505 EXPECT_TRUE(binary_val == NULL); 510 EXPECT_TRUE(binary_val == NULL);
506 delete[] binary_val; 511 delete[] binary_val;
(...skipping 18 matching lines...) Expand all
525 delete[] binary_val; 530 delete[] binary_val;
526 531
527 // delete the value 532 // delete the value
528 EXPECT_SUCCEEDED(RegKey::DeleteValue(kFullRkey1, kValNameBinary)); 533 EXPECT_SUCCEEDED(RegKey::DeleteValue(kFullRkey1, kValNameBinary));
529 534
530 // check that the value is gone 535 // check that the value is gone
531 EXPECT_FALSE(RegKey::HasValue(kFullRkey1, kValNameBinary)); 536 EXPECT_FALSE(RegKey::HasValue(kFullRkey1, kValNameBinary));
532 537
533 // test read/write REG_MULTI_SZ value 538 // test read/write REG_MULTI_SZ value
534 std::vector<std::wstring> result; 539 std::vector<std::wstring> result;
535 EXPECT_SUCCEEDED(RegKey::SetValueMultiSZ(kFullRkey1, kValNameMultiStr, 540 EXPECT_SUCCEEDED(RegKey::SetValueMultiSZ(
536 reinterpret_cast<const uint8*>(kMultiSZ), sizeof(kMultiSZ))); 541 kFullRkey1, kValNameMultiStr, reinterpret_cast<const uint8_t*>(kMultiSZ),
542 sizeof(kMultiSZ)));
537 EXPECT_SUCCEEDED(RegKey::GetValue(kFullRkey1, kValNameMultiStr, &result)); 543 EXPECT_SUCCEEDED(RegKey::GetValue(kFullRkey1, kValNameMultiStr, &result));
538 EXPECT_EQ(result.size(), 3); 544 EXPECT_EQ(result.size(), 3);
539 EXPECT_STREQ(result[0].c_str(), L"abc"); 545 EXPECT_STREQ(result[0].c_str(), L"abc");
540 EXPECT_STREQ(result[1].c_str(), L"def"); 546 EXPECT_STREQ(result[1].c_str(), L"def");
541 EXPECT_STREQ(result[2].c_str(), L"P12345"); 547 EXPECT_STREQ(result[2].c_str(), L"P12345");
542 EXPECT_SUCCEEDED(RegKey::SetValueMultiSZ(kFullRkey1, kValNameMultiStr, 548 EXPECT_SUCCEEDED(RegKey::SetValueMultiSZ(
543 reinterpret_cast<const uint8*>(kEmptyMultiSZ), sizeof(kEmptyMultiSZ))); 549 kFullRkey1, kValNameMultiStr,
550 reinterpret_cast<const uint8_t*>(kEmptyMultiSZ), sizeof(kEmptyMultiSZ)));
544 EXPECT_SUCCEEDED(RegKey::GetValue(kFullRkey1, kValNameMultiStr, &result)); 551 EXPECT_SUCCEEDED(RegKey::GetValue(kFullRkey1, kValNameMultiStr, &result));
545 EXPECT_EQ(result.size(), 0); 552 EXPECT_EQ(result.size(), 0);
546 // writing REG_MULTI_SZ value will automatically add ending null characters 553 // writing REG_MULTI_SZ value will automatically add ending null characters
547 EXPECT_SUCCEEDED(RegKey::SetValueMultiSZ(kFullRkey1, kValNameMultiStr, 554 EXPECT_SUCCEEDED(
548 reinterpret_cast<const uint8*>(kInvalidMultiSZ), sizeof(kInvalidMultiSZ))) ; 555 RegKey::SetValueMultiSZ(kFullRkey1, kValNameMultiStr,
556 reinterpret_cast<const uint8_t*>(kInvalidMultiSZ),
557 sizeof(kInvalidMultiSZ)));
549 EXPECT_SUCCEEDED(RegKey::GetValue(kFullRkey1, kValNameMultiStr, &result)); 558 EXPECT_SUCCEEDED(RegKey::GetValue(kFullRkey1, kValNameMultiStr, &result));
550 EXPECT_EQ(result.size(), 1); 559 EXPECT_EQ(result.size(), 1);
551 EXPECT_STREQ(result[0].c_str(), L"678"); 560 EXPECT_STREQ(result[0].c_str(), L"678");
552 561
553 // Run the following test only in dev machine 562 // Run the following test only in dev machine
554 // This is because the build machine might not have admin privilege 563 // This is because the build machine might not have admin privilege
555 #ifdef IS_PRIVATE_BUILD 564 #ifdef IS_PRIVATE_BUILD
556 // get a temp file name 565 // get a temp file name
557 wchar_t temp_path[MAX_PATH] = {0}; 566 wchar_t temp_path[MAX_PATH] = {0};
558 EXPECT_LT(::GetTempPath(ARRAY_SIZE(temp_path), temp_path), 567 EXPECT_LT(::GetTempPath(ARRAY_SIZE(temp_path), temp_path),
(...skipping 29 matching lines...) Expand all
588 } 597 }
589 598
590 // Run both tests under the same test target. Because they access (read and 599 // Run both tests under the same test target. Because they access (read and
591 // write) the same registry keys they can't run in parallel with eachother. 600 // write) the same registry keys they can't run in parallel with eachother.
592 TEST(RegKeyTest, RegKeyFunctionsTest) { 601 TEST(RegKeyTest, RegKeyFunctionsTest) {
593 RegKeyNonStaticFunctionsTest(); 602 RegKeyNonStaticFunctionsTest();
594 RegKeyStaticFunctionsTest(); 603 RegKeyStaticFunctionsTest();
595 } 604 }
596 605
597 } // namespace rtc 606 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/win32regkey.cc ('k') | webrtc/base/win32socketserver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698