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

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
« no previous file with comments | « chrome/test/mini_installer_test/run_all_unittests.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(true, true).UnInstall();
31 cmd->HasSwitch(installer::switches::kChromeFrame));
32 systeminstall.UnInstall();
33 } else { 31 } else {
34 ChromeMiniInstaller userinstall(kUserInstall, 32 ChromeMiniInstaller(false, false).UnInstall();
35 cmd->HasSwitch(installer::switches::kChromeFrame)); 33 ChromeMiniInstaller(true, false).UnInstall();
36 userinstall.UnInstall();
37 ChromeMiniInstaller systeminstall(kSystemInstall,
38 cmd->HasSwitch(installer::switches::kChromeFrame));
39 systeminstall.UnInstall();
40 } 34 }
41 } 35 }
42 36
43 virtual void SetUp() { 37 virtual void SetUp() {
44 // Parse test command-line arguments. 38 // Parse test command-line arguments.
45 const CommandLine* cmd = CommandLine::ForCurrentProcess(); 39 const CommandLine* cmd = CommandLine::ForCurrentProcess();
46 std::wstring build = 40 std::wstring build =
47 cmd->GetSwitchValueNative(switches::kInstallerTestBuild); 41 cmd->GetSwitchValueNative(switches::kInstallerTestBuild);
48 chrome_frame_ = cmd->HasSwitch(installer::switches::kChromeFrame); 42 chrome_frame_ = cmd->HasSwitch(installer::switches::kChromeFrame);
49 43
50 CleanTheSystem(); 44 CleanTheSystem();
51 // Separate the test output from cleaning output 45 // Separate the test output from cleaning output
52 printf("\nBEGIN test----------------------------------------\n"); 46 printf("\nBEGIN test----------------------------------------\n");
53 47
54 // Create a few differently configured installers that are used in 48 // Create a few differently configured installers that are used in
55 // the tests, for convenience. 49 // the tests, for convenience.
56 user_inst_.reset(new ChromeMiniInstaller(kUserInstall, 50 user_inst_.reset(new ChromeMiniInstaller(false, chrome_frame_));
57 chrome_frame_)); 51 sys_inst_.reset(new ChromeMiniInstaller(true, chrome_frame_));
58 sys_inst_.reset(new ChromeMiniInstaller(kSystemInstall,
59 chrome_frame_));
60 sys_inst_->SetBuildUnderTest(build); 52 sys_inst_->SetBuildUnderTest(build);
61 user_inst_->SetBuildUnderTest(build); 53 user_inst_->SetBuildUnderTest(build);
62 } 54 }
63 55
64 static void TearDownTestCase() { 56 static void TearDownTestCase() {
65 // Uninstall Chrome from the system after tests are run. 57 // Uninstall Chrome from the system after tests are run.
66 CleanTheSystem(); 58 CleanTheSystem();
67 } 59 }
68 60
69 protected: 61 protected:
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 if (!chrome_frame_) 160 if (!chrome_frame_)
169 user_inst_->OverInstall(); 161 user_inst_->OverInstall();
170 } 162 }
171 163
172 // Encountering issue 9593. Disabling temporarily. 164 // Encountering issue 9593. Disabling temporarily.
173 TEST_F(MiniInstallTest, 165 TEST_F(MiniInstallTest,
174 DISABLED_InstallLatestDevFullInstallerOverChromeMetaInstallerTest) { 166 DISABLED_InstallLatestDevFullInstallerOverChromeMetaInstallerTest) {
175 if (!chrome_frame_) 167 if (!chrome_frame_)
176 user_inst_->OverInstall(); 168 user_inst_->OverInstall();
177 } 169 }
170
171 TEST_F(MiniInstallTest,
172 InstallChromeUsingMultiInstallUser) {
173 user_inst_->InstallUsingMultiInstall();
174 }
175
176 TEST_F(MiniInstallTest,
177 InstallChromeUsingMultiInstallSys) {
178 sys_inst_->InstallUsingMultiInstall();
179 }
178 #endif 180 #endif
179 181
180 TEST_F(MiniInstallTest, InstallMiniInstallerSys) { 182 TEST_F(MiniInstallTest, InstallMiniInstallerSys) {
181 sys_inst_->Install(); 183 sys_inst_->Install();
182 } 184 }
183 185
184 #if defined(OS_WIN) 186 #if defined(OS_WIN)
185 // http://crbug.com/57157 - Fails on windows. 187 // http://crbug.com/57157 - Fails on windows.
186 #define MAYBE_InstallMiniInstallerUser FLAKY_InstallMiniInstallerUser 188 #define MAYBE_InstallMiniInstallerUser FLAKY_InstallMiniInstallerUser
187 #else 189 #else
188 #define MAYBE_InstallMiniInstallerUser InstallMiniInstallerUser 190 #define MAYBE_InstallMiniInstallerUser InstallMiniInstallerUser
189 #endif 191 #endif
190 TEST_F(MiniInstallTest, MAYBE_InstallMiniInstallerUser) { 192 TEST_F(MiniInstallTest, MAYBE_InstallMiniInstallerUser) {
191 user_inst_->Install(); 193 user_inst_->Install();
192 } 194 }
193 195
194 TEST_F(MiniInstallTest, MiniInstallTestValidWindowsVersion) { 196 TEST_F(MiniInstallTest, MiniInstallTestValidWindowsVersion) {
195 // We run the tests on all supported OSes. 197 // We run the tests on all supported OSes.
196 // Make sure the code agrees. 198 // Make sure the code agrees.
197 EXPECT_TRUE(InstallUtil::IsOSSupported()); 199 EXPECT_TRUE(InstallUtil::IsOSSupported());
198 } 200 }
OLDNEW
« 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