OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/install_static/install_util.h" | 5 #include "chrome/install_static/install_util.h" |
6 | 6 |
7 #include <tuple> | 7 #include <tuple> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 registry_util::RegistryOverrideManager override_manager_; | 341 registry_util::RegistryOverrideManager override_manager_; |
342 | 342 |
343 DISALLOW_COPY_AND_ASSIGN(InstallStaticUtilTest); | 343 DISALLOW_COPY_AND_ASSIGN(InstallStaticUtilTest); |
344 }; | 344 }; |
345 | 345 |
346 TEST_P(InstallStaticUtilTest, GetChromeInstallSubDirectory) { | 346 TEST_P(InstallStaticUtilTest, GetChromeInstallSubDirectory) { |
347 #if defined(GOOGLE_CHROME_BUILD) | 347 #if defined(GOOGLE_CHROME_BUILD) |
348 // The directory strings for the brand's install modes; parallel to | 348 // The directory strings for the brand's install modes; parallel to |
349 // kInstallModes. | 349 // kInstallModes. |
350 static constexpr const wchar_t* kInstallDirs[] = { | 350 static constexpr const wchar_t* kInstallDirs[] = { |
351 L"Google\\Chrome", L"Google\\Chrome Beta", L"Google\\Chrome Dev", | 351 L"Google\\Chrome", L"Google\\Chrome SxS", |
352 L"Google\\Chrome SxS", | |
353 }; | 352 }; |
354 #else | 353 #else |
355 // The directory strings for the brand's install modes; parallel to | 354 // The directory strings for the brand's install modes; parallel to |
356 // kInstallModes. | 355 // kInstallModes. |
357 static constexpr const wchar_t* kInstallDirs[] = { | 356 static constexpr const wchar_t* kInstallDirs[] = { |
358 L"Chromium", | 357 L"Chromium", |
359 }; | 358 }; |
360 #endif | 359 #endif |
361 static_assert(arraysize(kInstallDirs) == NUM_INSTALL_MODES, | 360 static_assert(arraysize(kInstallDirs) == NUM_INSTALL_MODES, |
362 "kInstallDirs out of date."); | 361 "kInstallDirs out of date."); |
363 EXPECT_THAT(GetChromeInstallSubDirectory(), | 362 EXPECT_THAT(GetChromeInstallSubDirectory(), |
364 StrCaseEq(kInstallDirs[std::get<0>(GetParam())])); | 363 StrCaseEq(kInstallDirs[std::get<0>(GetParam())])); |
365 } | 364 } |
366 | 365 |
367 TEST_P(InstallStaticUtilTest, GetRegistryPath) { | 366 TEST_P(InstallStaticUtilTest, GetRegistryPath) { |
368 #if defined(GOOGLE_CHROME_BUILD) | 367 #if defined(GOOGLE_CHROME_BUILD) |
369 // The registry path strings for the brand's install modes; parallel to | 368 // The registry path strings for the brand's install modes; parallel to |
370 // kInstallModes. | 369 // kInstallModes. |
371 static constexpr const wchar_t* kRegistryPaths[] = { | 370 static constexpr const wchar_t* kRegistryPaths[] = { |
372 L"Software\\Google\\Chrome", L"Software\\Google\\Chrome Beta", | 371 L"Software\\Google\\Chrome", L"Software\\Google\\Chrome SxS", |
373 L"Software\\Google\\Chrome Dev", L"Software\\Google\\Chrome SxS", | |
374 }; | 372 }; |
375 #else | 373 #else |
376 // The registry path strings for the brand's install modes; parallel to | 374 // The registry path strings for the brand's install modes; parallel to |
377 // kInstallModes. | 375 // kInstallModes. |
378 static constexpr const wchar_t* kRegistryPaths[] = { | 376 static constexpr const wchar_t* kRegistryPaths[] = { |
379 L"Software\\Chromium", | 377 L"Software\\Chromium", |
380 }; | 378 }; |
381 #endif | 379 #endif |
382 static_assert(arraysize(kRegistryPaths) == NUM_INSTALL_MODES, | 380 static_assert(arraysize(kRegistryPaths) == NUM_INSTALL_MODES, |
383 "kRegistryPaths out of date."); | 381 "kRegistryPaths out of date."); |
384 EXPECT_THAT(GetRegistryPath(), | 382 EXPECT_THAT(GetRegistryPath(), |
385 StrCaseEq(kRegistryPaths[std::get<0>(GetParam())])); | 383 StrCaseEq(kRegistryPaths[std::get<0>(GetParam())])); |
386 } | 384 } |
387 | 385 |
388 TEST_P(InstallStaticUtilTest, GetUninstallRegistryPath) { | 386 TEST_P(InstallStaticUtilTest, GetUninstallRegistryPath) { |
389 #if defined(GOOGLE_CHROME_BUILD) | 387 #if defined(GOOGLE_CHROME_BUILD) |
390 // The uninstall registry path strings for the brand's install modes; parallel | 388 // The uninstall registry path strings for the brand's install modes; parallel |
391 // to kInstallModes. | 389 // to kInstallModes. |
392 static constexpr const wchar_t* kUninstallRegistryPaths[] = { | 390 static constexpr const wchar_t* kUninstallRegistryPaths[] = { |
393 L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Google Chrome", | 391 L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Google Chrome", |
394 L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" // (cont'd) | 392 L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" // (cont'd) |
395 L"Google Chrome Beta", | |
396 L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" // (cont'd) | |
397 L"Google Chrome Dev", | |
398 L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" // (cont'd) | |
399 L"Google Chrome SxS", | 393 L"Google Chrome SxS", |
400 }; | 394 }; |
401 #else | 395 #else |
402 // The registry path strings for the brand's install modes; parallel to | 396 // The registry path strings for the brand's install modes; parallel to |
403 // kInstallModes. | 397 // kInstallModes. |
404 static constexpr const wchar_t* kUninstallRegistryPaths[] = { | 398 static constexpr const wchar_t* kUninstallRegistryPaths[] = { |
405 L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Chromium", | 399 L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Chromium", |
406 }; | 400 }; |
407 #endif | 401 #endif |
408 static_assert(arraysize(kUninstallRegistryPaths) == NUM_INSTALL_MODES, | 402 static_assert(arraysize(kUninstallRegistryPaths) == NUM_INSTALL_MODES, |
409 "kUninstallRegistryPaths out of date."); | 403 "kUninstallRegistryPaths out of date."); |
410 EXPECT_THAT(GetUninstallRegistryPath(), | 404 EXPECT_THAT(GetUninstallRegistryPath(), |
411 StrCaseEq(kUninstallRegistryPaths[std::get<0>(GetParam())])); | 405 StrCaseEq(kUninstallRegistryPaths[std::get<0>(GetParam())])); |
412 } | 406 } |
413 | 407 |
414 TEST_P(InstallStaticUtilTest, GetAppGuid) { | 408 TEST_P(InstallStaticUtilTest, GetAppGuid) { |
415 // For brands that do not integrate with Omaha/Google Update, the app guid is | 409 // For brands that do not integrate with Omaha/Google Update, the app guid is |
416 // an empty string. | 410 // an empty string. |
417 if (!kUseGoogleUpdateIntegration) { | 411 if (!kUseGoogleUpdateIntegration) { |
418 EXPECT_STREQ(L"", GetAppGuid()); | 412 EXPECT_STREQ(L"", GetAppGuid()); |
419 return; | 413 return; |
420 } | 414 } |
421 | 415 |
422 #if defined(GOOGLE_CHROME_BUILD) | 416 #if defined(GOOGLE_CHROME_BUILD) |
423 // The app guids for the brand's install modes; parallel to kInstallModes. | 417 // The app guids for the brand's install modes; parallel to kInstallModes. |
424 static constexpr const wchar_t* kAppGuids[] = { | 418 static constexpr const wchar_t* kAppGuids[] = { |
425 L"{8A69D345-D564-463c-AFF1-A69D9E530F96}", // Google Chrome. | 419 L"{8A69D345-D564-463c-AFF1-A69D9E530F96}", // Google Chrome. |
426 L"{8237E44A-0054-442C-B6B6-EA0509993955}", // Google Chrome Beta. | |
427 L"{401C381F-E0DE-4B85-8BD8-3F3F14FBDA57}", // Google Chrome Dev. | |
428 L"{4EA16AC7-FD5A-47C3-875B-DBF4A2008C20}", // Google Chrome SxS (Canary). | 420 L"{4EA16AC7-FD5A-47C3-875B-DBF4A2008C20}", // Google Chrome SxS (Canary). |
429 }; | 421 }; |
430 static_assert(arraysize(kAppGuids) == NUM_INSTALL_MODES, | 422 static_assert(arraysize(kAppGuids) == NUM_INSTALL_MODES, |
431 "kAppGuids out of date."); | 423 "kAppGuids out of date."); |
432 EXPECT_THAT(GetAppGuid(), StrCaseEq(kAppGuids[std::get<0>(GetParam())])); | 424 EXPECT_THAT(GetAppGuid(), StrCaseEq(kAppGuids[std::get<0>(GetParam())])); |
433 #else | 425 #else |
434 FAIL() << "Not implemented."; | 426 FAIL() << "Not implemented."; |
435 #endif | 427 #endif |
436 } | 428 } |
437 | 429 |
438 TEST_P(InstallStaticUtilTest, GetBaseAppId) { | 430 TEST_P(InstallStaticUtilTest, GetBaseAppId) { |
439 #if defined(GOOGLE_CHROME_BUILD) | 431 #if defined(GOOGLE_CHROME_BUILD) |
440 // The base app ids for the brand's install modes; parallel to kInstallModes. | 432 // The base app ids for the brand's install modes; parallel to kInstallModes. |
441 static constexpr const wchar_t* kBaseAppIds[] = { | 433 static constexpr const wchar_t* kBaseAppIds[] = { |
442 L"Chrome", L"ChromeBeta", L"ChromeDev", L"ChromeCanary", | 434 L"Chrome", L"ChromeCanary", |
443 }; | 435 }; |
444 #else | 436 #else |
445 // The base app ids for the brand's install modes; parallel to kInstallModes. | 437 // The base app ids for the brand's install modes; parallel to kInstallModes. |
446 static constexpr const wchar_t* kBaseAppIds[] = { | 438 static constexpr const wchar_t* kBaseAppIds[] = { |
447 L"Chromium", | 439 L"Chromium", |
448 }; | 440 }; |
449 #endif | 441 #endif |
450 static_assert(arraysize(kBaseAppIds) == NUM_INSTALL_MODES, | 442 static_assert(arraysize(kBaseAppIds) == NUM_INSTALL_MODES, |
451 "kBaseAppIds out of date."); | 443 "kBaseAppIds out of date."); |
452 EXPECT_THAT(GetBaseAppId(), StrCaseEq(kBaseAppIds[std::get<0>(GetParam())])); | 444 EXPECT_THAT(GetBaseAppId(), StrCaseEq(kBaseAppIds[std::get<0>(GetParam())])); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 TEST_P(InstallStaticUtilTest, GetChromeChannelName) { | 506 TEST_P(InstallStaticUtilTest, GetChromeChannelName) { |
515 EXPECT_EQ(default_channel(), GetChromeChannelName()); | 507 EXPECT_EQ(default_channel(), GetChromeChannelName()); |
516 } | 508 } |
517 | 509 |
518 #if defined(GOOGLE_CHROME_BUILD) | 510 #if defined(GOOGLE_CHROME_BUILD) |
519 // Stable supports user and system levels. | 511 // Stable supports user and system levels. |
520 INSTANTIATE_TEST_CASE_P(Stable, | 512 INSTANTIATE_TEST_CASE_P(Stable, |
521 InstallStaticUtilTest, | 513 InstallStaticUtilTest, |
522 testing::Combine(testing::Values(STABLE_INDEX), | 514 testing::Combine(testing::Values(STABLE_INDEX), |
523 testing::Values("user", "system"))); | 515 testing::Values("user", "system"))); |
524 // Beta supports user and system levels. | |
525 INSTANTIATE_TEST_CASE_P(Beta, | |
526 InstallStaticUtilTest, | |
527 testing::Combine(testing::Values(BETA_INDEX), | |
528 testing::Values("user", "system"))); | |
529 // Dev supports user and system levels. | |
530 INSTANTIATE_TEST_CASE_P(Dev, | |
531 InstallStaticUtilTest, | |
532 testing::Combine(testing::Values(DEV_INDEX), | |
533 testing::Values("user", "system"))); | |
534 // Canary is only at user level. | 516 // Canary is only at user level. |
535 INSTANTIATE_TEST_CASE_P(Canary, | 517 INSTANTIATE_TEST_CASE_P(Canary, |
536 InstallStaticUtilTest, | 518 InstallStaticUtilTest, |
537 testing::Combine(testing::Values(CANARY_INDEX), | 519 testing::Combine(testing::Values(CANARY_INDEX), |
538 testing::Values("user"))); | 520 testing::Values("user"))); |
539 #else // GOOGLE_CHROME_BUILD | 521 #else // GOOGLE_CHROME_BUILD |
540 // Chromium supports user and system levels. | 522 // Chromium supports user and system levels. |
541 INSTANTIATE_TEST_CASE_P(Chromium, | 523 INSTANTIATE_TEST_CASE_P(Chromium, |
542 InstallStaticUtilTest, | 524 InstallStaticUtilTest, |
543 testing::Combine(testing::Values(CHROMIUM_INDEX), | 525 testing::Combine(testing::Values(CHROMIUM_INDEX), |
544 testing::Values("user", "system"))); | 526 testing::Values("user", "system"))); |
545 #endif // !GOOGLE_CHROME_BUILD | 527 #endif // !GOOGLE_CHROME_BUILD |
546 | 528 |
547 } // namespace install_static | 529 } // namespace install_static |
OLD | NEW |