Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/installer/util/l10n_string_util.h" | |
| 6 | |
| 7 #include "base/macros.h" | |
| 8 #include "chrome/install_static/install_modes.h" | |
| 9 #include "chrome/install_static/test/scoped_install_details.h" | |
| 10 #include "chrome/installer/util/installer_util_strings.h" | |
| 11 #include "testing/gtest/include/gtest/gtest.h" | |
| 12 | |
| 13 namespace installer { | |
| 14 | |
| 15 // Test that each mode-specific string has a distinct value among the brand's | |
| 16 // install modes. | |
| 17 TEST(GetLocalizedStringTest, DistinctStrings) { | |
| 18 static constexpr int kStringIds[] = { | |
| 19 // Generate the list of mode-specific string IDs. | |
| 20 #define HANDLE_MODE_STRING(id, ...) id, | |
| 21 DO_MODE_STRINGS | |
| 22 #undef HANDLE_MODE_STRING | |
| 23 }; | |
| 24 for (int string_id : kStringIds) { | |
| 25 SCOPED_TRACE(testing::Message() << "message id: " << string_id); | |
| 26 std::set<base::string16> the_strings; | |
| 27 for (int mode_index = 0; mode_index < install_static::NUM_INSTALL_MODES; | |
| 28 ++mode_index) { | |
| 29 SCOPED_TRACE(testing::Message() << "install mode index: " << mode_index); | |
| 30 install_static::ScopedInstallDetails install_details(false, mode_index); | |
| 31 base::string16 the_string = GetLocalizedString(string_id); | |
| 32 ASSERT_FALSE(the_string.empty()); | |
| 33 EXPECT_TRUE(the_strings.insert(the_string).second) | |
| 34 << the_string << " is found in more than one install mode."; | |
| 35 } | |
| 36 } | |
| 37 } | |
| 38 | |
|
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
| |
| 39 } // namespace installer | |
| OLD | NEW |