diff options
author | initial.commit <initial.commit@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-26 23:55:29 +0000 |
---|---|---|
committer | initial.commit <initial.commit@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-26 23:55:29 +0000 |
commit | 09911bf300f1a419907a9412154760efd0b7abc3 (patch) | |
tree | f131325fb4e2ad12c6d3504ab75b16dd92facfed /chrome/test/mini_installer_test | |
parent | 586acc5fe142f498261f52c66862fa417c3d52d2 (diff) | |
download | chromium_src-09911bf300f1a419907a9412154760efd0b7abc3.zip chromium_src-09911bf300f1a419907a9412154760efd0b7abc3.tar.gz chromium_src-09911bf300f1a419907a9412154760efd0b7abc3.tar.bz2 |
Add chrome to the repository.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/mini_installer_test')
7 files changed, 865 insertions, 0 deletions
diff --git a/chrome/test/mini_installer_test/SConscript b/chrome/test/mini_installer_test/SConscript new file mode 100644 index 0000000..6a474f0 --- /dev/null +++ b/chrome/test/mini_installer_test/SConscript @@ -0,0 +1,111 @@ +# Copyright 2008, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Import('env_test')
+
+
+env_test = env_test.Clone()
+
+
+env_test.Prepend(
+ CPPDEFINES = [
+ 'UNIT_TEST',
+ 'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS',
+ 'WIN32_LEAN_AND_MEAN',
+ ],
+ CPPPATH = [
+ '$GTEST_DIR/include',
+ '$GTEST_DIR',
+ '#/..',
+ ],
+ LINKFLAGS = [
+ '/INCREMENTAL',
+ '/DEBUG',
+
+ '/DELAYLOAD:"dwmapi.dll"',
+ '/DELAYLOAD:"uxtheme.dll"',
+
+ '/MACHINE:X86',
+ '/FIXED:No',
+
+ '/safeseh',
+ '/dynamicbase',
+ '/ignore:4199',
+ '/nxcompat',
+ ],
+ LIBS = [
+ 'shlwapi.lib',
+ 'rpcrt4.lib',
+ 'oleacc.lib',
+ 'comsupp.lib',
+
+ 'wininet.lib',
+ 'version.lib',
+ 'msimg32.lib',
+ 'ws2_32.lib',
+ 'usp10.lib',
+ 'psapi.lib',
+ 'kernel32.lib',
+ 'user32.lib',
+ 'gdi32.lib',
+ 'winspool.lib',
+ 'comdlg32.lib',
+ 'advapi32.lib',
+ 'shell32.lib',
+ 'ole32.lib',
+ 'oleaut32.lib',
+ 'uuid.lib',
+ 'odbc32.lib',
+ 'odbccp32.lib',
+
+ 'DelayImp.lib',
+ ],
+)
+
+input_files = [
+ '$CHROME_DIR/installer/setup/setup_constants$OBJSUFFIX',
+ '$CHROME_DIR/installer/util/run_all_unittests$OBJSUFFIX',
+ 'chrome_mini_installer.cc',
+ 'mini_installer_test_constants.cc',
+ 'test.cc',
+]
+
+libs = [
+ '$CHROME_DIR/installer/util/util.lib',
+ '$TESTING_DIR/gtest.lib',
+ '$ICU38_DIR/icuuc.lib',
+ '$BASE_DIR/base.lib',
+]
+
+exe = env_test.Program(['mini_installer_test',
+ 'mini_installer_test.pdb'],
+ input_files + libs)
+i = env_test.Install('$TARGET_ROOT', exe)
+
+env_test.Alias('chrome', i)
diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.cc b/chrome/test/mini_installer_test/chrome_mini_installer.cc new file mode 100644 index 0000000..c8d67c3 --- /dev/null +++ b/chrome/test/mini_installer_test/chrome_mini_installer.cc @@ -0,0 +1,310 @@ +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "chrome/test/mini_installer_test/chrome_mini_installer.h" + +#include "base/path_service.h" +#include "base/process_util.h" +#include "base/registry.h" +#include "base/string_util.h" +#include "chrome/installer/setup/setup_constants.h" +#include "chrome/installer/util/install_util.h" +#include "chrome/installer/util/google_update_constants.h" +#include "chrome/installer/util/util_constants.h" +#include "chrome/test/mini_installer_test/mini_installer_test_constants.h" +#include "testing/gtest/include/gtest/gtest.h" + +// Installs the Chrome mini-installer, checks the registry and shortcuts. +void ChromeMiniInstaller::InstallMiniInstaller(bool over_install) { + // If need to do clean installation, uninstall chrome if exists. + if (!over_install) { + UnInstall(); + } + LaunchExe(mini_installer_constants::kChromeMiniInstallerExecutable, + mini_installer_constants::kChromeMiniInstallerExecutable); + ASSERT_TRUE(CheckRegistryKey(InstallUtil::GetChromeGoogleUpdateKey())); + FindChromeShortcut(); + WaitUntilProcessStartsRunning(installer_util::kChromeExe); + if (!over_install) { + ASSERT_TRUE(CloseWindow( + mini_installer_constants::kFirstChromeUI, WM_CLOSE)); + } else { + ASSERT_TRUE(CloseWindow( + mini_installer_constants::kBrowserTabName, WM_CLOSE)); + } + VerifyChromeLaunch(); +} + +// Installs chromesetupdev.exe, waits for the install to finish and then +// checks the registry and shortcuts. +void ChromeMiniInstaller::InstallChromeSetupDev() { + // Uninstall chrome, if already installed. + UnInstall(); + + // Install older/dev version of chrome. + LaunchExe(mini_installer_constants::kChromeSetupDevExeLocation, + mini_installer_constants::kChromeSetupExecutable); + WaitUntilProcessStopsRunning( + mini_installer_constants::kChromeMiniInstallerExecutable); + std::wstring chrome_google_update_state_key( + google_update::kRegPathClientState); + chrome_google_update_state_key.append(L"\\"); + chrome_google_update_state_key.append(google_update::kChromeGuid); + ASSERT_TRUE(CheckRegistryKey(chrome_google_update_state_key)); + ASSERT_TRUE(CheckRegistryKey(InstallUtil::GetChromeGoogleUpdateKey())); + FindChromeShortcut(); + WaitUntilProcessStartsRunning(installer_util::kChromeExe); + ASSERT_TRUE(CloseWindow(mini_installer_constants::kFirstChromeUI, WM_CLOSE)); +} + +// Accepts mini/dev as parameters. If mini, installs mini_installer first. +// if dev, installs ChromeSetupDev.exe first and +// then over installs with mini_installer. +// Also, verifies if Chrome can be launched sucessfully after overinstall. +void ChromeMiniInstaller::OverInstall() { + InstallChromeSetupDev(); + // gets the registry key value before overinstall. + std::wstring reg_key_value_returned = GetRegistryKey(); + printf("\n\nPreparing to overinstall...\n"); + printf("\nOverinstall path is %ls\n", + mini_installer_constants::kChromeMiniInstallerExecutable); + InstallMiniInstaller(true); + // Get the registry key value after over install + std::wstring reg_key_value_after_overinstall = GetRegistryKey(); + ASSERT_TRUE(VerifyOverInstall( + reg_key_value_returned, reg_key_value_after_overinstall)); +} + +// This method first checks if Chrome is running. +// If yes, will close all the processes. +// Then will find and spawn uninstall path. +// Handles uninstall confirm dialog. +// Waits until setup.exe ends. +// Checks if registry key exist even after uninstall. +// Deletes App dir. +void ChromeMiniInstaller::UnInstall() { + printf("Verifying if Chrome is installed...\n"); + if (!CheckRegistryKey(InstallUtil::GetChromeGoogleUpdateKey())) { + printf("Chrome is not installed.\n"); + return; + } + + printf("\nClosing Chrome processes, if any...\n"); + CloseChromeProcesses(); + + std::wstring uninstall_path = GetUninstallPath(); + ASSERT_TRUE(file_util::PathExists(uninstall_path)); + + printf("\nUninstalling Chrome...\n"); + process_util::LaunchApp(L"\"" + uninstall_path + L"\"" + L" -uninstall", + false, false, NULL); + printf("\nLaunched setup.exe -uninstall....\n"); + ASSERT_TRUE(CloseWindow( + mini_installer_constants::kConfirmDialog, WM_COMMAND)); + WaitUntilProcessStopsRunning( + mini_installer_constants::kChromeSetupExecutable); + ASSERT_FALSE(CheckRegistryKey(InstallUtil::GetChromeGoogleUpdateKey())); + DeleteAppFolder(); + FindChromeShortcut(); + if (false == CloseWindow(mini_installer_constants::kChromeUninstallIETitle, + WM_CLOSE)) { + printf("\nFailed to close window \"%s\".", + mini_installer_constants::kChromeUninstallIETitle); + } +} + +// Takes care of Chrome uninstall dialog. +bool ChromeMiniInstaller::CloseWindow(LPCWSTR window_name, UINT message) { + int timer = 0; + bool return_val = false; + HWND hndl = FindWindow(NULL, window_name); + while (hndl== NULL && (timer < 60000)) { + hndl = FindWindow(NULL, window_name); + Sleep(200); + timer = timer + 200; + } + if (hndl != NULL) { + LRESULT _result = SendMessage(hndl, message, 1, 0); + return_val = true; + } + return return_val; +} + +// Closes Chrome browser. +void ChromeMiniInstaller::CloseChromeBrowser(LPCWSTR window_name) { + WaitUntilProcessStartsRunning(installer_util::kChromeExe); + ASSERT_TRUE(CloseWindow(window_name, WM_CLOSE)); +} + +// Checks for all running Chrome processes and kills them. +void ChromeMiniInstaller::CloseChromeProcesses() { + int timer = 0; + while ((process_util::GetProcessCount(installer_util::kChromeExe, NULL) > 0) && + (timer < 20000)) { + process_util::KillProcesses(installer_util::kChromeExe, 1, NULL); + Sleep(200); + timer = timer + 200; + } + ASSERT_EQ(0, process_util::GetProcessCount(installer_util::kChromeExe, NULL)); +} + +// Checks for Chrome registry keys. +bool ChromeMiniInstaller::CheckRegistryKey(std::wstring key_path) { + RegKey key; + if (!key.Open(HKEY_CURRENT_USER, key_path.c_str(), KEY_ALL_ACCESS)) { + printf("Cannot open reg key\n"); + return false; + } + std::wstring reg_key_value_returned = GetRegistryKey(); + printf("Reg key value is%ls\n", reg_key_value_returned.c_str()); + return true; +} + +// Deletes App folder after uninstall. +void ChromeMiniInstaller::DeleteAppFolder() { + std::wstring path; + ASSERT_TRUE(PathService::Get(base::DIR_LOCAL_APP_DATA, &path)); + file_util::AppendToPath(&path, mini_installer_constants::kAppDir); + file_util::UpOneDirectory(&path); + printf("Deleting this path after uninstall%ls\n", path.c_str()); + ASSERT_TRUE(file_util::Delete(path.c_str(), true)); +} + +// Verifies if Chrome shortcut exists. +void ChromeMiniInstaller::FindChromeShortcut() { + std::wstring username, path_name, append_path, uninstall_lnk, shortcut_path; + bool return_val = false; + ASSERT_TRUE(PathService::Get(base::DIR_START_MENU, &path_name)); + file_util::AppendToPath(&path_name, L"Google Chrome"); + // Verify if path exists. + if (file_util::PathExists(path_name)) { + return_val = true; + uninstall_lnk = path_name; + file_util::AppendToPath(&path_name, L"Google Chrome.lnk"); + file_util::AppendToPath(&uninstall_lnk, L"Uninstall Google Chrome.lnk"); + ASSERT_TRUE(file_util::PathExists(path_name)); + ASSERT_TRUE(file_util::PathExists(uninstall_lnk)); + } + if (return_val) + printf("Chrome shortcuts found are:\n%ls\n%ls\n", + path_name.c_str(), uninstall_lnk.c_str()); + else + printf("Chrome shortcuts not found\n"); +} + +// Gets the path for uninstall. +std::wstring ChromeMiniInstaller::GetUninstallPath() { + std::wstring username, append_path, path; + std::wstring build_key_value = GetRegistryKey(); + PathService::Get(base::DIR_LOCAL_APP_DATA, &path); + file_util::AppendToPath(&path, mini_installer_constants::kAppDir); + file_util::AppendToPath(&path, build_key_value); + file_util::AppendToPath(&path, installer::kInstallerDir); + file_util::AppendToPath(&path, + mini_installer_constants::kChromeSetupExecutable); + printf("uninstall path is %ls\n", path.c_str()); + return path; +} + +// Reads Chrome registry key. +std::wstring ChromeMiniInstaller::GetRegistryKey() { + std::wstring build_key_value; + RegKey key(HKEY_CURRENT_USER, InstallUtil::GetChromeGoogleUpdateKey().c_str()); + if (!key.ReadValue(L"pv", &build_key_value)) + return false; + return build_key_value; +} + +// Launches a given executable and waits until it is done. +void ChromeMiniInstaller::LaunchExe(std::wstring path, + const wchar_t process_name[]) { + printf("\nBuild to be installed is: %ls\n", path.c_str()); + ASSERT_TRUE(file_util::PathExists(path)); + process_util::LaunchApp(L"\"" + path + L"\"", false, false, NULL); + printf("Waiting while this process is running %ls ....", process_name); + WaitUntilProcessStartsRunning(process_name); + WaitUntilProcessStopsRunning(process_name); +} + +// Launch Chrome to see if it works after overinstall. Then close it. +void ChromeMiniInstaller::VerifyChromeLaunch() { + std::wstring username, path, append_path; + ASSERT_TRUE(PathService::Get(base::DIR_LOCAL_APP_DATA, &path)); + file_util::AppendToPath(&path, + mini_installer_constants::kAppDir); + file_util::AppendToPath(&path, installer_util::kChromeExe); + process_util::LaunchApp(L"\"" + path + L"\"", false, false, NULL); + WaitUntilProcessStartsRunning(installer_util::kChromeExe); + Sleep(1200); +} + +// This method compares the registry keys after overinstall. +bool ChromeMiniInstaller::VerifyOverInstall( + std::wstring value_before_overinstall, + std::wstring value_after_overinstall) { + int64 reg_key_value_before_overinstall = StringToInt64( + value_before_overinstall); + int64 reg_key_value_after_overinstall = StringToInt64( + value_after_overinstall); + // Compare to see if the version is less. + printf("Reg Key value before overinstall is%ls\n", + value_before_overinstall.c_str()); + printf("Reg Key value after overinstall is%ls\n", + value_after_overinstall.c_str()); + if (reg_key_value_before_overinstall > reg_key_value_after_overinstall) { + printf("FAIL: Overinstalled a lower version of Chrome\n"); + return false; + } + return true; +} + +// Waits until the process starts running. +void ChromeMiniInstaller::WaitUntilProcessStartsRunning( + const wchar_t process_name[]) { + int timer = 0; + while ((process_util::GetProcessCount(process_name, NULL) == 0) && + (timer < 60000)) { + Sleep(200); + timer = timer + 200; + } + ASSERT_NE(0, process_util::GetProcessCount(process_name, NULL)); +} + +// Waits until the process stops running. +void ChromeMiniInstaller::WaitUntilProcessStopsRunning( + const wchar_t process_name[]) { + int timer = 0; + printf("\nWaiting for this process to end... %ls\n", process_name); + while ((process_util::GetProcessCount(process_name, NULL) > 0) && + (timer < 60000)) { + Sleep(200); + timer = timer + 200; + } + ASSERT_EQ(0, process_util::GetProcessCount(process_name, NULL)); +} diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.h b/chrome/test/mini_installer_test/chrome_mini_installer.h new file mode 100644 index 0000000..27d5923 --- /dev/null +++ b/chrome/test/mini_installer_test/chrome_mini_installer.h @@ -0,0 +1,105 @@ +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef CHROME_TEST_MINI_INSTALLER_TEST_CHROME_MINI_INSTALLER_H__ +#define CHROME_TEST_MINI_INSTALLER_TEST_CHROME_MINI_INSTALLER_H__ + +#include <windows.h> +#include <process.h> +#include <psapi.h> +#include <tlhelp32.h> +#include <tchar.h> +#include <errno.h> +#include <string> + +#include "base/file_util.h" + +// This class has methods to install and uninstall Chrome mini installer. +class ChromeMiniInstaller { + public: + ChromeMiniInstaller() {} + ~ChromeMiniInstaller() {} + + // Installs Chrome Mini Installer. + void InstallMiniInstaller(bool over_install = false); + + // Installs ChromeSetupDev.exe. + void InstallChromeSetupDev(); + + // This method takes care of all overinstall cases. + void OverInstall(); + + // Uninstalls Chrome. + void UnInstall(); + + // Verifies if Chrome launches after overinstall. + void VerifyChromeLaunch(); + + private: + // Closes Chrome uninstall confirm dialog window. + bool CloseWindow(LPCWSTR window_name, UINT message); + + // Closes Chrome browser. + void CloseChromeBrowser(LPCWSTR window_name); + + // Closes all running Chrome processes. + void CloseChromeProcesses(); + + // Checks for registry key. + bool CheckRegistryKey(std::wstring key_path); + + // Deletes App folder after uninstall. + void DeleteAppFolder(); + + // This method verifies Chrome shortcut. + void FindChromeShortcut(); + + // Get path for uninstall. + std::wstring GetUninstallPath(); + + // Reads registry key. + std::wstring GetRegistryKey(); + + // Launches the given EXE and waits for it to end. + void LaunchExe(std::wstring install_path, const wchar_t process_name[]); + + // Compares the registry key values after overinstall. + bool VerifyOverInstall(std::wstring reg_key_value_before_overinstall, + std::wstring reg_key_value_after_overinstall); + + // Waits until the given process starts running + void WaitUntilProcessStartsRunning(const wchar_t process_name[]); + + // Waits until the given process stops running + void WaitUntilProcessStopsRunning(const wchar_t process_name[]); + + DISALLOW_EVIL_CONSTRUCTORS(ChromeMiniInstaller); +}; + +#endif // CHROME_TEST_MINI_INSTALLER_TEST_CHROME_MINI_INSTALLER_H__ diff --git a/chrome/test/mini_installer_test/mini_installer_test.vcproj b/chrome/test/mini_installer_test/mini_installer_test.vcproj new file mode 100644 index 0000000..2a20087 --- /dev/null +++ b/chrome/test/mini_installer_test/mini_installer_test.vcproj @@ -0,0 +1,176 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="mini_installer_test" + ProjectGUID="{4B6E199A-034A-49BD-AB93-458DD37E45B1}" + RootNamespace="mini_installer_test" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="1" + InheritedPropertySheets="$(SolutionDir)..\build\common.vsprops;$(SolutionDir)..\build\debug.vsprops;$(SolutionDir)\tools\build\win\unit_test.vsprops;$(SolutionDir)\installer\util\using_util.vsprops;$(SolutionDir)..\testing\using_gtest.vsprops" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + IgnoreDefaultLibraryNames="" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + AdditionalManifestFiles="$(SolutionDir)installer\mini_installer\mini_installer.exe.manifest" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="1" + InheritedPropertySheets="$(SolutionDir)..\build\common.vsprops;$(SolutionDir)..\build\release.vsprops;$(SolutionDir)\tools\build\win\unit_test.vsprops;$(SolutionDir)\installer\util\using_util.vsprops;$(SolutionDir)..\testing\using_gtest.vsprops" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + AdditionalManifestFiles="$(SolutionDir)installer\mini_installer\mini_installer.exe.manifest" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\chrome_mini_installer.cc" + > + </File> + <File + RelativePath=".\chrome_mini_installer.h" + > + </File> + <File + RelativePath=".\mini_installer_test_constants.cc" + > + </File> + <File + RelativePath=".\mini_installer_test_constants.h" + > + </File> + <File + RelativePath="..\..\installer\util\run_all_unittests.cc" + > + </File> + <File + RelativePath="..\..\installer\setup\setup_constants.cc" + > + </File> + <File + RelativePath=".\test.cc" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/chrome/test/mini_installer_test/mini_installer_test_constants.cc b/chrome/test/mini_installer_test/mini_installer_test_constants.cc new file mode 100644 index 0000000..d3f91be --- /dev/null +++ b/chrome/test/mini_installer_test/mini_installer_test_constants.cc @@ -0,0 +1,51 @@ +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "chrome/test/mini_installer_test/mini_installer_test_constants.h" + +namespace mini_installer_constants { + +const wchar_t kAppDir[] = L"Google\\Chrome\\Application\\"; +const wchar_t kChromeSetupExecutable[] = L"setup.exe"; +const wchar_t kChromeMiniInstallerExecutable[] = L"mini_installer.exe"; +const wchar_t kChromeInstallerType[] = L"dev"; + +const wchar_t kBrowserAppName[] = L"Google - Google Chrome"; +const wchar_t kBrowserTabName[] = L"New Tab - Google Chrome"; +const wchar_t kConfirmDialog[] = L"Google Chrome"; +const wchar_t kInstallerWindow[] = L"Google App Installer"; +const wchar_t kFirstChromeUI[] = L"Welcome to Chrome"; + +const wchar_t kChromeUninstallIETitle[] = + L"Google Chrome - Windows Internet Explorer"; + +// Chrome meta installer location. +const wchar_t kChromeSetupDevExeLocation[] = + L"\\\\172.23.44.61\\shared\\chrome_autotest\\DevTest\\ChromeSetup_en.exe"; +} diff --git a/chrome/test/mini_installer_test/mini_installer_test_constants.h b/chrome/test/mini_installer_test/mini_installer_test_constants.h new file mode 100644 index 0000000..d35c733 --- /dev/null +++ b/chrome/test/mini_installer_test/mini_installer_test_constants.h @@ -0,0 +1,54 @@ +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Constants related to the Chrome mini installer testing. + +#ifndef CHROME_TEST_MINI_INSTALLER_TEST_MINI_INSTALLER_TEST_CONSTANTS_H__ +#define CHROME_TEST_MINI_INSTALLER_TEST_MINI_INSTALLER_TEST_CONSTANTS_H__ + +namespace mini_installer_constants { + +extern const wchar_t kAppDir[]; +extern const wchar_t kChromeSetupExecutable[]; +extern const wchar_t kChromeMiniInstallerExecutable[]; +extern const wchar_t kChromeInstallerType[]; + +// Window names. +extern const wchar_t kBrowserAppName[]; +extern const wchar_t kBrowserTabName[]; +extern const wchar_t kConfirmDialog[]; +extern const wchar_t kInstallerWindow[]; +extern const wchar_t kFirstChromeUI[]; +extern const wchar_t kChromeUninstallIETitle[]; + +// Chrome meta installer location. +extern const wchar_t kChromeSetupDevExeLocation[]; +} + +#endif // CHROME_TEST_MINI_INSTALLER_TEST_MINI_INSTALLER_TEST_CONSTANTS_H__ diff --git a/chrome/test/mini_installer_test/test.cc b/chrome/test/mini_installer_test/test.cc new file mode 100644 index 0000000..cc61c86 --- /dev/null +++ b/chrome/test/mini_installer_test/test.cc @@ -0,0 +1,58 @@ +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "chrome_mini_installer.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { +class MiniInstallTest : public testing::Test { + protected: + virtual void SetUp() { + // Currently no setup required + } + + virtual void TearDown() { + // Currently no tear down required + } + }; +}; + +// This test is disabled. See bug 1199175. +TEST_F(MiniInstallTest, DISABLED_MiniInstallerCleanInstallTest) { + ChromeMiniInstaller installer; + installer.InstallMiniInstaller(); + installer.UnInstall(); +} + +// This test is disabled. See bug 1199175. +TEST_F(MiniInstallTest, DISABLED_MiniInstallerOverChromeSetupDevTest) { + ChromeMiniInstaller installer; + installer.OverInstall(); + installer.UnInstall(); +} |