Chromium Code Reviews| Index: chrome/installer/util/l10n_string_util_unittest.cc |
| diff --git a/chrome/installer/util/l10n_string_util_unittest.cc b/chrome/installer/util/l10n_string_util_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a74e3686b82238d9d9929fbb9a0d8620d909a6e0 |
| --- /dev/null |
| +++ b/chrome/installer/util/l10n_string_util_unittest.cc |
| @@ -0,0 +1,39 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/installer/util/l10n_string_util.h" |
| + |
| +#include "base/macros.h" |
| +#include "chrome/install_static/install_modes.h" |
| +#include "chrome/install_static/test/scoped_install_details.h" |
| +#include "chrome/installer/util/installer_util_strings.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace installer { |
| + |
| +// Test that each mode-specific string has a distinct value among the brand's |
| +// install modes. |
| +TEST(GetLocalizedStringTest, DistinctStrings) { |
| + static constexpr int kStringIds[] = { |
| +// Generate the list of mode-specific string IDs. |
| +#define HANDLE_MODE_STRING(id, ...) id, |
| + DO_MODE_STRINGS |
| +#undef HANDLE_MODE_STRING |
| + }; |
| + for (int string_id : kStringIds) { |
| + SCOPED_TRACE(testing::Message() << "message id: " << string_id); |
| + std::set<base::string16> the_strings; |
| + for (int mode_index = 0; mode_index < install_static::NUM_INSTALL_MODES; |
| + ++mode_index) { |
| + SCOPED_TRACE(testing::Message() << "install mode index: " << mode_index); |
| + install_static::ScopedInstallDetails install_details(false, mode_index); |
| + base::string16 the_string = GetLocalizedString(string_id); |
| + ASSERT_FALSE(the_string.empty()); |
| + EXPECT_TRUE(the_strings.insert(the_string).second) |
| + << the_string << " is found in more than one install mode."; |
| + } |
| + } |
| +} |
| + |
|
manzagop (departed)
2017/03/31 16:19:00
Should we add a test for one brand/mode strings, f
grt (UTC plus 2)
2017/04/03 11:59:42
I've added a new test that asserts the Google Chro
|
| +} // namespace installer |