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

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

Issue 5756007: Revert 69165 - Merge the installer, installer_util and setup_util namespaces ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years 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) 2010 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
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/platform_thread.h" 7 #include "base/platform_thread.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/installer/util/install_util.h" 10 #include "chrome/installer/util/install_util.h"
11 #include "chrome/installer/util/util_constants.h" 11 #include "chrome/installer/util/util_constants.h"
12 #include "chrome/test/mini_installer_test/chrome_mini_installer.h" 12 #include "chrome/test/mini_installer_test/chrome_mini_installer.h"
13 #include "chrome/test/mini_installer_test/mini_installer_test_constants.h" 13 #include "chrome/test/mini_installer_test/mini_installer_test_constants.h"
14 #include "chrome/test/mini_installer_test/mini_installer_test_util.h" 14 #include "chrome/test/mini_installer_test/mini_installer_test_util.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 17
18 // Although the C++ style guide disallows use of namespace directive, use 18 // Although the C++ style guide disallows use of namespace directive, use
19 // 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.
20 using namespace mini_installer_constants; 20 using namespace mini_installer_constants;
21 21
22 namespace { 22 namespace {
23 23
24 class MiniInstallTest : public testing::Test { 24 class MiniInstallTest : public testing::Test {
25 public: 25 public:
26 MiniInstallTest() : chrome_frame_(false) {} 26 MiniInstallTest() : chrome_frame_(false) {}
27 27
28 static void CleanTheSystem() { 28 static void CleanTheSystem() {
29 const CommandLine* cmd = CommandLine::ForCurrentProcess(); 29 const CommandLine* cmd = CommandLine::ForCurrentProcess();
30 if (cmd->HasSwitch(installer::switches::kChromeFrame)) { 30 if (cmd->HasSwitch(installer_util::switches::kChromeFrame)) {
31 ChromeMiniInstaller systeminstall(kSystemInstall, 31 ChromeMiniInstaller systeminstall(kSystemInstall,
32 cmd->HasSwitch(installer::switches::kChromeFrame)); 32 cmd->HasSwitch(installer_util::switches::kChromeFrame));
33 systeminstall.UnInstall(); 33 systeminstall.UnInstall();
34 } else { 34 } else {
35 ChromeMiniInstaller userinstall(kUserInstall, 35 ChromeMiniInstaller userinstall(kUserInstall,
36 cmd->HasSwitch(installer::switches::kChromeFrame)); 36 cmd->HasSwitch(installer_util::switches::kChromeFrame));
37 userinstall.UnInstall(); 37 userinstall.UnInstall();
38 ChromeMiniInstaller systeminstall(kSystemInstall, 38 ChromeMiniInstaller systeminstall(kSystemInstall,
39 cmd->HasSwitch(installer::switches::kChromeFrame)); 39 cmd->HasSwitch(installer_util::switches::kChromeFrame));
40 systeminstall.UnInstall(); 40 systeminstall.UnInstall();
41 } 41 }
42 } 42 }
43 43
44 virtual void SetUp() { 44 virtual void SetUp() {
45 // Parse test command-line arguments. 45 // Parse test command-line arguments.
46 const CommandLine* cmd = CommandLine::ForCurrentProcess(); 46 const CommandLine* cmd = CommandLine::ForCurrentProcess();
47 std::wstring build = 47 std::wstring build =
48 cmd->GetSwitchValueNative(switches::kInstallerTestBuild); 48 cmd->GetSwitchValueNative(switches::kInstallerTestBuild);
49 if (build.empty()) 49 if (build.empty())
50 build = L"latest"; 50 build = L"latest";
51 chrome_frame_ = cmd->HasSwitch(installer::switches::kChromeFrame); 51 chrome_frame_ = cmd->HasSwitch(installer_util::switches::kChromeFrame);
52 52
53 CleanTheSystem(); 53 CleanTheSystem();
54 // Separate the test output from cleaning output 54 // Separate the test output from cleaning output
55 printf("\nBEGIN test----------------------------------------\n"); 55 printf("\nBEGIN test----------------------------------------\n");
56 56
57 // Create a few differently configured installers that are used in 57 // Create a few differently configured installers that are used in
58 // the tests, for convenience. 58 // the tests, for convenience.
59 user_inst_.reset(new ChromeMiniInstaller(kUserInstall, 59 user_inst_.reset(new ChromeMiniInstaller(kUserInstall,
60 chrome_frame_)); 60 chrome_frame_));
61 sys_inst_.reset(new ChromeMiniInstaller(kSystemInstall, 61 sys_inst_.reset(new ChromeMiniInstaller(kSystemInstall,
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 #endif 172 #endif
173 TEST_F(MiniInstallTest, MAYBE_InstallMiniInstallerUser) { 173 TEST_F(MiniInstallTest, MAYBE_InstallMiniInstallerUser) {
174 user_inst_->Install(); 174 user_inst_->Install();
175 } 175 }
176 176
177 TEST_F(MiniInstallTest, MiniInstallTestValidWindowsVersion) { 177 TEST_F(MiniInstallTest, MiniInstallTestValidWindowsVersion) {
178 // We run the tests on all supported OSes. 178 // We run the tests on all supported OSes.
179 // Make sure the code agrees. 179 // Make sure the code agrees.
180 EXPECT_TRUE(InstallUtil::IsOSSupported()); 180 EXPECT_TRUE(InstallUtil::IsOSSupported());
181 } 181 }
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