Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6087)

Unified Diff: chrome/test/mini_installer_test/test.cc

Issue 329037: Add a command-line option for specifying a particular build to test and for p... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/mini_installer_test/run_all_unittests.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/mini_installer_test/test.cc
===================================================================
--- chrome/test/mini_installer_test/test.cc (revision 29665)
+++ chrome/test/mini_installer_test/test.cc (working copy)
@@ -1,189 +1,150 @@
// Copyright (c) 2009 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/command_line.h"
#include "base/platform_thread.h"
+#include "base/scoped_ptr.h"
#include "base/win_util.h"
#include "chrome/installer/util/install_util.h"
#include "chrome/test/mini_installer_test/mini_installer_test_constants.h"
+#include "chrome/test/mini_installer_test/mini_installer_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "chrome_mini_installer.h"
+// Although the C++ style guide disallows use of namespace directive, use
+// here because this is not only a .cc file, but also a test.
+using namespace mini_installer_constants;
+
namespace {
+
class MiniInstallTest : public testing::Test {
protected:
- void CleanTheSystem() {
- ChromeMiniInstaller userinstall(mini_installer_constants::kUserInstall);
+ // Whether these tests should be run regardless of our running platform.
+ bool force_tests_;
+
+ // Installers created in test fixture setup for convenience.
+ scoped_ptr<ChromeMiniInstaller> user_inst_, sys_inst_;
+
+ public:
+ static void CleanTheSystem() {
kuchhal 2009/10/27 18:57:09 why static?
+ ChromeMiniInstaller userinstall(kUserInstall);
userinstall.UnInstall();
- ChromeMiniInstaller systeminstall(
- mini_installer_constants::kSystemInstall);
- systeminstall.UnInstall();
+ ChromeMiniInstaller systeminstall(kSystemInstall);
+ systeminstall.UnInstall();
}
+
virtual void SetUp() {
- if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) {
+ // Parse test command-line arguments.
+ const CommandLine* cmd = CommandLine::ForCurrentProcess();
+ std::wstring build = cmd->GetSwitchValue(L"build");
+ if (build.empty())
+ build = L"latest";
+
+ force_tests_ = cmd->HasSwitch(L"force");
+
+ if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA ||
+ force_tests_) {
CleanTheSystem();
+ // Separate the test output from cleaning output
+ printf("\nBEGIN test----------------------------------------\n");
+
+ // Create a few differently configured installers that are used in
+ // the tests, for convenience.
+ user_inst_.reset(new ChromeMiniInstaller(kUserInstall));
+ user_inst_->SetBuildUnderTest(build);
+ sys_inst_.reset(new ChromeMiniInstaller(kSystemInstall));
+ sys_inst_->SetBuildUnderTest(build);
+
} else {
- printf("These tests don't run on Vista\n");
+ printf("These tests don't run on this platform.\n");
exit(0);
}
}
- virtual void TearDown() {
- if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) {
- PlatformThread::Sleep(2000);
- CleanTheSystem();
- } else {
- printf("These tests don't run on Vista\n");
- exit(0);
- }
+
+ static void TearDownTestCase() {
kuchhal 2009/10/27 18:57:09 Why static and why TearDownTestCase and not just T
kkania 2009/10/27 19:45:02 CleanTheSystem is called in SetUp already. I use T
+ // Uninstall Chrome from the system after tests are run.
+ CleanTheSystem();
}
};
};
-// TODO(nsylvain): Change this for GOOGLE_CHROME_BUILD when we have the
-// previous installers accessible from our Google Chrome continuous buildbot.
-#if defined(OFFICIAL_BUILD)
-TEST_F(MiniInstallTest, InstallLatestDevFullInstallerTest) {
- ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
- installer.InstallFullInstaller(false,
- mini_installer_constants::kDevChannelBuild);
-}
+#if defined(GOOGLE_CHROME_BUILD)
+// Could use a parameterized gtest to slim down this list of tests, but since
+// these tests will often be run manually, don't want to have obscure test
+// names.
-TEST_F(MiniInstallTest, InstallLatestDevFullInstallerTestSystemLevel) {
- ChromeMiniInstaller installer(mini_installer_constants::kSystemInstall);
- installer.InstallFullInstaller(false,
- mini_installer_constants::kDevChannelBuild);
+// Install full installer.
+TEST_F(MiniInstallTest, FullInstallerUser) {
+ user_inst_->InstallFullInstaller(false);
}
-
-TEST_F(MiniInstallTest, InstallLatestStableFullInstallerTest) {
- ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
- installer.InstallFullInstaller(false,
- mini_installer_constants::kStableChannelBuild);
+TEST_F(MiniInstallTest, FullInstallerSys) {
+ sys_inst_->InstallFullInstaller(false);
}
-TEST_F(MiniInstallTest, InstallLatestStableFullInstallerTestSystemLevel) {
- ChromeMiniInstaller installer(mini_installer_constants::kSystemInstall);
- installer.InstallFullInstaller(false,
- mini_installer_constants::kStableChannelBuild);
+// Overinstall full installer.
+TEST_F(MiniInstallTest, FullOverPreviousFullUser) {
+ user_inst_->OverInstallOnFullInstaller(kFullInstall);
}
-
-TEST_F(MiniInstallTest,
- InstallLatestDevFullInstallerOverPreviousFullDevInstaller) {
- ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
- installer.OverInstallOnFullInstaller(mini_installer_constants::kFullInstall,
- mini_installer_constants::kDevChannelBuild);
+TEST_F(MiniInstallTest, FullOverPreviousFullSys) {
+ sys_inst_->OverInstallOnFullInstaller(kFullInstall);
}
-TEST_F(MiniInstallTest,
- InstallLatestDevFullInstallerOverPreviousFullDevInstallerSystemLevel) {
- ChromeMiniInstaller installer(mini_installer_constants::kSystemInstall);
- installer.OverInstallOnFullInstaller(mini_installer_constants::kFullInstall,
- mini_installer_constants::kDevChannelBuild);
+// Overinstall diff installer.
+TEST_F(MiniInstallTest, DiffOverPreviousFullUser) {
+ user_inst_->OverInstallOnFullInstaller(kDiffInstall);
}
-
-TEST_F(MiniInstallTest,
- InstallLatestDevDiffInstallerOverPreviousFullDevInstaller) {
- ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
- installer.OverInstallOnFullInstaller(mini_installer_constants::kDiffInstall,
- mini_installer_constants::kDevChannelBuild);
+TEST_F(MiniInstallTest, DiffOverPreviousFullSys) {
+ sys_inst_->OverInstallOnFullInstaller(kDiffInstall);
}
-TEST_F(MiniInstallTest,
- InstallLatestDevDiffInstallerOverPreviousFullDevInstallerSystemLevel) {
- ChromeMiniInstaller installer(mini_installer_constants::kSystemInstall);
- installer.OverInstallOnFullInstaller(mini_installer_constants::kDiffInstall,
- mini_installer_constants::kDevChannelBuild);
+// Repair version folder.
+TEST_F(MiniInstallTest, RepairFolderOnFullUser) {
+ user_inst_->Repair(ChromeMiniInstaller::VERSION_FOLDER);
}
-
-TEST_F(MiniInstallTest,
- InstallLatestFullStableInstallerOverPreviousFullStableInstaller) {
- ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
- installer.OverInstallOnFullInstaller(mini_installer_constants::kFullInstall,
- mini_installer_constants::kStableChannelBuild);
+TEST_F(MiniInstallTest, RepairFolderOnFullSys) {
+ sys_inst_->Repair(ChromeMiniInstaller::VERSION_FOLDER);
}
-TEST_F(MiniInstallTest,
- InstallLatestFullStableInstallerOverPreviousFullStableInstallerSystemLevel) {
- ChromeMiniInstaller installer(mini_installer_constants::kSystemInstall);
- installer.OverInstallOnFullInstaller(mini_installer_constants::kFullInstall,
- mini_installer_constants::kStableChannelBuild);
+// Repair registry.
+TEST_F(MiniInstallTest, RepairRegistryOnFullUser) {
+ user_inst_->Repair(ChromeMiniInstaller::REGISTRY);
}
-
-TEST_F(MiniInstallTest,
- InstallLatestDiffStableInstallerOverPreviousFullStableInstaller) {
- ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
- installer.OverInstallOnFullInstaller(mini_installer_constants::kDiffInstall,
- mini_installer_constants::kStableChannelBuild);
+TEST_F(MiniInstallTest, RepairRegistryOnFullSys) {
+ sys_inst_->Repair(ChromeMiniInstaller::REGISTRY);
}
-TEST_F(MiniInstallTest,
- InstallLatestDiffStableInstallerOverPreviousFullStableInstallerSystemLevel) {
- ChromeMiniInstaller installer(mini_installer_constants::kSystemInstall);
- installer.OverInstallOnFullInstaller(mini_installer_constants::kDiffInstall,
- mini_installer_constants::kStableChannelBuild);
+// Install standalone.
+TEST_F(MiniInstallTest, InstallStandaloneUser) {
+ user_inst_->InstallStandaloneInstaller();
}
-TEST_F(MiniInstallTest, StandaloneInstallerTest) {
- ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
- installer.InstallStandaloneInstaller();
-}
-
// This test doesn't make sense. Disabling for now.
TEST_F(MiniInstallTest, DISABLED_MiniInstallerOverChromeMetaInstallerTest) {
- ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
- installer.OverInstall(mini_installer_constants::kDevChannelBuild);
+ user_inst_->OverInstall();
}
// Encountering issue 9593. Disabling temporarily.
TEST_F(MiniInstallTest,
DISABLED_InstallLatestStableFullInstallerOverChromeMetaInstaller) {
- ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
- installer.OverInstall(mini_installer_constants::kStableChannelBuild);
+ user_inst_->OverInstall();
}
// Encountering issue 9593. Disabling temporarily.
TEST_F(MiniInstallTest,
DISABLED_InstallLatestDevFullInstallerOverChromeMetaInstallerTest) {
- ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
- installer.OverInstall(mini_installer_constants::kDevChannelBuild);
+ user_inst_->OverInstall();
}
-
-// Repair testcases
-
-TEST_F(MiniInstallTest, RepairFolderTestOnLatestDevFullInstaller) {
- ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
- installer.Repair(ChromeMiniInstaller::VERSION_FOLDER,
- mini_installer_constants::kDevChannelBuild);
-}
-
-TEST_F(MiniInstallTest, RepairFolderTestOnLatestDevFullInstallerSystemLevel) {
- ChromeMiniInstaller installer(mini_installer_constants::kSystemInstall);
- installer.Repair(ChromeMiniInstaller::VERSION_FOLDER,
- mini_installer_constants::kDevChannelBuild);
-}
-
-TEST_F(MiniInstallTest, RepairRegistryTestOnLatestDevFullInstaller) {
- ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
- installer.Repair(ChromeMiniInstaller::REGISTRY,
- mini_installer_constants::kDevChannelBuild);
-}
-
-TEST_F(MiniInstallTest, RepairRegistryTestOnLatestDevFullInstallerSystemLevel) {
- ChromeMiniInstaller installer(mini_installer_constants::kSystemInstall);
- installer.Repair(ChromeMiniInstaller::REGISTRY,
- mini_installer_constants::kDevChannelBuild);
-}
#endif
-TEST_F(MiniInstallTest, InstallLatestMiniInstallerAtSystemLevel) {
- ChromeMiniInstaller installer(mini_installer_constants::kSystemInstall);
- installer.Install();
+TEST_F(MiniInstallTest, InstallMiniInstallerSys) {
+ sys_inst_->Install();
}
-TEST_F(MiniInstallTest, InstallLatestMiniInstallerAtUserLevel) {
- ChromeMiniInstaller installer(mini_installer_constants::kUserInstall);
- installer.Install();
+TEST_F(MiniInstallTest, InstallMiniInstallerUser) {
+ user_inst_->Install();
}
-TEST(InstallUtilTests, MiniInstallTestValidWindowsVersion) {
+TEST_F(MiniInstallTest, MiniInstallTestValidWindowsVersion) {
// We run the tests on all supported OSes.
// Make sure the code agrees.
EXPECT_TRUE(InstallUtil::IsOSSupported());
« no previous file with comments | « chrome/test/mini_installer_test/run_all_unittests.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698