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

Side by Side Diff: chrome/test/mini_installer_test/test.cc

Issue 8037004: Adding simple Chrome install testing using multi-install and cleaning up a bit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/common/chrome_switches.h" 8 #include "chrome/common/chrome_switches.h"
9 #include "chrome/installer/util/install_util.h" 9 #include "chrome/installer/util/install_util.h"
10 #include "chrome/installer/util/util_constants.h" 10 #include "chrome/installer/util/util_constants.h"
11 #include "chrome/test/mini_installer_test/chrome_mini_installer.h" 11 #include "chrome/test/mini_installer_test/chrome_mini_installer.h"
12 #include "chrome/test/mini_installer_test/mini_installer_test_constants.h" 12 #include "chrome/test/mini_installer_test/mini_installer_test_constants.h"
13 #include "chrome/test/mini_installer_test/mini_installer_test_util.h" 13 #include "chrome/test/mini_installer_test/mini_installer_test_util.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 16
17 // Although the C++ style guide disallows use of namespace directive, use 17 // Although the C++ style guide disallows use of namespace directive, use
18 // here because this is not only a .cc file, but also a test. 18 // here because this is not only a .cc file, but also a test.
19 using namespace mini_installer_constants; // NOLINT 19 using namespace mini_installer_constants; // NOLINT
20 20
21 namespace { 21 namespace {
22 22
23 class MiniInstallTest : public testing::Test { 23 class MiniInstallTest : public testing::Test {
24 public: 24 public:
25 MiniInstallTest() : chrome_frame_(false) {} 25 MiniInstallTest() : chrome_frame_(false) {}
26 26
27 static void CleanTheSystem() { 27 static void CleanTheSystem() {
28 const CommandLine* cmd = CommandLine::ForCurrentProcess(); 28 const CommandLine* cmd = CommandLine::ForCurrentProcess();
29 if (cmd->HasSwitch(installer::switches::kChromeFrame)) { 29 if (cmd->HasSwitch(installer::switches::kChromeFrame)) {
30 ChromeMiniInstaller systeminstall(kSystemInstall, 30 ChromeMiniInstaller systeminstall(true, true);
kkania 2011/09/28 18:02:43 this can be simplified by just ChromeMiniInstaller
Huyen 2011/09/28 18:55:48 Done.
31 cmd->HasSwitch(installer::switches::kChromeFrame));
32 systeminstall.UnInstall(); 31 systeminstall.UnInstall();
33 } else { 32 } else {
34 ChromeMiniInstaller userinstall(kUserInstall, 33 ChromeMiniInstaller userinstall(false, false);
35 cmd->HasSwitch(installer::switches::kChromeFrame));
36 userinstall.UnInstall(); 34 userinstall.UnInstall();
37 ChromeMiniInstaller systeminstall(kSystemInstall, 35 ChromeMiniInstaller systeminstall(true,false);
kkania 2011/09/28 18:02:43 space
38 cmd->HasSwitch(installer::switches::kChromeFrame));
39 systeminstall.UnInstall(); 36 systeminstall.UnInstall();
40 } 37 }
41 } 38 }
42 39
43 virtual void SetUp() { 40 virtual void SetUp() {
44 // Parse test command-line arguments. 41 // Parse test command-line arguments.
45 const CommandLine* cmd = CommandLine::ForCurrentProcess(); 42 const CommandLine* cmd = CommandLine::ForCurrentProcess();
46 std::wstring build = 43 std::wstring build =
47 cmd->GetSwitchValueNative(switches::kInstallerTestBuild); 44 cmd->GetSwitchValueNative(switches::kInstallerTestBuild);
48 chrome_frame_ = cmd->HasSwitch(installer::switches::kChromeFrame); 45 chrome_frame_ = cmd->HasSwitch(installer::switches::kChromeFrame);
49 46
50 CleanTheSystem(); 47 CleanTheSystem();
51 // Separate the test output from cleaning output 48 // Separate the test output from cleaning output
52 printf("\nBEGIN test----------------------------------------\n"); 49 printf("\nBEGIN test----------------------------------------\n");
53 50
54 // Create a few differently configured installers that are used in 51 // Create a few differently configured installers that are used in
55 // the tests, for convenience. 52 // the tests, for convenience.
56 user_inst_.reset(new ChromeMiniInstaller(kUserInstall, 53 user_inst_.reset(new ChromeMiniInstaller(false, chrome_frame_));
57 chrome_frame_)); 54 sys_inst_.reset(new ChromeMiniInstaller(true, chrome_frame_));
58 sys_inst_.reset(new ChromeMiniInstaller(kSystemInstall,
59 chrome_frame_));
60 sys_inst_->SetBuildUnderTest(build); 55 sys_inst_->SetBuildUnderTest(build);
61 user_inst_->SetBuildUnderTest(build); 56 user_inst_->SetBuildUnderTest(build);
62 } 57 }
63 58
64 static void TearDownTestCase() { 59 static void TearDownTestCase() {
65 // Uninstall Chrome from the system after tests are run. 60 // Uninstall Chrome from the system after tests are run.
66 CleanTheSystem(); 61 CleanTheSystem();
67 } 62 }
68 63
69 protected: 64 protected:
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 if (!chrome_frame_) 163 if (!chrome_frame_)
169 user_inst_->OverInstall(); 164 user_inst_->OverInstall();
170 } 165 }
171 166
172 // Encountering issue 9593. Disabling temporarily. 167 // Encountering issue 9593. Disabling temporarily.
173 TEST_F(MiniInstallTest, 168 TEST_F(MiniInstallTest,
174 DISABLED_InstallLatestDevFullInstallerOverChromeMetaInstallerTest) { 169 DISABLED_InstallLatestDevFullInstallerOverChromeMetaInstallerTest) {
175 if (!chrome_frame_) 170 if (!chrome_frame_)
176 user_inst_->OverInstall(); 171 user_inst_->OverInstall();
177 } 172 }
173
174 TEST_F(MiniInstallTest,
175 InstallChromeUsingMultiInstallUser) {
176 user_inst_->InstallUsingMultiInstall();
177 }
178
179 TEST_F(MiniInstallTest,
180 InstallChromeUsingMultiInstallSys) {
181 sys_inst_->InstallUsingMultiInstall();
182 }
178 #endif 183 #endif
179 184
180 TEST_F(MiniInstallTest, InstallMiniInstallerSys) { 185 TEST_F(MiniInstallTest, InstallMiniInstallerSys) {
181 sys_inst_->Install(); 186 sys_inst_->Install();
182 } 187 }
183 188
184 #if defined(OS_WIN) 189 #if defined(OS_WIN)
185 // http://crbug.com/57157 - Fails on windows. 190 // http://crbug.com/57157 - Fails on windows.
186 #define MAYBE_InstallMiniInstallerUser FLAKY_InstallMiniInstallerUser 191 #define MAYBE_InstallMiniInstallerUser FLAKY_InstallMiniInstallerUser
187 #else 192 #else
188 #define MAYBE_InstallMiniInstallerUser InstallMiniInstallerUser 193 #define MAYBE_InstallMiniInstallerUser InstallMiniInstallerUser
189 #endif 194 #endif
190 TEST_F(MiniInstallTest, MAYBE_InstallMiniInstallerUser) { 195 TEST_F(MiniInstallTest, MAYBE_InstallMiniInstallerUser) {
191 user_inst_->Install(); 196 user_inst_->Install();
192 } 197 }
193 198
194 TEST_F(MiniInstallTest, MiniInstallTestValidWindowsVersion) { 199 TEST_F(MiniInstallTest, MiniInstallTestValidWindowsVersion) {
195 // We run the tests on all supported OSes. 200 // We run the tests on all supported OSes.
196 // Make sure the code agrees. 201 // Make sure the code agrees.
197 EXPECT_TRUE(InstallUtil::IsOSSupported()); 202 EXPECT_TRUE(InstallUtil::IsOSSupported());
198 } 203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698