| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/installer/util/l10n_string_util.h" | 5 #include "chrome/installer/util/l10n_string_util.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "chrome/install_static/install_modes.h" | 8 #include "chrome/install_static/install_modes.h" |
| 9 #include "chrome/install_static/test/scoped_install_details.h" | 9 #include "chrome/install_static/test/scoped_install_details.h" |
| 10 #include "chrome/installer/util/installer_util_strings.h" | 10 #include "chrome/installer/util/installer_util_strings.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 IDS_INBOUND_MDNS_RULE_DESCRIPTION_BASE, | 47 IDS_INBOUND_MDNS_RULE_DESCRIPTION_BASE, |
| 48 IDS_INBOUND_MDNS_RULE_NAME_BASE, | 48 IDS_INBOUND_MDNS_RULE_NAME_BASE, |
| 49 IDS_PRODUCT_NAME_BASE}); | 49 IDS_PRODUCT_NAME_BASE}); |
| 50 | 50 |
| 51 // A map from an install mode index to its mode-specific string identifiers. | 51 // A map from an install mode index to its mode-specific string identifiers. |
| 52 std::map<int, std::vector<int>> mode_to_strings; | 52 std::map<int, std::vector<int>> mode_to_strings; |
| 53 mode_to_strings[install_static::STABLE_INDEX] = std::vector<int>( | 53 mode_to_strings[install_static::STABLE_INDEX] = std::vector<int>( |
| 54 {IDS_APP_SHORTCUTS_SUBDIR_NAME_BASE, | 54 {IDS_APP_SHORTCUTS_SUBDIR_NAME_BASE, |
| 55 IDS_INBOUND_MDNS_RULE_DESCRIPTION_BASE, IDS_INBOUND_MDNS_RULE_NAME_BASE, | 55 IDS_INBOUND_MDNS_RULE_DESCRIPTION_BASE, IDS_INBOUND_MDNS_RULE_NAME_BASE, |
| 56 IDS_PRODUCT_NAME_BASE}); | 56 IDS_PRODUCT_NAME_BASE}); |
| 57 mode_to_strings[install_static::BETA_INDEX] = std::vector<int>( | |
| 58 {IDS_APP_SHORTCUTS_SUBDIR_NAME_BETA_BASE, | |
| 59 IDS_INBOUND_MDNS_RULE_DESCRIPTION_BETA_BASE, | |
| 60 IDS_INBOUND_MDNS_RULE_NAME_BETA_BASE, IDS_SHORTCUT_NAME_BETA_BASE}); | |
| 61 mode_to_strings[install_static::DEV_INDEX] = std::vector<int>( | |
| 62 {IDS_APP_SHORTCUTS_SUBDIR_NAME_DEV_BASE, | |
| 63 IDS_INBOUND_MDNS_RULE_DESCRIPTION_DEV_BASE, | |
| 64 IDS_INBOUND_MDNS_RULE_NAME_DEV_BASE, IDS_SHORTCUT_NAME_DEV_BASE}); | |
| 65 mode_to_strings[install_static::CANARY_INDEX] = std::vector<int>( | 57 mode_to_strings[install_static::CANARY_INDEX] = std::vector<int>( |
| 66 {IDS_APP_SHORTCUTS_SUBDIR_NAME_CANARY_BASE, | 58 {IDS_APP_SHORTCUTS_SUBDIR_NAME_CANARY_BASE, |
| 67 IDS_INBOUND_MDNS_RULE_DESCRIPTION_CANARY_BASE, | 59 IDS_INBOUND_MDNS_RULE_DESCRIPTION_CANARY_BASE, |
| 68 IDS_INBOUND_MDNS_RULE_NAME_CANARY_BASE, IDS_SXS_SHORTCUT_NAME_BASE}); | 60 IDS_INBOUND_MDNS_RULE_NAME_CANARY_BASE, IDS_SXS_SHORTCUT_NAME_BASE}); |
| 69 | 61 |
| 70 // Run through all install modes, checking that the mode-specific strings are | 62 // Run through all install modes, checking that the mode-specific strings are |
| 71 // mapped properly by GetBaseMessageIdForMode. | 63 // mapped properly by GetBaseMessageIdForMode. |
| 72 ASSERT_EQ(install_static::NUM_INSTALL_MODES, mode_to_strings.size()); | 64 ASSERT_EQ(install_static::NUM_INSTALL_MODES, mode_to_strings.size()); |
| 73 for (int mode_index = 0; mode_index < install_static::NUM_INSTALL_MODES; | 65 for (int mode_index = 0; mode_index < install_static::NUM_INSTALL_MODES; |
| 74 ++mode_index) { | 66 ++mode_index) { |
| 75 SCOPED_TRACE(testing::Message() << "install mode index: " << mode_index); | 67 SCOPED_TRACE(testing::Message() << "install mode index: " << mode_index); |
| 76 ASSERT_EQ(1U, mode_to_strings.count(mode_index)); | 68 ASSERT_EQ(1U, mode_to_strings.count(mode_index)); |
| 77 const auto& mode_strings = mode_to_strings[mode_index]; | 69 const auto& mode_strings = mode_to_strings[mode_index]; |
| 78 ASSERT_EQ(mode_strings.size(), input_ids.size()); | 70 ASSERT_EQ(mode_strings.size(), input_ids.size()); |
| 79 | 71 |
| 80 install_static::ScopedInstallDetails install_details(false, mode_index); | 72 install_static::ScopedInstallDetails install_details(false, mode_index); |
| 81 for (size_t i = 0; i < input_ids.size(); ++i) | 73 for (size_t i = 0; i < input_ids.size(); ++i) |
| 82 EXPECT_EQ(mode_strings[i], GetBaseMessageIdForMode(input_ids[i])); | 74 EXPECT_EQ(mode_strings[i], GetBaseMessageIdForMode(input_ids[i])); |
| 83 } | 75 } |
| 84 } | 76 } |
| 85 #endif // defined(GOOGLE_CHROME_BUILD) | 77 #endif // defined(GOOGLE_CHROME_BUILD) |
| 86 | 78 |
| 87 } // namespace installer | 79 } // namespace installer |
| OLD | NEW |