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