summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-21 21:57:04 +0000
committerkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-21 21:57:04 +0000
commite23fced69f230fa3b1f8368722b7a308e8668077 (patch)
treed8078ec60f6afd48ab8ece40f4cd5d882c8a77be /chrome/test
parenta66041ce5b22b4402d19902f7e348a9411f0a82d (diff)
downloadchromium_src-e23fced69f230fa3b1f8368722b7a308e8668077.zip
chromium_src-e23fced69f230fa3b1f8368722b7a308e8668077.tar.gz
chromium_src-e23fced69f230fa3b1f8368722b7a308e8668077.tar.bz2
Fix installer tests broken by r13926.
Review URL: http://codereview.chromium.org/87011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14140 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.h6
-rw-r--r--chrome/test/mini_installer_test/mini_installer_test_constants.cc2
-rw-r--r--chrome/test/mini_installer_test/mini_installer_test_constants.h1
-rw-r--r--chrome/test/mini_installer_test/test.cc6
5 files changed, 44 insertions, 7 deletions
diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.cc b/chrome/test/mini_installer_test/chrome_mini_installer.cc
index 4b6e840..5295bb8 100644
--- a/chrome/test/mini_installer_test/chrome_mini_installer.cc
+++ b/chrome/test/mini_installer_test/chrome_mini_installer.cc
@@ -210,8 +210,7 @@ void ChromeMiniInstaller::UnInstall() {
uninstall_args = uninstall_args + L" -system-level";
base::LaunchApp(uninstall_args, false, false, NULL);
printf("Launched setup.exe -uninstall....\n");
- ASSERT_TRUE(CloseWindow(mini_installer_constants::kChromeBuildType,
- WM_COMMAND));
+ ASSERT_TRUE(CloseUninstallWindow());
WaitUntilProcessStopsRunning(
mini_installer_constants::kChromeSetupExecutable);
printf("\n\nUninstall Checks:\n\n");
@@ -223,7 +222,6 @@ void ChromeMiniInstaller::UnInstall() {
base::GetProcessCount(mini_installer_constants::kIEExecutable, NULL));
}
-// Takes care of Chrome uninstall dialog.
bool ChromeMiniInstaller::CloseWindow(const wchar_t* window_name,
UINT message) {
int timer = 0;
@@ -241,6 +239,38 @@ bool ChromeMiniInstaller::CloseWindow(const wchar_t* window_name,
return return_val;
}
+bool ChromeMiniInstaller::CloseUninstallWindow() {
+ HWND hndl = NULL;
+ int timer = 0;
+ while (hndl == NULL && timer < 5000) {
+ hndl = FindWindow(NULL,
+ mini_installer_constants::kChromeUninstallDialogName);
+ PlatformThread::Sleep(200);
+ timer = timer + 200;
+ }
+
+ if (hndl == NULL)
+ hndl = FindWindow(NULL, mini_installer_constants::kChromeBuildType);
+
+ if (hndl == NULL)
+ return false;
+
+ SetForegroundWindow(hndl);
+
+ INPUT key;
+ key.type = INPUT_KEYBOARD;
+ key.ki.wVk = VK_RETURN;
+ key.ki.dwFlags = 0;
+ key.ki.time = 0;
+ key.ki.wScan = 0;
+ key.ki.dwExtraInfo = 0;
+ SendInput(1, &key, sizeof(INPUT));
+ key.ki.dwExtraInfo = KEYEVENTF_KEYUP;
+ SendInput(1, &key, sizeof(INPUT));
+
+ return true;
+}
+
// Closes Chrome browser.
void ChromeMiniInstaller::CloseChromeBrowser(const wchar_t* window_name) {
WaitUntilProcessStartsRunning(installer_util::kChromeExe);
diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.h b/chrome/test/mini_installer_test/chrome_mini_installer.h
index 071edc1..0167ba1 100644
--- a/chrome/test/mini_installer_test/chrome_mini_installer.h
+++ b/chrome/test/mini_installer_test/chrome_mini_installer.h
@@ -82,9 +82,13 @@ class ChromeMiniInstaller {
// Closes First Run UI dialog.
void CloseFirstRunUIDialog(bool over_install);
- // Closes Chrome uninstall confirm dialog window.
+ // Close Window whose name is 'window_name', by sending Windows message
+ // 'message' to it.
bool CloseWindow(const wchar_t* window_name, UINT message);
+ // Closes Chrome uninstall confirm dialog window.
+ bool CloseUninstallWindow();
+
// Closes Chrome browser.
void CloseChromeBrowser(const wchar_t* window_name);
diff --git a/chrome/test/mini_installer_test/mini_installer_test_constants.cc b/chrome/test/mini_installer_test/mini_installer_test_constants.cc
index 86cefe9..9a530e1 100644
--- a/chrome/test/mini_installer_test/mini_installer_test_constants.cc
+++ b/chrome/test/mini_installer_test/mini_installer_test_constants.cc
@@ -12,12 +12,14 @@ const wchar_t kChromeBuildType[] = L"Google Chrome";
const wchar_t kChromeFirstRunUI[] = L"Welcome to Google Chrome";
const wchar_t kChromeLaunchShortcut[] = L"Google Chrome.lnk";
const wchar_t kChromeUninstallShortcut[] = L"Uninstall Google Chrome.lnk";
+const wchar_t kChromeUninstallDialogName[] = L"Uninstall Google Chrome";
#else
const wchar_t kChromeAppDir[] = L"Chromium\\Application\\";
const wchar_t kChromeBuildType[] = L"Chromium";
const wchar_t kChromeFirstRunUI[] = L"Welcome to Chromium";
const wchar_t kChromeLaunchShortcut[] = L"Chromium.lnk";
const wchar_t kChromeUninstallShortcut[] = L"Uninstall Chromium.lnk";
+const wchar_t kChromeUninstallDialogName[] = L"Uninstall Chromium";
#endif
const wchar_t kBrowserAppName[] = L"Google - Google Chrome";
const wchar_t kBrowserTabName[] = L"New Tab - Google Chrome";
diff --git a/chrome/test/mini_installer_test/mini_installer_test_constants.h b/chrome/test/mini_installer_test/mini_installer_test_constants.h
index fe94062..a87f3e1 100644
--- a/chrome/test/mini_installer_test/mini_installer_test_constants.h
+++ b/chrome/test/mini_installer_test/mini_installer_test_constants.h
@@ -23,6 +23,7 @@ extern const wchar_t kBrowserTabName[];
extern const wchar_t kChromeBuildType[];
extern const wchar_t kChromeFirstRunUI[];
extern const wchar_t kInstallerWindow[];
+extern const wchar_t kChromeUninstallDialogName[];
// Shortcut names
extern const wchar_t kChromeLaunchShortcut[];
diff --git a/chrome/test/mini_installer_test/test.cc b/chrome/test/mini_installer_test/test.cc
index 9e7f051..6c2252d 100644
--- a/chrome/test/mini_installer_test/test.cc
+++ b/chrome/test/mini_installer_test/test.cc
@@ -48,19 +48,19 @@ TEST_F(MiniInstallTest, DISABLED_StandaloneInstallerTest) {
installer.InstallStandaloneIntaller();
}
-TEST_F(MiniInstallTest, DISABLED_MiniInstallerOverChromeMetaInstallerTest) {
+TEST_F(MiniInstallTest, MiniInstallerOverChromeMetaInstallerTest) {
ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
installer.OverInstall();
}
-TEST_F(MiniInstallTest, DISABLED_MiniInstallerSystemInstallTest) {
+TEST_F(MiniInstallTest, MiniInstallerSystemInstallTest) {
if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) {
ChromeMiniInstaller installer(mini_installer_constants::kSystemInstall);
installer.Install();
}
}
-TEST_F(MiniInstallTest, DISABLED_MiniInstallerUserInstallTest) {
+TEST_F(MiniInstallTest, MiniInstallerUserInstallTest) {
ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
installer.Install();
}