OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "base/command_line.h" | 5 #include "base/command_line.h" |
5 #include "base/platform_thread.h" | 6 #include "base/platform_thread.h" |
6 #include "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
7 #include "base/win_util.h" | 8 #include "base/win_util.h" |
| 9 #include "chrome/common/chrome_switches.h" |
8 #include "chrome/installer/util/install_util.h" | 10 #include "chrome/installer/util/install_util.h" |
9 #include "chrome/installer/util/util_constants.h" | 11 #include "chrome/installer/util/util_constants.h" |
10 #include "chrome/test/mini_installer_test/mini_installer_test_constants.h" | 12 #include "chrome/test/mini_installer_test/mini_installer_test_constants.h" |
11 #include "chrome/test/mini_installer_test/mini_installer_test_util.h" | 13 #include "chrome/test/mini_installer_test/mini_installer_test_util.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
13 | 15 |
14 #include "chrome_mini_installer.h" | 16 #include "chrome_mini_installer.h" |
15 | 17 |
16 // Although the C++ style guide disallows use of namespace directive, use | 18 // Although the C++ style guide disallows use of namespace directive, use |
17 // here because this is not only a .cc file, but also a test. | 19 // here because this is not only a .cc file, but also a test. |
(...skipping 26 matching lines...) Expand all Loading... |
44 userinstall.UnInstall(); | 46 userinstall.UnInstall(); |
45 ChromeMiniInstaller systeminstall(kSystemInstall, | 47 ChromeMiniInstaller systeminstall(kSystemInstall, |
46 cmd->HasSwitch(installer_util::switches::kChromeFrame)); | 48 cmd->HasSwitch(installer_util::switches::kChromeFrame)); |
47 systeminstall.UnInstall(); | 49 systeminstall.UnInstall(); |
48 } | 50 } |
49 } | 51 } |
50 | 52 |
51 virtual void SetUp() { | 53 virtual void SetUp() { |
52 // Parse test command-line arguments. | 54 // Parse test command-line arguments. |
53 const CommandLine* cmd = CommandLine::ForCurrentProcess(); | 55 const CommandLine* cmd = CommandLine::ForCurrentProcess(); |
54 std::wstring build = cmd->GetSwitchValue(L"build"); | 56 std::wstring build = cmd->GetSwitchValue(switches::kInstallerTestBuild); |
55 if (build.empty()) | 57 if (build.empty()) |
56 build = L"latest"; | 58 build = L"latest"; |
57 force_tests_ = cmd->HasSwitch(L"force"); | 59 force_tests_ = cmd->HasSwitch(switches::kInstallerTestForce); |
58 chrome_frame_ = cmd->HasSwitch(installer_util::switches::kChromeFrame); | 60 chrome_frame_ = cmd->HasSwitch(installer_util::switches::kChromeFrame); |
59 if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA || | 61 if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA || |
60 force_tests_) { | 62 force_tests_) { |
61 CleanTheSystem(); | 63 CleanTheSystem(); |
62 // Separate the test output from cleaning output | 64 // Separate the test output from cleaning output |
63 printf("\nBEGIN test----------------------------------------\n"); | 65 printf("\nBEGIN test----------------------------------------\n"); |
64 | 66 |
65 // Create a few differently configured installers that are used in | 67 // Create a few differently configured installers that are used in |
66 // the tests, for convenience. | 68 // the tests, for convenience. |
67 if (chrome_frame_) { | 69 if (chrome_frame_) { |
68 sys_inst_.reset(new ChromeMiniInstaller(kSystemInstall, | 70 sys_inst_.reset(new ChromeMiniInstaller(kSystemInstall, |
69 chrome_frame_)); | 71 chrome_frame_)); |
70 sys_inst_->SetBuildUnderTest(build); | 72 sys_inst_->SetBuildUnderTest(build); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 TEST_F(MiniInstallTest, InstallMiniInstallerUser) { | 182 TEST_F(MiniInstallTest, InstallMiniInstallerUser) { |
181 if (!chrome_frame_) | 183 if (!chrome_frame_) |
182 user_inst_->Install(); | 184 user_inst_->Install(); |
183 } | 185 } |
184 | 186 |
185 TEST_F(MiniInstallTest, MiniInstallTestValidWindowsVersion) { | 187 TEST_F(MiniInstallTest, MiniInstallTestValidWindowsVersion) { |
186 // We run the tests on all supported OSes. | 188 // We run the tests on all supported OSes. |
187 // Make sure the code agrees. | 189 // Make sure the code agrees. |
188 EXPECT_TRUE(InstallUtil::IsOSSupported()); | 190 EXPECT_TRUE(InstallUtil::IsOSSupported()); |
189 } | 191 } |
OLD | NEW |