| Index: chrome/install_static/product_install_details_unittest.cc
|
| diff --git a/chrome/install_static/product_install_details_unittest.cc b/chrome/install_static/product_install_details_unittest.cc
|
| index c64c9006c3cd972193f34ddd07dc4972b3fa9b76..582921db2a1a49a6602e1e7ba763994db038f8da 100644
|
| --- a/chrome/install_static/product_install_details_unittest.cc
|
| +++ b/chrome/install_static/product_install_details_unittest.cc
|
| @@ -195,6 +195,15 @@ class MakeProductDetailsTest : public testing::TestWithParam<TestData> {
|
| Eq(ERROR_SUCCESS));
|
| }
|
|
|
| + void SetCohortName(const wchar_t* value) {
|
| + ASSERT_THAT(
|
| + base::win::RegKey(root_key_,
|
| + GetClientStateKeyPath().append(L"\\cohort").c_str(),
|
| + KEY_WOW64_32KEY | KEY_SET_VALUE)
|
| + .WriteValue(L"name", value),
|
| + Eq(ERROR_SUCCESS));
|
| + }
|
| +
|
| private:
|
| // Returns the registry path for the product's ClientState key.
|
| std::wstring GetClientStateKeyPath() {
|
| @@ -290,6 +299,52 @@ TEST_P(MakeProductDetailsTest, AdditionalParametersChannels) {
|
| }
|
| }
|
|
|
| +// Test that the "ap" value is cached during initialization.
|
| +TEST_P(MakeProductDetailsTest, UpdateAp) {
|
| + // This test is only valid for brands that integrate with Google Update.
|
| + if (!kUseGoogleUpdateIntegration)
|
| + return;
|
| +
|
| + // With no value in the registry, the ap value should be empty.
|
| + {
|
| + std::unique_ptr<PrimaryInstallDetails> details(
|
| + MakeProductDetails(test_data().path));
|
| + EXPECT_THAT(details->update_ap(), StrEq(L""));
|
| + }
|
| +
|
| + // And with a value, it should have ... the value.
|
| + static constexpr wchar_t kCrookedMoon[] = L"CrookedMoon";
|
| + SetAp(kCrookedMoon);
|
| + {
|
| + std::unique_ptr<PrimaryInstallDetails> details(
|
| + MakeProductDetails(test_data().path));
|
| + EXPECT_THAT(details->update_ap(), StrEq(kCrookedMoon));
|
| + }
|
| +}
|
| +
|
| +// Test that the cohort name is cached during initialization.
|
| +TEST_P(MakeProductDetailsTest, UpdateCohortName) {
|
| + // This test is only valid for brands that integrate with Google Update.
|
| + if (!kUseGoogleUpdateIntegration)
|
| + return;
|
| +
|
| + // With no value in the registry, the cohort name should be empty.
|
| + {
|
| + std::unique_ptr<PrimaryInstallDetails> details(
|
| + MakeProductDetails(test_data().path));
|
| + EXPECT_THAT(details->update_cohort_name(), StrEq(L""));
|
| + }
|
| +
|
| + // And with a value, it should have ... the value.
|
| + static constexpr wchar_t kPhony[] = L"Phony";
|
| + SetCohortName(kPhony);
|
| + {
|
| + std::unique_ptr<PrimaryInstallDetails> details(
|
| + MakeProductDetails(test_data().path));
|
| + EXPECT_THAT(details->update_cohort_name(), StrEq(kPhony));
|
| + }
|
| +}
|
| +
|
| INSTANTIATE_TEST_CASE_P(All,
|
| MakeProductDetailsTest,
|
| testing::ValuesIn(kTestData));
|
|
|