| OLD | NEW |
| 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 // Unit tests for master preferences related methods. | 5 // Unit tests for master preferences related methods. |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 " \"chrome_shortcut_icon_index\": 1,\n" | 64 " \"chrome_shortcut_icon_index\": 1,\n" |
| 65 " \"ping_delay\": 40,\n" | 65 " \"ping_delay\": 40,\n" |
| 66 " \"search_engine_experiment\": true\n" | 66 " \"search_engine_experiment\": true\n" |
| 67 " },\n" | 67 " },\n" |
| 68 " \"blah\": {\n" | 68 " \"blah\": {\n" |
| 69 " \"import_history\": false\n" | 69 " \"import_history\": false\n" |
| 70 " }\n" | 70 " }\n" |
| 71 "} \n"; | 71 "} \n"; |
| 72 | 72 |
| 73 EXPECT_TRUE(file_util::WriteFile(prefs_file(), text, sizeof(text))); | 73 EXPECT_TRUE(file_util::WriteFile(prefs_file(), text, sizeof(text))); |
| 74 installer::MasterPreferences prefs(prefs_file()); | 74 installer_util::MasterPreferences prefs(prefs_file()); |
| 75 | 75 |
| 76 const char* expected_true[] = { | 76 const char* expected_true[] = { |
| 77 installer::master_preferences::kDistroSkipFirstRunPref, | 77 installer_util::master_preferences::kDistroSkipFirstRunPref, |
| 78 installer::master_preferences::kDistroShowWelcomePage, | 78 installer_util::master_preferences::kDistroShowWelcomePage, |
| 79 installer::master_preferences::kDistroImportSearchPref, | 79 installer_util::master_preferences::kDistroImportSearchPref, |
| 80 installer::master_preferences::kDistroImportHistoryPref, | 80 installer_util::master_preferences::kDistroImportHistoryPref, |
| 81 installer::master_preferences::kDistroImportBookmarksPref, | 81 installer_util::master_preferences::kDistroImportBookmarksPref, |
| 82 installer::master_preferences::kDistroImportHomePagePref, | 82 installer_util::master_preferences::kDistroImportHomePagePref, |
| 83 installer::master_preferences::kCreateAllShortcuts, | 83 installer_util::master_preferences::kCreateAllShortcuts, |
| 84 installer::master_preferences::kDoNotLaunchChrome, | 84 installer_util::master_preferences::kDoNotLaunchChrome, |
| 85 installer::master_preferences::kMakeChromeDefault, | 85 installer_util::master_preferences::kMakeChromeDefault, |
| 86 installer::master_preferences::kMakeChromeDefaultForUser, | 86 installer_util::master_preferences::kMakeChromeDefaultForUser, |
| 87 installer::master_preferences::kSystemLevel, | 87 installer_util::master_preferences::kSystemLevel, |
| 88 installer::master_preferences::kVerboseLogging, | 88 installer_util::master_preferences::kVerboseLogging, |
| 89 installer::master_preferences::kRequireEula, | 89 installer_util::master_preferences::kRequireEula, |
| 90 installer::master_preferences::kAltShortcutText, | 90 installer_util::master_preferences::kAltShortcutText, |
| 91 installer::master_preferences::kAltFirstRunBubble, | 91 installer_util::master_preferences::kAltFirstRunBubble, |
| 92 installer::master_preferences::kSearchEngineExperimentPref, | 92 installer_util::master_preferences::kSearchEngineExperimentPref, |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 for (int i = 0; i < arraysize(expected_true); ++i) { | 95 for (int i = 0; i < arraysize(expected_true); ++i) { |
| 96 bool value = false; | 96 bool value = false; |
| 97 EXPECT_TRUE(prefs.GetBool(expected_true[i], &value)); | 97 EXPECT_TRUE(prefs.GetBool(expected_true[i], &value)); |
| 98 EXPECT_TRUE(value) << expected_true[i]; | 98 EXPECT_TRUE(value) << expected_true[i]; |
| 99 } | 99 } |
| 100 | 100 |
| 101 std::string str_value; | 101 std::string str_value; |
| 102 EXPECT_TRUE(prefs.GetString( | 102 EXPECT_TRUE(prefs.GetString( |
| 103 installer::master_preferences::kDistroImportBookmarksFromFilePref, | 103 installer_util::master_preferences::kDistroImportBookmarksFromFilePref, |
| 104 &str_value)); | 104 &str_value)); |
| 105 EXPECT_STREQ("c:\\foo", str_value.c_str()); | 105 EXPECT_STREQ("c:\\foo", str_value.c_str()); |
| 106 | 106 |
| 107 int icon_index = 0; | 107 int icon_index = 0; |
| 108 EXPECT_TRUE(prefs.GetInt( | 108 EXPECT_TRUE(prefs.GetInt( |
| 109 installer::master_preferences::kChromeShortcutIconIndex, | 109 installer_util::master_preferences::kChromeShortcutIconIndex, |
| 110 &icon_index)); | 110 &icon_index)); |
| 111 EXPECT_EQ(icon_index, 1); | 111 EXPECT_EQ(icon_index, 1); |
| 112 int ping_delay = 90; | 112 int ping_delay = 90; |
| 113 EXPECT_TRUE(prefs.GetInt(installer::master_preferences::kDistroPingDelay, | 113 EXPECT_TRUE(prefs.GetInt(installer_util::master_preferences::kDistroPingDelay, |
| 114 &ping_delay)); | 114 &ping_delay)); |
| 115 EXPECT_EQ(ping_delay, 40); | 115 EXPECT_EQ(ping_delay, 40); |
| 116 } | 116 } |
| 117 | 117 |
| 118 TEST_F(MasterPreferencesTest, ParseMissingDistroParams) { | 118 TEST_F(MasterPreferencesTest, ParseMissingDistroParams) { |
| 119 const char text[] = | 119 const char text[] = |
| 120 "{ \n" | 120 "{ \n" |
| 121 " \"distribution\": { \n" | 121 " \"distribution\": { \n" |
| 122 " \"skip_first_run_ui\": true,\n" | 122 " \"skip_first_run_ui\": true,\n" |
| 123 " \"import_search_engine\": true,\n" | 123 " \"import_search_engine\": true,\n" |
| 124 " \"import_bookmarks\": false,\n" | 124 " \"import_bookmarks\": false,\n" |
| 125 " \"import_bookmarks_from_file\": \"\",\n" | 125 " \"import_bookmarks_from_file\": \"\",\n" |
| 126 " \"create_all_shortcuts\": true,\n" | 126 " \"create_all_shortcuts\": true,\n" |
| 127 " \"do_not_launch_chrome\": true,\n" | 127 " \"do_not_launch_chrome\": true,\n" |
| 128 " \"chrome_shortcut_icon_index\": \"bac\"\n" | 128 " \"chrome_shortcut_icon_index\": \"bac\"\n" |
| 129 " }\n" | 129 " }\n" |
| 130 "} \n"; | 130 "} \n"; |
| 131 | 131 |
| 132 EXPECT_TRUE(file_util::WriteFile(prefs_file(), text, sizeof(text))); | 132 EXPECT_TRUE(file_util::WriteFile(prefs_file(), text, sizeof(text))); |
| 133 installer::MasterPreferences prefs(prefs_file()); | 133 installer_util::MasterPreferences prefs(prefs_file()); |
| 134 | 134 |
| 135 ExpectedBooleans expected_bool[] = { | 135 ExpectedBooleans expected_bool[] = { |
| 136 { installer::master_preferences::kDistroSkipFirstRunPref, true }, | 136 { installer_util::master_preferences::kDistroSkipFirstRunPref, true }, |
| 137 { installer::master_preferences::kDistroImportSearchPref, true }, | 137 { installer_util::master_preferences::kDistroImportSearchPref, true }, |
| 138 { installer::master_preferences::kDistroImportBookmarksPref, false }, | 138 { installer_util::master_preferences::kDistroImportBookmarksPref, false }, |
| 139 { installer::master_preferences::kCreateAllShortcuts, true }, | 139 { installer_util::master_preferences::kCreateAllShortcuts, true }, |
| 140 { installer::master_preferences::kDoNotLaunchChrome, true }, | 140 { installer_util::master_preferences::kDoNotLaunchChrome, true }, |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 bool value = false; | 143 bool value = false; |
| 144 for (int i = 0; i < arraysize(expected_bool); ++i) { | 144 for (int i = 0; i < arraysize(expected_bool); ++i) { |
| 145 EXPECT_TRUE(prefs.GetBool(expected_bool[i].name, &value)); | 145 EXPECT_TRUE(prefs.GetBool(expected_bool[i].name, &value)); |
| 146 EXPECT_EQ(value, expected_bool[i].expected_value) << expected_bool[i].name; | 146 EXPECT_EQ(value, expected_bool[i].expected_value) << expected_bool[i].name; |
| 147 } | 147 } |
| 148 | 148 |
| 149 const char* missing_bools[] = { | 149 const char* missing_bools[] = { |
| 150 installer::master_preferences::kDistroShowWelcomePage, | 150 installer_util::master_preferences::kDistroShowWelcomePage, |
| 151 installer::master_preferences::kDistroImportHistoryPref, | 151 installer_util::master_preferences::kDistroImportHistoryPref, |
| 152 installer::master_preferences::kDistroImportHomePagePref, | 152 installer_util::master_preferences::kDistroImportHomePagePref, |
| 153 installer::master_preferences::kDoNotRegisterForUpdateLaunch, | 153 installer_util::master_preferences::kDoNotRegisterForUpdateLaunch, |
| 154 installer::master_preferences::kMakeChromeDefault, | 154 installer_util::master_preferences::kMakeChromeDefault, |
| 155 installer::master_preferences::kMakeChromeDefaultForUser, | 155 installer_util::master_preferences::kMakeChromeDefaultForUser, |
| 156 }; | 156 }; |
| 157 | 157 |
| 158 for (int i = 0; i < arraysize(missing_bools); ++i) { | 158 for (int i = 0; i < arraysize(missing_bools); ++i) { |
| 159 EXPECT_FALSE(prefs.GetBool(missing_bools[i], &value)) << missing_bools[i]; | 159 EXPECT_FALSE(prefs.GetBool(missing_bools[i], &value)) << missing_bools[i]; |
| 160 } | 160 } |
| 161 | 161 |
| 162 std::string str_value; | 162 std::string str_value; |
| 163 EXPECT_FALSE(prefs.GetString( | 163 EXPECT_FALSE(prefs.GetString( |
| 164 installer::master_preferences::kDistroImportBookmarksFromFilePref, | 164 installer_util::master_preferences::kDistroImportBookmarksFromFilePref, |
| 165 &str_value)); | 165 &str_value)); |
| 166 | 166 |
| 167 int icon_index = 0; | 167 int icon_index = 0; |
| 168 EXPECT_FALSE(prefs.GetInt( | 168 EXPECT_FALSE(prefs.GetInt( |
| 169 installer::master_preferences::kChromeShortcutIconIndex, | 169 installer_util::master_preferences::kChromeShortcutIconIndex, |
| 170 &icon_index)); | 170 &icon_index)); |
| 171 EXPECT_EQ(icon_index, 0); | 171 EXPECT_EQ(icon_index, 0); |
| 172 | 172 |
| 173 int ping_delay = 90; | 173 int ping_delay = 90; |
| 174 EXPECT_FALSE(prefs.GetInt( | 174 EXPECT_FALSE(prefs.GetInt( |
| 175 installer::master_preferences::kDistroPingDelay, &ping_delay)); | 175 installer_util::master_preferences::kDistroPingDelay, &ping_delay)); |
| 176 EXPECT_EQ(ping_delay, 90); | 176 EXPECT_EQ(ping_delay, 90); |
| 177 } | 177 } |
| 178 | 178 |
| 179 TEST_F(MasterPreferencesTest, FirstRunTabs) { | 179 TEST_F(MasterPreferencesTest, FirstRunTabs) { |
| 180 const char text[] = | 180 const char text[] = |
| 181 "{ \n" | 181 "{ \n" |
| 182 " \"distribution\": { \n" | 182 " \"distribution\": { \n" |
| 183 " \"something here\": true\n" | 183 " \"something here\": true\n" |
| 184 " },\n" | 184 " },\n" |
| 185 " \"first_run_tabs\": [\n" | 185 " \"first_run_tabs\": [\n" |
| 186 " \"http://google.com/f1\",\n" | 186 " \"http://google.com/f1\",\n" |
| 187 " \"https://google.com/f2\",\n" | 187 " \"https://google.com/f2\",\n" |
| 188 " \"new_tab_page\"\n" | 188 " \"new_tab_page\"\n" |
| 189 " ]\n" | 189 " ]\n" |
| 190 "} \n"; | 190 "} \n"; |
| 191 | 191 |
| 192 EXPECT_TRUE(file_util::WriteFile(prefs_file(), text, sizeof(text))); | 192 EXPECT_TRUE(file_util::WriteFile(prefs_file(), text, sizeof(text))); |
| 193 installer::MasterPreferences prefs(prefs_file()); | 193 installer_util::MasterPreferences prefs(prefs_file()); |
| 194 typedef std::vector<GURL> TabsVector; | 194 typedef std::vector<GURL> TabsVector; |
| 195 TabsVector tabs = prefs.GetFirstRunTabs(); | 195 TabsVector tabs = prefs.GetFirstRunTabs(); |
| 196 ASSERT_EQ(3, tabs.size()); | 196 ASSERT_EQ(3, tabs.size()); |
| 197 EXPECT_EQ(GURL("http://google.com/f1"), tabs[0]); | 197 EXPECT_EQ(GURL("http://google.com/f1"), tabs[0]); |
| 198 EXPECT_EQ(GURL("https://google.com/f2"), tabs[1]); | 198 EXPECT_EQ(GURL("https://google.com/f2"), tabs[1]); |
| 199 EXPECT_EQ(GURL("new_tab_page"), tabs[2]); | 199 EXPECT_EQ(GURL("new_tab_page"), tabs[2]); |
| 200 } | 200 } |
| 201 | 201 |
| 202 // In this test instead of using our synthetic json file, we use an | 202 // In this test instead of using our synthetic json file, we use an |
| 203 // actual test case from the extensions unittest. The hope here is that if | 203 // actual test case from the extensions unittest. The hope here is that if |
| 204 // they change something in the manifest this test will break, but in | 204 // they change something in the manifest this test will break, but in |
| 205 // general it is expected the extension format to be backwards compatible. | 205 // general it is expected the extension format to be backwards compatible. |
| 206 TEST(MasterPrefsExtension, ValidateExtensionJSON) { | 206 TEST(MasterPrefsExtension, ValidateExtensionJSON) { |
| 207 FilePath prefs_path; | 207 FilePath prefs_path; |
| 208 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &prefs_path)); | 208 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &prefs_path)); |
| 209 prefs_path = prefs_path.AppendASCII("extensions") | 209 prefs_path = prefs_path.AppendASCII("extensions") |
| 210 .AppendASCII("good").AppendASCII("Preferences"); | 210 .AppendASCII("good").AppendASCII("Preferences"); |
| 211 | 211 |
| 212 installer::MasterPreferences prefs(prefs_path); | 212 installer_util::MasterPreferences prefs(prefs_path); |
| 213 DictionaryValue* extensions = NULL; | 213 DictionaryValue* extensions = NULL; |
| 214 EXPECT_TRUE(prefs.GetExtensionsBlock(&extensions)); | 214 EXPECT_TRUE(prefs.GetExtensionsBlock(&extensions)); |
| 215 int location = 0; | 215 int location = 0; |
| 216 EXPECT_TRUE(extensions->GetInteger( | 216 EXPECT_TRUE(extensions->GetInteger( |
| 217 "behllobkkfkfnphdnhnkndlbkcpglgmj.location", &location)); | 217 "behllobkkfkfnphdnhnkndlbkcpglgmj.location", &location)); |
| 218 int state = 0; | 218 int state = 0; |
| 219 EXPECT_TRUE(extensions->GetInteger( | 219 EXPECT_TRUE(extensions->GetInteger( |
| 220 "behllobkkfkfnphdnhnkndlbkcpglgmj.state", &state)); | 220 "behllobkkfkfnphdnhnkndlbkcpglgmj.state", &state)); |
| 221 std::string path; | 221 std::string path; |
| 222 EXPECT_TRUE(extensions->GetString( | 222 EXPECT_TRUE(extensions->GetString( |
| (...skipping 26 matching lines...) Expand all Loading... |
| 249 "} \n"; | 249 "} \n"; |
| 250 EXPECT_TRUE(file_util::WriteFile(prefs_file, text, sizeof(text))); | 250 EXPECT_TRUE(file_util::WriteFile(prefs_file, text, sizeof(text))); |
| 251 | 251 |
| 252 // Make sure command line values override the values in master preferences. | 252 // Make sure command line values override the values in master preferences. |
| 253 std::wstring cmd_str( | 253 std::wstring cmd_str( |
| 254 L"setup.exe --installerdata=\"" + prefs_file.value() + L"\""); | 254 L"setup.exe --installerdata=\"" + prefs_file.value() + L"\""); |
| 255 cmd_str.append(L" --create-all-shortcuts"); | 255 cmd_str.append(L" --create-all-shortcuts"); |
| 256 cmd_str.append(L" --do-not-launch-chrome"); | 256 cmd_str.append(L" --do-not-launch-chrome"); |
| 257 cmd_str.append(L" --alt-desktop-shortcut"); | 257 cmd_str.append(L" --alt-desktop-shortcut"); |
| 258 CommandLine cmd_line = CommandLine::FromString(cmd_str); | 258 CommandLine cmd_line = CommandLine::FromString(cmd_str); |
| 259 installer::MasterPreferences prefs(cmd_line); | 259 installer_util::MasterPreferences prefs(cmd_line); |
| 260 | 260 |
| 261 // Check prefs that do not have any equivalent command line option. | 261 // Check prefs that do not have any equivalent command line option. |
| 262 ExpectedBooleans expected_bool[] = { | 262 ExpectedBooleans expected_bool[] = { |
| 263 { installer::master_preferences::kDistroSkipFirstRunPref, true }, | 263 { installer_util::master_preferences::kDistroSkipFirstRunPref, true }, |
| 264 { installer::master_preferences::kCreateAllShortcuts, true }, | 264 { installer_util::master_preferences::kCreateAllShortcuts, true }, |
| 265 { installer::master_preferences::kDoNotLaunchChrome, true }, | 265 { installer_util::master_preferences::kDoNotLaunchChrome, true }, |
| 266 { installer::master_preferences::kAltShortcutText, true }, | 266 { installer_util::master_preferences::kAltShortcutText, true }, |
| 267 { installer::master_preferences::kSystemLevel, true }, | 267 { installer_util::master_preferences::kSystemLevel, true }, |
| 268 { installer::master_preferences::kVerboseLogging, false }, | 268 { installer_util::master_preferences::kVerboseLogging, false }, |
| 269 }; | 269 }; |
| 270 | 270 |
| 271 // Now check that prefs got merged correctly. | 271 // Now check that prefs got merged correctly. |
| 272 bool value = false; | 272 bool value = false; |
| 273 for (int i = 0; i < arraysize(expected_bool); ++i) { | 273 for (int i = 0; i < arraysize(expected_bool); ++i) { |
| 274 EXPECT_TRUE(prefs.GetBool(expected_bool[i].name, &value)); | 274 EXPECT_TRUE(prefs.GetBool(expected_bool[i].name, &value)); |
| 275 EXPECT_EQ(value, expected_bool[i].expected_value) << expected_bool[i].name; | 275 EXPECT_EQ(value, expected_bool[i].expected_value) << expected_bool[i].name; |
| 276 } | 276 } |
| 277 | 277 |
| 278 // Delete temporary prefs file. | 278 // Delete temporary prefs file. |
| 279 EXPECT_TRUE(file_util::Delete(prefs_file, false)); | 279 EXPECT_TRUE(file_util::Delete(prefs_file, false)); |
| 280 | 280 |
| 281 // Check that if master prefs doesn't exist, we can still parse the common | 281 // Check that if master prefs doesn't exist, we can still parse the common |
| 282 // prefs. | 282 // prefs. |
| 283 cmd_str = L"setup.exe --create-all-shortcuts --do-not-launch-chrome" | 283 cmd_str = L"setup.exe --create-all-shortcuts --do-not-launch-chrome" |
| 284 L" --alt-desktop-shortcut"; | 284 L" --alt-desktop-shortcut"; |
| 285 cmd_line.ParseFromString(cmd_str); | 285 cmd_line.ParseFromString(cmd_str); |
| 286 installer::MasterPreferences prefs2(cmd_line); | 286 installer_util::MasterPreferences prefs2(cmd_line); |
| 287 ExpectedBooleans expected_bool2[] = { | 287 ExpectedBooleans expected_bool2[] = { |
| 288 { installer::master_preferences::kCreateAllShortcuts, true }, | 288 { installer_util::master_preferences::kCreateAllShortcuts, true }, |
| 289 { installer::master_preferences::kDoNotLaunchChrome, true }, | 289 { installer_util::master_preferences::kDoNotLaunchChrome, true }, |
| 290 { installer::master_preferences::kAltShortcutText, true }, | 290 { installer_util::master_preferences::kAltShortcutText, true }, |
| 291 }; | 291 }; |
| 292 | 292 |
| 293 for (int i = 0; i < arraysize(expected_bool2); ++i) { | 293 for (int i = 0; i < arraysize(expected_bool2); ++i) { |
| 294 EXPECT_TRUE(prefs2.GetBool(expected_bool2[i].name, &value)); | 294 EXPECT_TRUE(prefs2.GetBool(expected_bool2[i].name, &value)); |
| 295 EXPECT_EQ(value, expected_bool2[i].expected_value) | 295 EXPECT_EQ(value, expected_bool2[i].expected_value) |
| 296 << expected_bool2[i].name; | 296 << expected_bool2[i].name; |
| 297 } | 297 } |
| 298 | 298 |
| 299 EXPECT_FALSE(prefs2.GetBool( | 299 EXPECT_FALSE(prefs2.GetBool( |
| 300 installer::master_preferences::kSystemLevel, &value)); | 300 installer_util::master_preferences::kSystemLevel, &value)); |
| 301 EXPECT_FALSE(prefs2.GetBool( | 301 EXPECT_FALSE(prefs2.GetBool( |
| 302 installer::master_preferences::kVerboseLogging, &value)); | 302 installer_util::master_preferences::kVerboseLogging, &value)); |
| 303 } | 303 } |
| 304 | 304 |
| 305 TEST_F(MasterPreferencesTest, TestDefaultInstallConfig) { | 305 TEST_F(MasterPreferencesTest, TestDefaultInstallConfig) { |
| 306 std::wstringstream chrome_cmd, cf_cmd, ceee_cmd; | 306 std::wstringstream chrome_cmd, cf_cmd, ceee_cmd; |
| 307 chrome_cmd << "setup.exe"; | 307 chrome_cmd << "setup.exe"; |
| 308 cf_cmd << "setup.exe --" << installer::switches::kChromeFrame; | 308 cf_cmd << "setup.exe --" << installer_util::switches::kChromeFrame; |
| 309 ceee_cmd << "setup.exe --" << installer::switches::kCeee; | 309 ceee_cmd << "setup.exe --" << installer_util::switches::kCeee; |
| 310 | 310 |
| 311 CommandLine chrome_install(CommandLine::FromString(chrome_cmd.str())); | 311 CommandLine chrome_install(CommandLine::FromString(chrome_cmd.str())); |
| 312 CommandLine cf_install(CommandLine::FromString(cf_cmd.str())); | 312 CommandLine cf_install(CommandLine::FromString(cf_cmd.str())); |
| 313 CommandLine ceee_install(CommandLine::FromString(ceee_cmd.str())); | 313 CommandLine ceee_install(CommandLine::FromString(ceee_cmd.str())); |
| 314 | 314 |
| 315 installer::MasterPreferences pref_chrome(chrome_install); | 315 installer_util::MasterPreferences pref_chrome(chrome_install); |
| 316 installer::MasterPreferences pref_cf(cf_install); | 316 installer_util::MasterPreferences pref_cf(cf_install); |
| 317 installer::MasterPreferences pref_ceee(ceee_install); | 317 installer_util::MasterPreferences pref_ceee(ceee_install); |
| 318 | 318 |
| 319 EXPECT_FALSE(pref_chrome.is_multi_install()); | 319 EXPECT_FALSE(pref_chrome.is_multi_install()); |
| 320 EXPECT_TRUE(pref_chrome.install_chrome()); | 320 EXPECT_TRUE(pref_chrome.install_chrome()); |
| 321 EXPECT_FALSE(pref_chrome.install_ceee()); | 321 EXPECT_FALSE(pref_chrome.install_ceee()); |
| 322 EXPECT_FALSE(pref_chrome.install_chrome_frame()); | 322 EXPECT_FALSE(pref_chrome.install_chrome_frame()); |
| 323 | 323 |
| 324 EXPECT_FALSE(pref_cf.is_multi_install()); | 324 EXPECT_FALSE(pref_cf.is_multi_install()); |
| 325 EXPECT_FALSE(pref_cf.install_chrome()); | 325 EXPECT_FALSE(pref_cf.install_chrome()); |
| 326 EXPECT_FALSE(pref_cf.install_ceee()); | 326 EXPECT_FALSE(pref_cf.install_ceee()); |
| 327 EXPECT_TRUE(pref_cf.install_chrome_frame()); | 327 EXPECT_TRUE(pref_cf.install_chrome_frame()); |
| 328 | 328 |
| 329 EXPECT_FALSE(pref_ceee.is_multi_install()); | 329 EXPECT_FALSE(pref_ceee.is_multi_install()); |
| 330 EXPECT_FALSE(pref_ceee.install_chrome()); | 330 EXPECT_FALSE(pref_ceee.install_chrome()); |
| 331 EXPECT_TRUE(pref_ceee.install_ceee()); | 331 EXPECT_TRUE(pref_ceee.install_ceee()); |
| 332 EXPECT_TRUE(pref_ceee.install_chrome_frame()); | 332 EXPECT_TRUE(pref_ceee.install_chrome_frame()); |
| 333 } | 333 } |
| 334 | 334 |
| 335 TEST_F(MasterPreferencesTest, TestMultiInstallConfig) { | 335 TEST_F(MasterPreferencesTest, TestMultiInstallConfig) { |
| 336 using installer::switches::kMultiInstall; | 336 using installer_util::switches::kMultiInstall; |
| 337 using installer::switches::kChrome; | 337 using installer_util::switches::kChrome; |
| 338 using installer::switches::kChromeFrame; | 338 using installer_util::switches::kChromeFrame; |
| 339 using installer::switches::kCeee; | 339 using installer_util::switches::kCeee; |
| 340 | 340 |
| 341 std::wstringstream chrome_cmd, cf_cmd, ceee_cmd, chrome_cf_cmd, | 341 std::wstringstream chrome_cmd, cf_cmd, ceee_cmd, chrome_cf_cmd, |
| 342 chrome_ceee_cf_cmd; | 342 chrome_ceee_cf_cmd; |
| 343 chrome_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome; | 343 chrome_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome; |
| 344 cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChromeFrame; | 344 cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChromeFrame; |
| 345 ceee_cmd << "setup.exe --" << kMultiInstall << " --" << kCeee; | 345 ceee_cmd << "setup.exe --" << kMultiInstall << " --" << kCeee; |
| 346 chrome_cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome << | 346 chrome_cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome << |
| 347 " --" << kChromeFrame; | 347 " --" << kChromeFrame; |
| 348 chrome_ceee_cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome << | 348 chrome_ceee_cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome << |
| 349 " --" << kChromeFrame << " --" << kCeee; | 349 " --" << kChromeFrame << " --" << kCeee; |
| 350 | 350 |
| 351 CommandLine chrome_install(CommandLine::FromString(chrome_cmd.str())); | 351 CommandLine chrome_install(CommandLine::FromString(chrome_cmd.str())); |
| 352 CommandLine cf_install(CommandLine::FromString(cf_cmd.str())); | 352 CommandLine cf_install(CommandLine::FromString(cf_cmd.str())); |
| 353 CommandLine ceee_install(CommandLine::FromString(ceee_cmd.str())); | 353 CommandLine ceee_install(CommandLine::FromString(ceee_cmd.str())); |
| 354 CommandLine chrome_cf_install(CommandLine::FromString(chrome_cf_cmd.str())); | 354 CommandLine chrome_cf_install(CommandLine::FromString(chrome_cf_cmd.str())); |
| 355 CommandLine chrome_cf_ceee_install( | 355 CommandLine chrome_cf_ceee_install( |
| 356 CommandLine::FromString(chrome_ceee_cf_cmd.str())); | 356 CommandLine::FromString(chrome_ceee_cf_cmd.str())); |
| 357 | 357 |
| 358 installer::MasterPreferences pref_chrome(chrome_install); | 358 installer_util::MasterPreferences pref_chrome(chrome_install); |
| 359 installer::MasterPreferences pref_cf(cf_install); | 359 installer_util::MasterPreferences pref_cf(cf_install); |
| 360 installer::MasterPreferences pref_ceee(ceee_install); | 360 installer_util::MasterPreferences pref_ceee(ceee_install); |
| 361 installer::MasterPreferences pref_chrome_cf(chrome_cf_install); | 361 installer_util::MasterPreferences pref_chrome_cf(chrome_cf_install); |
| 362 installer::MasterPreferences pref_all(chrome_cf_ceee_install); | 362 installer_util::MasterPreferences pref_all(chrome_cf_ceee_install); |
| 363 | 363 |
| 364 EXPECT_TRUE(pref_chrome.is_multi_install()); | 364 EXPECT_TRUE(pref_chrome.is_multi_install()); |
| 365 EXPECT_TRUE(pref_chrome.install_chrome()); | 365 EXPECT_TRUE(pref_chrome.install_chrome()); |
| 366 EXPECT_FALSE(pref_chrome.install_ceee()); | 366 EXPECT_FALSE(pref_chrome.install_ceee()); |
| 367 EXPECT_FALSE(pref_chrome.install_chrome_frame()); | 367 EXPECT_FALSE(pref_chrome.install_chrome_frame()); |
| 368 | 368 |
| 369 EXPECT_TRUE(pref_cf.is_multi_install()); | 369 EXPECT_TRUE(pref_cf.is_multi_install()); |
| 370 EXPECT_FALSE(pref_cf.install_chrome()); | 370 EXPECT_FALSE(pref_cf.install_chrome()); |
| 371 EXPECT_FALSE(pref_cf.install_ceee()); | 371 EXPECT_FALSE(pref_cf.install_ceee()); |
| 372 EXPECT_TRUE(pref_cf.install_chrome_frame()); | 372 EXPECT_TRUE(pref_cf.install_chrome_frame()); |
| 373 | 373 |
| 374 EXPECT_TRUE(pref_ceee.is_multi_install()); | 374 EXPECT_TRUE(pref_ceee.is_multi_install()); |
| 375 EXPECT_FALSE(pref_ceee.install_chrome()); | 375 EXPECT_FALSE(pref_ceee.install_chrome()); |
| 376 EXPECT_TRUE(pref_ceee.install_ceee()); | 376 EXPECT_TRUE(pref_ceee.install_ceee()); |
| 377 EXPECT_TRUE(pref_ceee.install_chrome_frame()); | 377 EXPECT_TRUE(pref_ceee.install_chrome_frame()); |
| 378 | 378 |
| 379 EXPECT_TRUE(pref_chrome_cf.is_multi_install()); | 379 EXPECT_TRUE(pref_chrome_cf.is_multi_install()); |
| 380 EXPECT_TRUE(pref_chrome_cf.install_chrome()); | 380 EXPECT_TRUE(pref_chrome_cf.install_chrome()); |
| 381 EXPECT_FALSE(pref_chrome_cf.install_ceee()); | 381 EXPECT_FALSE(pref_chrome_cf.install_ceee()); |
| 382 EXPECT_TRUE(pref_chrome_cf.install_chrome_frame()); | 382 EXPECT_TRUE(pref_chrome_cf.install_chrome_frame()); |
| 383 | 383 |
| 384 EXPECT_TRUE(pref_all.is_multi_install()); | 384 EXPECT_TRUE(pref_all.is_multi_install()); |
| 385 EXPECT_TRUE(pref_all.install_chrome()); | 385 EXPECT_TRUE(pref_all.install_chrome()); |
| 386 EXPECT_TRUE(pref_all.install_ceee()); | 386 EXPECT_TRUE(pref_all.install_ceee()); |
| 387 EXPECT_TRUE(pref_all.install_chrome_frame()); | 387 EXPECT_TRUE(pref_all.install_chrome_frame()); |
| 388 } | 388 } |
| 389 | 389 |
| OLD | NEW |