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_unittest.h" | 5 #include "chrome/installer/util/product_unittest.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/test/test_reg_util_win.h" | 9 #include "base/test/test_reg_util_win.h" |
10 #include "chrome/common/chrome_constants.h" | |
11 #include "chrome/installer/util/chrome_frame_distribution.h" | 10 #include "chrome/installer/util/chrome_frame_distribution.h" |
12 #include "chrome/installer/util/google_update_constants.h" | 11 #include "chrome/installer/util/google_update_constants.h" |
13 #include "chrome/installer/util/installation_state.h" | 12 #include "chrome/installer/util/installation_state.h" |
14 #include "chrome/installer/util/installer_state.h" | 13 #include "chrome/installer/util/installer_state.h" |
15 #include "chrome/installer/util/master_preferences.h" | 14 #include "chrome/installer/util/master_preferences.h" |
16 #include "chrome/installer/util/product.h" | 15 #include "chrome/installer/util/product.h" |
17 | 16 |
18 using base::win::RegKey; | 17 using base::win::RegKey; |
19 using installer::Product; | 18 using installer::Product; |
20 using installer::MasterPreferences; | 19 using installer::MasterPreferences; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 installer::MasterPreferences prefs(cmd_line); | 63 installer::MasterPreferences prefs(cmd_line); |
65 installer::InstallationState machine_state; | 64 installer::InstallationState machine_state; |
66 machine_state.Initialize(); | 65 machine_state.Initialize(); |
67 installer::InstallerState installer_state; | 66 installer::InstallerState installer_state; |
68 installer_state.Initialize(cmd_line, prefs, machine_state); | 67 installer_state.Initialize(cmd_line, prefs, machine_state); |
69 | 68 |
70 const Product* product = installer_state.products()[0]; | 69 const Product* product = installer_state.products()[0]; |
71 BrowserDistribution* distribution = product->distribution(); | 70 BrowserDistribution* distribution = product->distribution(); |
72 EXPECT_EQ(BrowserDistribution::CHROME_BROWSER, distribution->GetType()); | 71 EXPECT_EQ(BrowserDistribution::CHROME_BROWSER, distribution->GetType()); |
73 | 72 |
74 std::vector<base::FilePath> user_data_paths; | 73 base::FilePath user_data(product->GetUserDataPath()); |
75 product->GetUserDataPaths(&user_data_paths); | 74 EXPECT_FALSE(user_data.empty()); |
76 EXPECT_GE(user_data_paths.size(), static_cast<size_t>(1)); | |
77 const base::FilePath& user_data = user_data_paths[0]; | |
78 EXPECT_FALSE(user_data_paths[0].empty()); | |
79 EXPECT_NE(std::wstring::npos, | 75 EXPECT_NE(std::wstring::npos, |
80 user_data_paths[0].value().find(installer::kInstallUserDataDir)); | 76 user_data.value().find(installer::kInstallUserDataDir)); |
81 if (user_data_paths.size() > 1) { | |
82 EXPECT_FALSE(user_data_paths[1].empty()); | |
83 EXPECT_NE( | |
84 std::wstring::npos, | |
85 user_data_paths[1].value().find(chrome::kMetroChromeUserDataSubDir)); | |
86 } | |
87 | 77 |
88 base::FilePath program_files; | 78 base::FilePath program_files; |
89 PathService::Get(base::DIR_PROGRAM_FILES, &program_files); | 79 PathService::Get(base::DIR_PROGRAM_FILES, &program_files); |
90 // The User Data path should never be under program files, even though | 80 // The User Data path should never be under program files, even though |
91 // system_level is true. | 81 // system_level is true. |
92 EXPECT_EQ(std::wstring::npos, | 82 EXPECT_EQ(std::wstring::npos, |
93 user_data.value().find(program_files.value())); | 83 user_data.value().find(program_files.value())); |
94 | 84 |
95 // There should be no installed version in the registry. | 85 // There should be no installed version in the registry. |
96 machine_state.Initialize(); | 86 machine_state.Initialize(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 if (chrome_state != NULL) | 128 if (chrome_state != NULL) |
139 EXPECT_TRUE(chrome_state->is_msi()); | 129 EXPECT_TRUE(chrome_state->is_msi()); |
140 } | 130 } |
141 } | 131 } |
142 | 132 |
143 TEST_F(ProductTest, LaunchChrome) { | 133 TEST_F(ProductTest, LaunchChrome) { |
144 // TODO(tommi): Test Product::LaunchChrome and | 134 // TODO(tommi): Test Product::LaunchChrome and |
145 // Product::LaunchChromeAndWait. | 135 // Product::LaunchChromeAndWait. |
146 LOG(ERROR) << "Test not implemented."; | 136 LOG(ERROR) << "Test not implemented."; |
147 } | 137 } |
OLD | NEW |