summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authoranantha@chromium.org <anantha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-04 23:17:27 +0000
committeranantha@chromium.org <anantha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-04 23:17:27 +0000
commit6aaa0899c338b73fec7b6ed40da58b06f88bc913 (patch)
tree47f315f72dc20ecd9e2f3fe08208e1db789b49a7 /chrome/test
parent9629c0e4f8952045296a3c89d861bad68360b1c2 (diff)
downloadchromium_src-6aaa0899c338b73fec7b6ed40da58b06f88bc913.zip
chromium_src-6aaa0899c338b73fec7b6ed40da58b06f88bc913.tar.gz
chromium_src-6aaa0899c338b73fec7b6ed40da58b06f88bc913.tar.bz2
Disabled system level install tests on Vista. System level install tests are launching UAC dialog on vista and hence making the tests fail. I am trying to figure out how to handle that case. Hence disabled the system level test for time being.
I have also modified GetRegistryKey method to have a out parameter and return bool. The previous could lead to a crash if the reg key value "pv" was not present. Review URL: http://codereview.chromium.org/21054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9185 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/mini_installer_test/chrome_mini_installer.cc36
-rw-r--r--chrome/test/mini_installer_test/chrome_mini_installer.h8
-rw-r--r--chrome/test/mini_installer_test/test.cc29
3 files changed, 44 insertions, 29 deletions
diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.cc b/chrome/test/mini_installer_test/chrome_mini_installer.cc
index f406165..ec14997 100644
--- a/chrome/test/mini_installer_test/chrome_mini_installer.cc
+++ b/chrome/test/mini_installer_test/chrome_mini_installer.cc
@@ -60,14 +60,16 @@ void ChromeMiniInstaller::InstallMetaInstaller() {
void ChromeMiniInstaller::OverInstall() {
if (!IsChromiumBuild()) {
InstallMetaInstaller();
+ std::wstring reg_key_value_returned;
// gets the registry key value before overinstall.
- std::wstring reg_key_value_returned = GetRegistryKey();
+ GetRegistryKey(&reg_key_value_returned);
printf("\n\nPreparing to overinstall...\n");
std::wstring mini_installer_path = GetMiniInstallerExePath();
printf("\nOverinstall path is %ls\n", mini_installer_path.c_str());
InstallMiniInstaller(true);
+ std::wstring reg_key_value_after_overinstall;
// Get the registry key value after over install
- std::wstring reg_key_value_after_overinstall = GetRegistryKey();
+ GetRegistryKey(&reg_key_value_after_overinstall);
ASSERT_TRUE(VerifyOverInstall(reg_key_value_returned,
reg_key_value_after_overinstall));
} else {
@@ -167,7 +169,9 @@ bool ChromeMiniInstaller::CheckRegistryKey(std::wstring key_path) {
printf("Cannot open reg key\n");
return false;
}
- std::wstring reg_key_value_returned = GetRegistryKey();
+ std::wstring reg_key_value_returned;
+ if (!GetRegistryKey(&reg_key_value_returned))
+ return false;
printf("Reg key value is%ls\n", reg_key_value_returned.c_str());
return true;
}
@@ -238,10 +242,11 @@ std::wstring ChromeMiniInstaller::GetStartMenuShortcutPath() {
// Gets the path for uninstall.
std::wstring ChromeMiniInstaller::GetUninstallPath() {
- std::wstring username, append_path, path;
+ std::wstring username, append_path, path, reg_key_value;
+ GetRegistryKey(&reg_key_value);
path = GetChromeInstallDirectoryLocation();
file_util::AppendToPath(&path, mini_installer_constants::kChromeAppDir);
- file_util::AppendToPath(&path, GetRegistryKey());
+ file_util::AppendToPath(&path, reg_key_value);
file_util::AppendToPath(&path, installer_util::kInstallerDir);
file_util::AppendToPath(&path,
mini_installer_constants::kChromeSetupExecutable);
@@ -250,14 +255,15 @@ std::wstring ChromeMiniInstaller::GetUninstallPath() {
}
// Returns Chrome pv registry key value
-std::wstring ChromeMiniInstaller::GetRegistryKey() {
- std::wstring build_key_value;
+bool ChromeMiniInstaller::GetRegistryKey(std::wstring* build_key_value ) {
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
RegKey key(GetRootRegistryKey(), dist->GetVersionKey().c_str());
- if (!key.ReadValue(L"pv", &build_key_value))
+ if (!key.ReadValue(L"pv", build_key_value)) {
+ printf("registry key not found\n");
return false;
- printf("Build key value is %ls\n", build_key_value.c_str());
- return build_key_value;
+ }
+ printf("Build key value is %ls\n", build_key_value->c_str());
+ return true;
}
// Get HKEY based on install type.
@@ -281,10 +287,12 @@ bool ChromeMiniInstaller::IsChromiumBuild() {
void ChromeMiniInstaller::LaunchInstaller(std::wstring path,
const wchar_t process_name[]) {
ASSERT_TRUE(file_util::PathExists(path));
- std::wstring launch_args;
- if (install_type_ == mini_installer_constants::kSystemInstall)
- launch_args = L" -system-level";
- base::LaunchApp(L"\"" + path + L"\"" + launch_args, false, false, NULL);
+ if (install_type_ == mini_installer_constants::kSystemInstall) {
+ std::wstring launch_args = L" -system-level";
+ base::LaunchApp(L"\"" + path + L"\"" + launch_args, false, false, NULL);
+ } else {
+ base::LaunchApp(L"\"" + path + L"\"", false, false, NULL);
+ }
printf("Waiting while this process is running %ls ....", process_name);
WaitUntilProcessStartsRunning(process_name);
WaitUntilProcessStopsRunning(process_name);
diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.h b/chrome/test/mini_installer_test/chrome_mini_installer.h
index 6a1e089..b258794 100644
--- a/chrome/test/mini_installer_test/chrome_mini_installer.h
+++ b/chrome/test/mini_installer_test/chrome_mini_installer.h
@@ -24,6 +24,9 @@ class ChromeMiniInstaller {
~ChromeMiniInstaller() {}
+ // Closes specified process.
+ void CloseProcesses(const std::wstring& executable_name);
+
// Installs Google Chrome through meta installer.
void InstallMetaInstaller();
@@ -50,9 +53,6 @@ class ChromeMiniInstaller {
// Closes Chrome browser.
void CloseChromeBrowser(LPCWSTR window_name);
- // Closes specified process.
- void CloseProcesses(const std::wstring& executable_name);
-
// Checks for registry key.
bool CheckRegistryKey(std::wstring key_path);
@@ -79,7 +79,7 @@ class ChromeMiniInstaller {
std::wstring GetUninstallPath();
// Returns Chrome pv registry key value
- std::wstring GetRegistryKey();
+ bool GetRegistryKey(std::wstring *return_reg_key_value);
// Checks for the build type
bool IsChromiumBuild();
diff --git a/chrome/test/mini_installer_test/test.cc b/chrome/test/mini_installer_test/test.cc
index 0384873..9020bcb 100644
--- a/chrome/test/mini_installer_test/test.cc
+++ b/chrome/test/mini_installer_test/test.cc
@@ -1,10 +1,12 @@
// Copyright (c) 2006-2008 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 "base/win_util.h"
+#include "chrome/installer/util/install_util.h"
+#include "chrome/test/mini_installer_test/mini_installer_test_constants.h"
+#include "testing/gtest/include/gtest/gtest.h"
#include "chrome_mini_installer.h"
-#include "mini_installer_test_constants.h"
-#include "testing/gtest/include/gtest/gtest.h"
namespace {
class MiniInstallTest : public testing::Test {
@@ -12,28 +14,33 @@ class MiniInstallTest : public testing::Test {
virtual void SetUp() {
ChromeMiniInstaller userinstall(mini_installer_constants::kUserInstall);
userinstall.UnInstall();
- ChromeMiniInstaller systeminstall(
- mini_installer_constants::kSystemInstall);
- systeminstall.UnInstall();
+ if (win_util::GetWinVersion() != win_util::WINVERSION_VISTA) {
+ ChromeMiniInstaller systeminstall(
+ mini_installer_constants::kSystemInstall);
+ systeminstall.UnInstall();
+ }
}
virtual void TearDown() {
- // Currently no tear down required
+ ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
+ installer.CloseProcesses(installer_util::kChromeExe);
}
};
};
-TEST_F(MiniInstallTest, DISABLED_MiniInstallerOverChromeMetaInstallerTest) {
+TEST_F(MiniInstallTest, MiniInstallerOverChromeMetaInstallerTest) {
ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
installer.OverInstall();
}
-TEST_F(MiniInstallTest, DISABLED_MiniInstallerSystemInstallTest) {
- ChromeMiniInstaller installer(mini_installer_constants::kSystemInstall);
- installer.InstallMiniInstaller();
+TEST_F(MiniInstallTest, MiniInstallerSystemInstallTest) {
+ if (win_util::GetWinVersion() != win_util::WINVERSION_VISTA) {
+ ChromeMiniInstaller installer(mini_installer_constants::kSystemInstall);
+ installer.InstallMiniInstaller();
+ }
}
-TEST_F(MiniInstallTest, DISABLED_MiniInstallerUserInstallTest) {
+TEST_F(MiniInstallTest, MiniInstallerUserInstallTest) {
ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
installer.InstallMiniInstaller();
}