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

Side by Side Diff: chrome/installer/util/product_unittest.cc

Issue 2621923002: Product cleanups in the wake of multi-install removal. (Closed)
Patch Set: sync to position 442831 Created 3 years, 11 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
« no previous file with comments | « chrome/installer/util/product_operations.h ('k') | chrome/installer/util/util_constants.h » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/installer/util/product.h" 5 #include "chrome/installer/util/product.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/test/test_reg_util_win.h" 14 #include "base/test/test_reg_util_win.h"
15 #include "chrome/common/chrome_paths.h" 15 #include "chrome/common/chrome_paths.h"
16 #include "chrome/installer/util/browser_distribution.h" 16 #include "chrome/installer/util/browser_distribution.h"
17 #include "chrome/installer/util/google_update_constants.h" 17 #include "chrome/installer/util/google_update_constants.h"
18 #include "chrome/installer/util/installation_state.h" 18 #include "chrome/installer/util/installation_state.h"
19 #include "chrome/installer/util/master_preferences.h"
20 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
21 20
22 using base::win::RegKey; 21 using base::win::RegKey;
23 using installer::Product; 22 using installer::Product;
24 using installer::MasterPreferences;
25 using registry_util::RegistryOverrideManager; 23 using registry_util::RegistryOverrideManager;
26 24
27 TEST(ProductTest, ProductInstallBasic) { 25 TEST(ProductTest, ProductInstallBasic) {
28 // TODO(tommi): We should mock this and use our mocked distribution. 26 // TODO(tommi): We should mock this and use our mocked distribution.
29 const bool multi_install = false;
30 const bool system_level = true; 27 const bool system_level = true;
31 base::CommandLine cmd_line = base::CommandLine::FromString(
32 std::wstring(L"setup.exe") +
33 (multi_install ? L" --multi-install --chrome" : L"") +
34 (system_level ? L" --system-level" : L""));
35 installer::MasterPreferences prefs(cmd_line);
36 installer::InstallationState machine_state; 28 installer::InstallationState machine_state;
37 machine_state.Initialize(); 29 machine_state.Initialize();
38 30
39 std::unique_ptr<Product> product = 31 std::unique_ptr<Product> product =
40 base::MakeUnique<Product>(BrowserDistribution::GetDistribution()); 32 base::MakeUnique<Product>(BrowserDistribution::GetDistribution());
41 product->InitializeFromPreferences(prefs);
42 BrowserDistribution* distribution = product->distribution(); 33 BrowserDistribution* distribution = product->distribution();
43 34
44 base::FilePath user_data_dir; 35 base::FilePath user_data_dir;
45 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); 36 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir));
46 EXPECT_FALSE(user_data_dir.empty()); 37 EXPECT_FALSE(user_data_dir.empty());
47 38
48 base::FilePath program_files; 39 base::FilePath program_files;
49 ASSERT_TRUE(PathService::Get(base::DIR_PROGRAM_FILES, &program_files)); 40 ASSERT_TRUE(PathService::Get(base::DIR_PROGRAM_FILES, &program_files));
50 // The User Data path should never be under program files, even though 41 // The User Data path should never be under program files, even though
51 // system_level is true. 42 // system_level is true.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 if (chrome_state) 87 if (chrome_state)
97 EXPECT_TRUE(chrome_state->is_msi()); 88 EXPECT_TRUE(chrome_state->is_msi());
98 } 89 }
99 } 90 }
100 91
101 TEST(ProductTest, LaunchChrome) { 92 TEST(ProductTest, LaunchChrome) {
102 // TODO(tommi): Test Product::LaunchChrome and 93 // TODO(tommi): Test Product::LaunchChrome and
103 // Product::LaunchChromeAndWait. 94 // Product::LaunchChromeAndWait.
104 NOTIMPLEMENTED(); 95 NOTIMPLEMENTED();
105 } 96 }
OLDNEW
« no previous file with comments | « chrome/installer/util/product_operations.h ('k') | chrome/installer/util/util_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698