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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
10 #include "base/test/test_reg_util_win.h" | 11 #include "base/test/test_reg_util_win.h" |
11 #include "chrome/install_static/install_details.h" | 12 #include "chrome/install_static/install_details.h" |
12 #include "chrome/install_static/install_modes.h" | 13 #include "chrome/install_static/install_modes.h" |
13 #include "chrome/install_static/test/scoped_install_details.h" | 14 #include "chrome/install_static/test/scoped_install_details.h" |
14 #include "chrome_elf/nt_registry/nt_registry.h" | 15 #include "chrome_elf/nt_registry/nt_registry.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 using ::testing::ElementsAre; | 19 using ::testing::ElementsAre; |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 const bool system_level_; | 335 const bool system_level_; |
335 const ScopedInstallDetails scoped_install_details_; | 336 const ScopedInstallDetails scoped_install_details_; |
336 const InstallConstants* mode_; | 337 const InstallConstants* mode_; |
337 const HKEY root_key_; | 338 const HKEY root_key_; |
338 const nt::ROOT_KEY nt_root_key_; | 339 const nt::ROOT_KEY nt_root_key_; |
339 registry_util::RegistryOverrideManager override_manager_; | 340 registry_util::RegistryOverrideManager override_manager_; |
340 | 341 |
341 DISALLOW_COPY_AND_ASSIGN(InstallStaticUtilTest); | 342 DISALLOW_COPY_AND_ASSIGN(InstallStaticUtilTest); |
342 }; | 343 }; |
343 | 344 |
345 TEST_P(InstallStaticUtilTest, GetAppGuid) { | |
346 // For brands that do not integrate with Omaha/Google Update, the app guid is | |
347 // an empty string. | |
348 if (!kUseGoogleUpdateIntegration) | |
349 EXPECT_STREQ(L"", GetAppGuid()); | |
350 | |
351 #if defined(GOOGLE_CHROME_BUILD) | |
352 // The app guids for the brand's install modes; parallel to kInstalLModes. | |
353 static constexpr const wchar_t* kAppGuids[] = { | |
354 L"{8A69D345-D564-463c-AFF1-A69D9E530F96}", // Google Chrome. | |
355 L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}", // Google Chrome SxS (canary). | |
huangs
2017/02/27 16:15:14
NIT: Capitalize "Canary"?
I find it odd that the
grt (UTC plus 2)
2017/02/27 20:53:01
Done.
| |
356 }; | |
357 static_assert(arraysize(kAppGuids) == NUM_INSTALL_MODES, | |
358 "kAppGuids out of date."); | |
359 EXPECT_STREQ(kAppGuids[std::get<0>(GetParam())], GetAppGuid()); | |
360 #else | |
361 FAIL() << "Not implemented."; | |
huangs
2017/02/27 16:15:14
So Chromium test will fail? And if the parameteri
grt (UTC plus 2)
2017/02/27 20:53:01
I'd meant for the test to exit just after line 349
| |
362 #endif | |
363 } | |
364 | |
344 TEST_P(InstallStaticUtilTest, UsageStatsAbsent) { | 365 TEST_P(InstallStaticUtilTest, UsageStatsAbsent) { |
345 EXPECT_FALSE(GetCollectStatsConsent()); | 366 EXPECT_FALSE(GetCollectStatsConsent()); |
346 } | 367 } |
347 | 368 |
348 TEST_P(InstallStaticUtilTest, UsageStatsZero) { | 369 TEST_P(InstallStaticUtilTest, UsageStatsZero) { |
349 SetUsageStat(0, false); | 370 SetUsageStat(0, false); |
350 EXPECT_FALSE(GetCollectStatsConsent()); | 371 EXPECT_FALSE(GetCollectStatsConsent()); |
351 } | 372 } |
352 | 373 |
353 TEST_P(InstallStaticUtilTest, UsageStatsZeroMedium) { | 374 TEST_P(InstallStaticUtilTest, UsageStatsZeroMedium) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
417 testing::Values("user"))); | 438 testing::Values("user"))); |
418 #else // GOOGLE_CHROME_BUILD | 439 #else // GOOGLE_CHROME_BUILD |
419 // Chromium supports user and system levels. | 440 // Chromium supports user and system levels. |
420 INSTANTIATE_TEST_CASE_P(Chromium, | 441 INSTANTIATE_TEST_CASE_P(Chromium, |
421 InstallStaticUtilTest, | 442 InstallStaticUtilTest, |
422 testing::Combine(testing::Values(CHROMIUM_INDEX), | 443 testing::Combine(testing::Values(CHROMIUM_INDEX), |
423 testing::Values("user", "system"))); | 444 testing::Values("user", "system"))); |
424 #endif // !GOOGLE_CHROME_BUILD | 445 #endif // !GOOGLE_CHROME_BUILD |
425 | 446 |
426 } // namespace install_static | 447 } // namespace install_static |
OLD | NEW |