OLD | NEW |
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" |
(...skipping 17 matching lines...) Expand all Loading... |
28 const bool multi_install = false; | 28 const bool multi_install = false; |
29 const bool system_level = true; | 29 const bool system_level = true; |
30 base::CommandLine cmd_line = base::CommandLine::FromString( | 30 base::CommandLine cmd_line = base::CommandLine::FromString( |
31 std::wstring(L"setup.exe") + | 31 std::wstring(L"setup.exe") + |
32 (multi_install ? L" --multi-install --chrome" : L"") + | 32 (multi_install ? L" --multi-install --chrome" : L"") + |
33 (system_level ? L" --system-level" : L"")); | 33 (system_level ? L" --system-level" : L"")); |
34 installer::MasterPreferences prefs(cmd_line); | 34 installer::MasterPreferences prefs(cmd_line); |
35 installer::InstallationState machine_state; | 35 installer::InstallationState machine_state; |
36 machine_state.Initialize(); | 36 machine_state.Initialize(); |
37 | 37 |
38 std::unique_ptr<Product> product = base::MakeUnique<Product>( | 38 std::unique_ptr<Product> product = |
39 BrowserDistribution::GetSpecificDistribution( | 39 base::MakeUnique<Product>(BrowserDistribution::GetDistribution()); |
40 BrowserDistribution::CHROME_BROWSER)); | |
41 product->InitializeFromPreferences(prefs); | 40 product->InitializeFromPreferences(prefs); |
42 BrowserDistribution* distribution = product->distribution(); | 41 BrowserDistribution* distribution = product->distribution(); |
43 EXPECT_EQ(BrowserDistribution::CHROME_BROWSER, distribution->GetType()); | |
44 | 42 |
45 base::FilePath user_data_dir; | 43 base::FilePath user_data_dir; |
46 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); | 44 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); |
47 EXPECT_FALSE(user_data_dir.empty()); | 45 EXPECT_FALSE(user_data_dir.empty()); |
48 | 46 |
49 base::FilePath program_files; | 47 base::FilePath program_files; |
50 ASSERT_TRUE(PathService::Get(base::DIR_PROGRAM_FILES, &program_files)); | 48 ASSERT_TRUE(PathService::Get(base::DIR_PROGRAM_FILES, &program_files)); |
51 // The User Data path should never be under program files, even though | 49 // The User Data path should never be under program files, even though |
52 // system_level is true. | 50 // system_level is true. |
53 EXPECT_EQ(std::wstring::npos, | 51 EXPECT_EQ(std::wstring::npos, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 if (chrome_state) | 95 if (chrome_state) |
98 EXPECT_TRUE(chrome_state->is_msi()); | 96 EXPECT_TRUE(chrome_state->is_msi()); |
99 } | 97 } |
100 } | 98 } |
101 | 99 |
102 TEST(ProductTest, LaunchChrome) { | 100 TEST(ProductTest, LaunchChrome) { |
103 // TODO(tommi): Test Product::LaunchChrome and | 101 // TODO(tommi): Test Product::LaunchChrome and |
104 // Product::LaunchChromeAndWait. | 102 // Product::LaunchChromeAndWait. |
105 NOTIMPLEMENTED(); | 103 NOTIMPLEMENTED(); |
106 } | 104 } |
OLD | NEW |