OLD | NEW |
---|---|
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, |
31 cmd->HasSwitch(installer::switches::kChromeFrame)); | 31 cmd->HasSwitch(installer::switches::kChromeFrame)); |
32 systeminstall.UnInstall(); | 32 systeminstall.UnInstall(); |
33 } else { | 33 } else { |
34 ChromeMiniInstaller userinstall(kUserInstall, | 34 ChromeMiniInstaller userinstall(false, |
35 cmd->HasSwitch(installer::switches::kChromeFrame)); | 35 cmd->HasSwitch(installer::switches::kChromeFrame)); |
kkania
2011/09/26 20:00:53
can't you replace this with false? same below?
Huyen
2011/09/27 23:00:24
Done.
| |
36 userinstall.UnInstall(); | 36 userinstall.UnInstall(); |
37 ChromeMiniInstaller systeminstall(kSystemInstall, | 37 ChromeMiniInstaller systeminstall(true, |
38 cmd->HasSwitch(installer::switches::kChromeFrame)); | 38 cmd->HasSwitch(installer::switches::kChromeFrame)); |
39 systeminstall.UnInstall(); | 39 systeminstall.UnInstall(); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 virtual void SetUp() { | 43 virtual void SetUp() { |
44 // Parse test command-line arguments. | 44 // Parse test command-line arguments. |
45 const CommandLine* cmd = CommandLine::ForCurrentProcess(); | 45 const CommandLine* cmd = CommandLine::ForCurrentProcess(); |
46 std::wstring build = | 46 std::wstring build = |
47 cmd->GetSwitchValueNative(switches::kInstallerTestBuild); | 47 cmd->GetSwitchValueNative(switches::kInstallerTestBuild); |
48 chrome_frame_ = cmd->HasSwitch(installer::switches::kChromeFrame); | 48 chrome_frame_ = cmd->HasSwitch(installer::switches::kChromeFrame); |
49 | 49 |
50 CleanTheSystem(); | 50 CleanTheSystem(); |
51 // Separate the test output from cleaning output | 51 // Separate the test output from cleaning output |
52 printf("\nBEGIN test----------------------------------------\n"); | 52 printf("\nBEGIN test----------------------------------------\n"); |
53 | 53 |
54 // Create a few differently configured installers that are used in | 54 // Create a few differently configured installers that are used in |
55 // the tests, for convenience. | 55 // the tests, for convenience. |
56 user_inst_.reset(new ChromeMiniInstaller(kUserInstall, | 56 user_inst_.reset(new ChromeMiniInstaller(false, |
kkania
2011/09/26 20:00:53
collapse on one line; same below
Huyen
2011/09/27 23:00:24
Done.
| |
57 chrome_frame_)); | 57 chrome_frame_)); |
58 sys_inst_.reset(new ChromeMiniInstaller(kSystemInstall, | 58 sys_inst_.reset(new ChromeMiniInstaller(true, |
59 chrome_frame_)); | 59 chrome_frame_)); |
60 sys_inst_->SetBuildUnderTest(build); | 60 sys_inst_->SetBuildUnderTest(build); |
61 user_inst_->SetBuildUnderTest(build); | 61 user_inst_->SetBuildUnderTest(build); |
62 } | 62 } |
63 | 63 |
64 static void TearDownTestCase() { | 64 static void TearDownTestCase() { |
65 // Uninstall Chrome from the system after tests are run. | 65 // Uninstall Chrome from the system after tests are run. |
66 CleanTheSystem(); | 66 CleanTheSystem(); |
67 } | 67 } |
68 | 68 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 if (!chrome_frame_) | 168 if (!chrome_frame_) |
169 user_inst_->OverInstall(); | 169 user_inst_->OverInstall(); |
170 } | 170 } |
171 | 171 |
172 // Encountering issue 9593. Disabling temporarily. | 172 // Encountering issue 9593. Disabling temporarily. |
173 TEST_F(MiniInstallTest, | 173 TEST_F(MiniInstallTest, |
174 DISABLED_InstallLatestDevFullInstallerOverChromeMetaInstallerTest) { | 174 DISABLED_InstallLatestDevFullInstallerOverChromeMetaInstallerTest) { |
175 if (!chrome_frame_) | 175 if (!chrome_frame_) |
176 user_inst_->OverInstall(); | 176 user_inst_->OverInstall(); |
177 } | 177 } |
178 | |
179 TEST_F(MiniInstallTest, | |
180 InstallChromeUsingMultiInstallUser) { | |
181 user_inst_->InstallUsingMultiInstall(); | |
kkania
2011/09/26 20:00:53
do these work when you do --chrome-frame too?
Huyen
2011/09/27 23:00:24
I haven't try this scenario yet but it is a test t
| |
182 } | |
183 | |
184 TEST_F(MiniInstallTest, | |
185 InstallChromeUsingMultiInstallSys) { | |
186 sys_inst_->InstallUsingMultiInstall(); | |
187 } | |
178 #endif | 188 #endif |
179 | 189 |
180 TEST_F(MiniInstallTest, InstallMiniInstallerSys) { | 190 TEST_F(MiniInstallTest, InstallMiniInstallerSys) { |
181 sys_inst_->Install(); | 191 sys_inst_->Install(); |
182 } | 192 } |
183 | 193 |
184 #if defined(OS_WIN) | 194 #if defined(OS_WIN) |
185 // http://crbug.com/57157 - Fails on windows. | 195 // http://crbug.com/57157 - Fails on windows. |
186 #define MAYBE_InstallMiniInstallerUser FLAKY_InstallMiniInstallerUser | 196 #define MAYBE_InstallMiniInstallerUser FLAKY_InstallMiniInstallerUser |
187 #else | 197 #else |
188 #define MAYBE_InstallMiniInstallerUser InstallMiniInstallerUser | 198 #define MAYBE_InstallMiniInstallerUser InstallMiniInstallerUser |
189 #endif | 199 #endif |
190 TEST_F(MiniInstallTest, MAYBE_InstallMiniInstallerUser) { | 200 TEST_F(MiniInstallTest, MAYBE_InstallMiniInstallerUser) { |
191 user_inst_->Install(); | 201 user_inst_->Install(); |
192 } | 202 } |
193 | 203 |
194 TEST_F(MiniInstallTest, MiniInstallTestValidWindowsVersion) { | 204 TEST_F(MiniInstallTest, MiniInstallTestValidWindowsVersion) { |
195 // We run the tests on all supported OSes. | 205 // We run the tests on all supported OSes. |
196 // Make sure the code agrees. | 206 // Make sure the code agrees. |
197 EXPECT_TRUE(InstallUtil::IsOSSupported()); | 207 EXPECT_TRUE(InstallUtil::IsOSSupported()); |
198 } | 208 } |
OLD | NEW |