summaryrefslogtreecommitdiffstats
path: root/chrome/installer/test
diff options
context:
space:
mode:
authorbrettw <brettw@chromium.org>2015-05-01 10:43:01 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-01 17:44:29 +0000
commiteb1f7acfd8fb07bf5ed25fdc96c935f76e65148e (patch)
treedcf7fc6f0c8806cce37c13411c0f7b0f774f5a8e /chrome/installer/test
parent1e033036c2951fabb4857c920ed5de43b87e1434 (diff)
downloadchromium_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/test')
-rw-r--r--chrome/installer/test/BUILD.gn60
-rw-r--r--chrome/installer/test/alternate_version_generator.cc6
-rw-r--r--chrome/installer/test/resource_updater.cc3
3 files changed, 65 insertions, 4 deletions
diff --git a/chrome/installer/test/BUILD.gn b/chrome/installer/test/BUILD.gn
new file mode 100644
index 0000000..ac4ef59
--- /dev/null
+++ b/chrome/installer/test/BUILD.gn
@@ -0,0 +1,60 @@
+# Copyright 2015 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.
+
+import("//testing/test.gni")
+
+assert(is_win)
+
+executable("alternate_version_generator") {
+ testonly = true
+ sources = [
+ "alternate_version_generator_main.cc",
+ ]
+
+ deps = [
+ ":alternate_version_generator_lib",
+ "//base",
+ "//base/test:test_support",
+ "//chrome/common:constants",
+ "//chrome/installer/util",
+ "//testing/gtest",
+ ]
+}
+
+source_set("alternate_version_generator_lib") {
+ testonly = true
+ sources = [
+ "alternate_version_generator.cc",
+ "alternate_version_generator.h",
+ "pe_image_resources.cc",
+ "pe_image_resources.h",
+ "resource_loader.cc",
+ "resource_loader.h",
+ "resource_updater.cc",
+ "resource_updater.h",
+ ]
+ deps = [
+ "//base",
+ "//chrome/installer/util",
+ "//chrome/common:constants",
+ ]
+}
+
+test("upgrade_test") {
+ sources = [
+ "run_all_tests.cc",
+ "upgrade_test.cc",
+ ]
+ deps = [
+ ":alternate_version_generator_lib",
+ "//base",
+ "//base/test:test_support",
+ "//chrome/common:constants",
+ "//chrome/installer/util",
+ "//testing/gtest",
+ ]
+ data_deps = [
+ # 'mini_installer.gyp:mini_installer', TODO(GYP)
+ ]
+}
diff --git a/chrome/installer/test/alternate_version_generator.cc b/chrome/installer/test/alternate_version_generator.cc
index e50c293..039c1ef 100644
--- a/chrome/installer/test/alternate_version_generator.cc
+++ b/chrome/installer/test/alternate_version_generator.cc
@@ -226,7 +226,7 @@ bool RunProcessAndWait(const wchar_t* exe_path, const std::wstring& cmdline,
<< cmdline << "\".";
result = false;
} else {
- DCHECK_NE(*exit_code, STILL_ACTIVE);
+ DCHECK_NE(*exit_code, static_cast<int>(STILL_ACTIVE));
}
}
} else {
@@ -547,7 +547,7 @@ bool GenerateAlternateVersion(const base::FilePath& original_installer_path,
base::WriteFile(setup_ex_,
reinterpret_cast<const char*>(resource_data.first),
static_cast<int>(resource_data.second));
- if (written != resource_data.second) {
+ if (written != static_cast<int>(resource_data.second)) {
LOG(DFATAL) << "Failed writing \"" << setup_ex_.value() << "\"";
return false;
}
@@ -559,7 +559,7 @@ bool GenerateAlternateVersion(const base::FilePath& original_installer_path,
base::WriteFile(chrome_packed_7z,
reinterpret_cast<const char*>(resource_data.first),
static_cast<int>(resource_data.second));
- if (written != resource_data.second) {
+ if (written != static_cast<int>(resource_data.second)) {
LOG(DFATAL) << "Failed writing \"" << chrome_packed_7z.value() << "\"";
return false;
}
diff --git a/chrome/installer/test/resource_updater.cc b/chrome/installer/test/resource_updater.cc
index cf05094..4c6be27 100644
--- a/chrome/installer/test/resource_updater.cc
+++ b/chrome/installer/test/resource_updater.cc
@@ -43,7 +43,8 @@ bool ResourceUpdater::Update(const std::wstring& name,
if (input.Initialize(input_file)) {
if (UpdateResource(handle_, type.c_str(), name.c_str(), language_id,
- const_cast<uint8*>(input.data()), input.length())
+ const_cast<uint8*>(input.data()),
+ static_cast<DWORD>(input.length()))
!= FALSE) {
return true;
}