diff options
author | brettw <brettw@chromium.org> | 2015-05-01 10:43:01 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-01 17:44:29 +0000 |
commit | eb1f7acfd8fb07bf5ed25fdc96c935f76e65148e (patch) | |
tree | dcf7fc6f0c8806cce37c13411c0f7b0f774f5a8e /chrome/installer/util | |
parent | 1e033036c2951fabb4857c920ed5de43b87e1434 (diff) | |
download | chromium_src-eb1f7acfd8fb07bf5ed25fdc96c935f76e65148e.zip chromium_src-eb1f7acfd8fb07bf5ed25fdc96c935f76e65148e.tar.gz chromium_src-eb1f7acfd8fb07bf5ed25fdc96c935f76e65148e.tar.bz2 |
Add installer_util_unittests to the GN windows build
This fixes some C++ Warnings on Windows to avoid having to add suppressions to the GN build.
Moves the generated strings header to the same place in the gen tree as it is in the source tree. Update includes.
Previously landed https://codereview.chromium.org/1062743006/
TBR=scottmg@chromium.org
CQ_EXTRA_TRYBOTS=tryserver.chromium.linux:android_chromium_gn_compile_dbg,android_chromium_gn_compile_rel;tryserver.chromium.win:win8_chromium_gn_rel,win8_chromium_gn_dbg;tryserver.chromium.mac:mac_chromium_gn_rel,mac_chromium_gn_dbg
Review URL: https://codereview.chromium.org/1116293002
Cr-Commit-Position: refs/heads/master@{#327929}
Diffstat (limited to 'chrome/installer/util')
-rw-r--r-- | chrome/installer/util/BUILD.gn | 88 | ||||
-rw-r--r-- | chrome/installer/util/browser_distribution.cc | 3 | ||||
-rw-r--r-- | chrome/installer/util/chrome_frame_distribution.cc | 3 | ||||
-rw-r--r-- | chrome/installer/util/delete_after_reboot_helper_unittest.cc | 3 | ||||
-rw-r--r-- | chrome/installer/util/firewall_manager_win.cc | 3 | ||||
-rw-r--r-- | chrome/installer/util/google_chrome_distribution.cc | 3 | ||||
-rw-r--r-- | chrome/installer/util/google_chrome_sxs_distribution.cc | 3 | ||||
-rw-r--r-- | chrome/installer/util/installer_state_unittest.cc | 3 | ||||
-rw-r--r-- | chrome/installer/util/installer_util_unittests.rc | 2 | ||||
-rw-r--r-- | chrome/installer/util/language_selector.cc | 3 | ||||
-rw-r--r-- | chrome/installer/util/logging_installer_unittest.cc | 12 | ||||
-rw-r--r-- | chrome/installer/util/master_preferences_unittest.cc | 12 | ||||
-rw-r--r-- | chrome/installer/util/shell_util.cc | 3 |
13 files changed, 108 insertions, 33 deletions
diff --git a/chrome/installer/util/BUILD.gn b/chrome/installer/util/BUILD.gn index 8dca7ce..4351912 100644 --- a/chrome/installer/util/BUILD.gn +++ b/chrome/installer/util/BUILD.gn @@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//testing/test.gni") + static_library("util") { deps = [ "//base", @@ -63,7 +65,6 @@ static_library("util") { "//third_party/icu", "//third_party/lzma_sdk", ] - include_dirs = [ "$root_gen_dir/installer_util_strings" ] # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] @@ -168,7 +169,8 @@ static_library("util") { } } -action("strings") { +action("generate_strings") { + visibility = [ ":strings" ] script = "prebuild/create_string_rc.py" if (is_chrome_branded) { @@ -181,11 +183,9 @@ action("strings") { grdfile, ] - # TODO(brettw) move to target_gen_dir - outdir = "$root_gen_dir/installer_util_strings" outputs = [ - "$outdir/installer_util_strings.h", - "$outdir/installer_util_strings.rc", + "$target_gen_dir/installer_util_strings.h", + "$target_gen_dir/installer_util_strings.rc", ] args = [ @@ -194,6 +194,80 @@ action("strings") { "-n", "installer_util_strings", "-o", - rebase_path(outdir, root_build_dir), + rebase_path(target_gen_dir, root_build_dir), ] } + +# Compile the generated .rc file. +source_set("strings") { + sources = get_target_outputs(":generate_strings") + deps = [ + ":generate_strings", + ] +} + +if (is_win) { + test("installer_util_unittests") { + sources = [ + "../setup/compat_checks_unittest.cc", + "../setup/setup_constants.cc", + "advanced_firewall_manager_win_unittest.cc", + "callback_work_item_unittest.cc", + "channel_info_unittest.cc", + "copy_tree_work_item_unittest.cc", + "create_dir_work_item_unittest.cc", + "create_reg_key_work_item_unittest.cc", + "delete_after_reboot_helper_unittest.cc", + "delete_reg_key_work_item_unittest.cc", + "delete_reg_value_work_item_unittest.cc", + "delete_tree_work_item_unittest.cc", + "duplicate_tree_detector_unittest.cc", + "fake_installation_state.h", + "fake_product_state.h", + "google_update_settings_unittest.cc", + "install_util_unittest.cc", + "installation_validation_helper.cc", + "installation_validation_helper.h", + "installation_validator_unittest.cc", + "installer_state_unittest.cc", + "installer_util_test_common.cc", + "installer_util_test_common.h", + "installer_util_unittests.rc", + "installer_util_unittests_resource.h", + "language_selector_unittest.cc", + "legacy_firewall_manager_win_unittest.cc", + "logging_installer_unittest.cc", + "lzma_util_unittest.cc", + "master_preferences_unittest.cc", + "move_tree_work_item_unittest.cc", + "product_state_unittest.cc", + "product_unittest.cc", + "product_unittest.h", + "registry_key_backup_unittest.cc", + "registry_test_data.cc", + "registry_test_data.h", + "run_all_unittests.cc", + "self_cleaning_temp_dir_unittest.cc", + "set_reg_value_work_item_unittest.cc", + "shell_util_unittest.cc", + "uninstall_metrics_unittest.cc", + "wmi_unittest.cc", + "work_item_list_unittest.cc", + ] + + deps = [ + ":strings", + ":util", + "//base", + "//base:i18n", + "//base/test:test_support", + "//chrome:chrome_version_resources", + "//chrome/installer/test:alternate_version_generator_lib", + "//content/public/common", + "//testing/gmock", + "//testing/gtest", + ] + + # TODO(GYP) manifest: $(ProjectDir)\\installer\\mini_installer\\mini_installer.exe.manifest + } +} # is_win diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc index dd7918d..9457890 100644 --- a/chrome/installer/util/browser_distribution.cc +++ b/chrome/installer/util/browser_distribution.cc @@ -24,12 +24,11 @@ #include "chrome/installer/util/google_chrome_distribution.h" #include "chrome/installer/util/google_chrome_sxs_distribution.h" #include "chrome/installer/util/install_util.h" +#include "chrome/installer/util/installer_util_strings.h" #include "chrome/installer/util/l10n_string_util.h" #include "chrome/installer/util/master_preferences.h" #include "chrome/installer/util/non_updating_app_registration_data.h" -#include "installer_util_strings.h" // NOLINT - using installer::MasterPreferences; namespace { diff --git a/chrome/installer/util/chrome_frame_distribution.cc b/chrome/installer/util/chrome_frame_distribution.cc index 9f57ae6..11d8507 100644 --- a/chrome/installer/util/chrome_frame_distribution.cc +++ b/chrome/installer/util/chrome_frame_distribution.cc @@ -16,11 +16,10 @@ #include "chrome/installer/util/google_update_settings.h" #include "chrome/installer/util/helper.h" #include "chrome/installer/util/install_util.h" +#include "chrome/installer/util/installer_util_strings.h" #include "chrome/installer/util/l10n_string_util.h" #include "chrome/installer/util/updating_app_registration_data.h" -#include "installer_util_strings.h" // NOLINT - namespace { const wchar_t kChromeFrameGuid[] = L"{8BA986DA-5100-405E-AA35-86F34A02ACBF}"; } diff --git a/chrome/installer/util/delete_after_reboot_helper_unittest.cc b/chrome/installer/util/delete_after_reboot_helper_unittest.cc index f0acaca..8ee4bdc 100644 --- a/chrome/installer/util/delete_after_reboot_helper_unittest.cc +++ b/chrome/installer/util/delete_after_reboot_helper_unittest.cc @@ -53,7 +53,8 @@ class DeleteAfterRebootHelperTest : public testing::Test { std::vector<char> buffer; StringArrayToMultiSZBytes(original_pending_moves_, &buffer); session_manager_key.WriteValue(kPendingFileRenameOps, &buffer[0], - buffer.size(), REG_MULTI_SZ); + static_cast<int>(buffer.size()), + REG_MULTI_SZ); } } diff --git a/chrome/installer/util/firewall_manager_win.cc b/chrome/installer/util/firewall_manager_win.cc index 202d062..df756a5 100644 --- a/chrome/installer/util/firewall_manager_win.cc +++ b/chrome/installer/util/firewall_manager_win.cc @@ -9,11 +9,10 @@ #include "chrome/installer/util/advanced_firewall_manager_win.h" #include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/install_util.h" +#include "chrome/installer/util/installer_util_strings.h" #include "chrome/installer/util/l10n_string_util.h" #include "chrome/installer/util/legacy_firewall_manager_win.h" -#include "installer_util_strings.h" // NOLINT - namespace installer { namespace { diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index 102f163..ff32f5854 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -25,6 +25,7 @@ #include "chrome/installer/util/google_update_settings.h" #include "chrome/installer/util/helper.h" #include "chrome/installer/util/install_util.h" +#include "chrome/installer/util/installer_util_strings.h" #include "chrome/installer/util/l10n_string_util.h" #include "chrome/installer/util/uninstall_metrics.h" #include "chrome/installer/util/updating_app_registration_data.h" @@ -32,8 +33,6 @@ #include "chrome/installer/util/wmi.h" #include "content/public/common/result_codes.h" -#include "installer_util_strings.h" // NOLINT - namespace { const wchar_t kChromeGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; diff --git a/chrome/installer/util/google_chrome_sxs_distribution.cc b/chrome/installer/util/google_chrome_sxs_distribution.cc index f4a3c3b..a6b23a8 100644 --- a/chrome/installer/util/google_chrome_sxs_distribution.cc +++ b/chrome/installer/util/google_chrome_sxs_distribution.cc @@ -9,10 +9,9 @@ #include "base/command_line.h" #include "base/logging.h" #include "chrome/common/chrome_icon_resources_win.h" +#include "chrome/installer/util/installer_util_strings.h" #include "chrome/installer/util/updating_app_registration_data.h" -#include "installer_util_strings.h" // NOLINT - namespace { const wchar_t kChromeSxSGuid[] = L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}"; diff --git a/chrome/installer/util/installer_state_unittest.cc b/chrome/installer/util/installer_state_unittest.cc index c9b5940..1d60829 100644 --- a/chrome/installer/util/installer_state_unittest.cc +++ b/chrome/installer/util/installer_state_unittest.cc @@ -28,14 +28,13 @@ #include "chrome/installer/util/helper.h" #include "chrome/installer/util/installation_state.h" #include "chrome/installer/util/installer_state.h" +#include "chrome/installer/util/installer_util_strings.h" #include "chrome/installer/util/master_preferences.h" #include "chrome/installer/util/product_unittest.h" #include "chrome/installer/util/util_constants.h" #include "chrome/installer/util/work_item.h" #include "testing/gtest/include/gtest/gtest.h" -#include "installer_util_strings.h" // NOLINT - using base::win::RegKey; using installer::InstallationState; using installer::InstallerState; diff --git a/chrome/installer/util/installer_util_unittests.rc b/chrome/installer/util/installer_util_unittests.rc index 4d89af6..0c58eb8 100644 --- a/chrome/installer/util/installer_util_unittests.rc +++ b/chrome/installer/util/installer_util_unittests.rc @@ -57,7 +57,7 @@ END // // String Table // -#include "installer_util_strings.rc" +#include "chrome/installer/util/installer_util_strings.rc" #ifndef APSTUDIO_INVOKED diff --git a/chrome/installer/util/language_selector.cc b/chrome/installer/util/language_selector.cc index c0a31bb..5197d06 100644 --- a/chrome/installer/util/language_selector.cc +++ b/chrome/installer/util/language_selector.cc @@ -15,8 +15,7 @@ #include "base/strings/string_util.h" #include "base/win/i18n.h" #include "chrome/installer/util/google_update_settings.h" - -#include "installer_util_strings.h" +#include "chrome/installer/util/installer_util_strings.h" namespace { diff --git a/chrome/installer/util/logging_installer_unittest.cc b/chrome/installer/util/logging_installer_unittest.cc index 910f35d..06b959a 100644 --- a/chrome/installer/util/logging_installer_unittest.cc +++ b/chrome/installer/util/logging_installer_unittest.cc @@ -20,7 +20,8 @@ TEST(LoggingInstallerTest, TestTruncate) { base::FilePath temp_file = temp_dir.path().Append(L"temp"); EXPECT_EQ(test_data.size(), - base::WriteFile(temp_file, &test_data[0], test_data.size())); + base::WriteFile(temp_file, &test_data[0], + static_cast<int>(test_data.size()))); ASSERT_TRUE(base::PathExists(temp_file)); int64 file_size = 0; @@ -45,7 +46,8 @@ TEST(LoggingInstallerTest, TestTruncationNotNeeded) { base::FilePath temp_file = temp_dir.path().Append(L"temp"); EXPECT_EQ(test_data.size(), - base::WriteFile(temp_file, &test_data[0], test_data.size())); + base::WriteFile(temp_file, &test_data[0], + static_cast<int>(test_data.size()))); ASSERT_TRUE(base::PathExists(temp_file)); int64 file_size = 0; @@ -67,7 +69,8 @@ TEST(LoggingInstallerTest, TestInUseNeedsTruncation) { base::FilePath temp_file = temp_dir.path().Append(L"temp"); EXPECT_EQ(test_data.size(), - base::WriteFile(temp_file, &test_data[0], test_data.size())); + base::WriteFile(temp_file, &test_data[0], + static_cast<int>(test_data.size()))); ASSERT_TRUE(base::PathExists(temp_file)); int64 file_size = 0; EXPECT_TRUE(base::GetFileSize(temp_file, &file_size)); @@ -95,7 +98,8 @@ TEST(LoggingInstallerTest, TestMoveFailsNeedsTruncation) { base::FilePath temp_file = temp_dir.path().Append(L"temp"); EXPECT_EQ(test_data.size(), - base::WriteFile(temp_file, &test_data[0], test_data.size())); + base::WriteFile(temp_file, &test_data[0], + static_cast<int>(test_data.size()))); ASSERT_TRUE(base::PathExists(temp_file)); int64 file_size = 0; EXPECT_TRUE(base::GetFileSize(temp_file, &file_size)); diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc index 31f839b..74de3ac 100644 --- a/chrome/installer/util/master_preferences_unittest.cc +++ b/chrome/installer/util/master_preferences_unittest.cc @@ -76,7 +76,8 @@ TEST_F(MasterPreferencesTest, ParseDistroParams) { " }\n" "} \n"; - EXPECT_TRUE(base::WriteFile(prefs_file(), text, strlen(text))); + EXPECT_TRUE(base::WriteFile(prefs_file(), text, + static_cast<int>(strlen(text)))); installer::MasterPreferences prefs(prefs_file()); EXPECT_TRUE(prefs.read_from_file()); @@ -135,7 +136,8 @@ TEST_F(MasterPreferencesTest, ParseMissingDistroParams) { " }\n" "} \n"; - EXPECT_TRUE(base::WriteFile(prefs_file(), text, strlen(text))); + EXPECT_TRUE(base::WriteFile(prefs_file(), text, + static_cast<int>(strlen(text)))); installer::MasterPreferences prefs(prefs_file()); EXPECT_TRUE(prefs.read_from_file()); @@ -194,7 +196,8 @@ TEST_F(MasterPreferencesTest, FirstRunTabs) { " ]\n" "} \n"; - EXPECT_TRUE(base::WriteFile(prefs_file(), text, strlen(text))); + EXPECT_TRUE(base::WriteFile(prefs_file(), text, + static_cast<int>(strlen(text)))); installer::MasterPreferences prefs(prefs_file()); typedef std::vector<std::string> TabsVector; TabsVector tabs = prefs.GetFirstRunTabs(); @@ -252,7 +255,8 @@ TEST_F(MasterPreferencesTest, GetInstallPreferencesTest) { " \"verbose_logging\": false\n" " }\n" "} \n"; - EXPECT_TRUE(base::WriteFile(prefs_file, text, strlen(text))); + EXPECT_TRUE(base::WriteFile(prefs_file, text, + static_cast<int>(strlen(text)))); // Make sure command line values override the values in master preferences. std::wstring cmd_str( diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 548fbb8..acff489d 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -44,14 +44,13 @@ #include "chrome/common/chrome_switches.h" #include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/install_util.h" +#include "chrome/installer/util/installer_util_strings.h" #include "chrome/installer/util/l10n_string_util.h" #include "chrome/installer/util/master_preferences.h" #include "chrome/installer/util/master_preferences_constants.h" #include "chrome/installer/util/util_constants.h" #include "chrome/installer/util/work_item.h" -#include "installer_util_strings.h" // NOLINT - using base::win::RegKey; namespace { |