OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/json/json_value_serializer.h" | 8 #include "base/json/json_value_serializer.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::master_preferences::kSystemLevel, &value)); |
301 EXPECT_FALSE(prefs2.GetBool( | 301 EXPECT_FALSE(prefs2.GetBool( |
302 installer::master_preferences::kVerboseLogging, &value)); | 302 installer::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; |
307 chrome_cmd << "setup.exe"; | 307 chrome_cmd << "setup.exe"; |
308 cf_cmd << "setup.exe --" << installer::switches::kChromeFrame; | 308 cf_cmd << "setup.exe --" << installer::switches::kChromeFrame; |
309 ceee_cmd << "setup.exe --" << installer::switches::kCeee; | |
310 | 309 |
311 CommandLine chrome_install(CommandLine::FromString(chrome_cmd.str())); | 310 CommandLine chrome_install(CommandLine::FromString(chrome_cmd.str())); |
312 CommandLine cf_install(CommandLine::FromString(cf_cmd.str())); | 311 CommandLine cf_install(CommandLine::FromString(cf_cmd.str())); |
313 CommandLine ceee_install(CommandLine::FromString(ceee_cmd.str())); | |
314 | 312 |
315 installer::MasterPreferences pref_chrome(chrome_install); | 313 installer::MasterPreferences pref_chrome(chrome_install); |
316 installer::MasterPreferences pref_cf(cf_install); | 314 installer::MasterPreferences pref_cf(cf_install); |
317 installer::MasterPreferences pref_ceee(ceee_install); | |
318 | 315 |
319 EXPECT_FALSE(pref_chrome.is_multi_install()); | 316 EXPECT_FALSE(pref_chrome.is_multi_install()); |
320 EXPECT_TRUE(pref_chrome.install_chrome()); | 317 EXPECT_TRUE(pref_chrome.install_chrome()); |
321 EXPECT_FALSE(pref_chrome.install_ceee()); | |
322 EXPECT_FALSE(pref_chrome.install_chrome_frame()); | 318 EXPECT_FALSE(pref_chrome.install_chrome_frame()); |
323 | 319 |
324 EXPECT_FALSE(pref_cf.is_multi_install()); | 320 EXPECT_FALSE(pref_cf.is_multi_install()); |
325 EXPECT_FALSE(pref_cf.install_chrome()); | 321 EXPECT_FALSE(pref_cf.install_chrome()); |
326 EXPECT_FALSE(pref_cf.install_ceee()); | |
327 EXPECT_TRUE(pref_cf.install_chrome_frame()); | 322 EXPECT_TRUE(pref_cf.install_chrome_frame()); |
328 | |
329 EXPECT_FALSE(pref_ceee.is_multi_install()); | |
330 EXPECT_FALSE(pref_ceee.install_chrome()); | |
331 EXPECT_TRUE(pref_ceee.install_ceee()); | |
332 EXPECT_TRUE(pref_ceee.install_chrome_frame()); | |
333 } | 323 } |
334 | 324 |
335 TEST_F(MasterPreferencesTest, TestMultiInstallConfig) { | 325 TEST_F(MasterPreferencesTest, TestMultiInstallConfig) { |
336 using installer::switches::kMultiInstall; | 326 using installer::switches::kMultiInstall; |
337 using installer::switches::kChrome; | 327 using installer::switches::kChrome; |
338 using installer::switches::kChromeFrame; | 328 using installer::switches::kChromeFrame; |
339 using installer::switches::kCeee; | |
340 | 329 |
341 std::wstringstream chrome_cmd, cf_cmd, ceee_cmd, chrome_cf_cmd, | 330 std::wstringstream chrome_cmd, cf_cmd, chrome_cf_cmd; |
342 chrome_ceee_cf_cmd; | |
343 chrome_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome; | 331 chrome_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome; |
344 cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChromeFrame; | 332 cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChromeFrame; |
345 ceee_cmd << "setup.exe --" << kMultiInstall << " --" << kCeee; | |
346 chrome_cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome << | 333 chrome_cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome << |
347 " --" << kChromeFrame; | 334 " --" << kChromeFrame; |
348 chrome_ceee_cf_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome << | |
349 " --" << kChromeFrame << " --" << kCeee; | |
350 | 335 |
351 CommandLine chrome_install(CommandLine::FromString(chrome_cmd.str())); | 336 CommandLine chrome_install(CommandLine::FromString(chrome_cmd.str())); |
352 CommandLine cf_install(CommandLine::FromString(cf_cmd.str())); | 337 CommandLine cf_install(CommandLine::FromString(cf_cmd.str())); |
353 CommandLine ceee_install(CommandLine::FromString(ceee_cmd.str())); | |
354 CommandLine chrome_cf_install(CommandLine::FromString(chrome_cf_cmd.str())); | 338 CommandLine chrome_cf_install(CommandLine::FromString(chrome_cf_cmd.str())); |
355 CommandLine chrome_cf_ceee_install( | |
356 CommandLine::FromString(chrome_ceee_cf_cmd.str())); | |
357 | 339 |
358 installer::MasterPreferences pref_chrome(chrome_install); | 340 installer::MasterPreferences pref_chrome(chrome_install); |
359 installer::MasterPreferences pref_cf(cf_install); | 341 installer::MasterPreferences pref_cf(cf_install); |
360 installer::MasterPreferences pref_ceee(ceee_install); | |
361 installer::MasterPreferences pref_chrome_cf(chrome_cf_install); | 342 installer::MasterPreferences pref_chrome_cf(chrome_cf_install); |
362 installer::MasterPreferences pref_all(chrome_cf_ceee_install); | |
363 | 343 |
364 EXPECT_TRUE(pref_chrome.is_multi_install()); | 344 EXPECT_TRUE(pref_chrome.is_multi_install()); |
365 EXPECT_TRUE(pref_chrome.install_chrome()); | 345 EXPECT_TRUE(pref_chrome.install_chrome()); |
366 EXPECT_FALSE(pref_chrome.install_ceee()); | |
367 EXPECT_FALSE(pref_chrome.install_chrome_frame()); | 346 EXPECT_FALSE(pref_chrome.install_chrome_frame()); |
368 | 347 |
369 EXPECT_TRUE(pref_cf.is_multi_install()); | 348 EXPECT_TRUE(pref_cf.is_multi_install()); |
370 EXPECT_FALSE(pref_cf.install_chrome()); | 349 EXPECT_FALSE(pref_cf.install_chrome()); |
371 EXPECT_FALSE(pref_cf.install_ceee()); | |
372 EXPECT_TRUE(pref_cf.install_chrome_frame()); | 350 EXPECT_TRUE(pref_cf.install_chrome_frame()); |
373 | 351 |
374 EXPECT_TRUE(pref_ceee.is_multi_install()); | |
375 EXPECT_FALSE(pref_ceee.install_chrome()); | |
376 EXPECT_TRUE(pref_ceee.install_ceee()); | |
377 EXPECT_TRUE(pref_ceee.install_chrome_frame()); | |
378 | |
379 EXPECT_TRUE(pref_chrome_cf.is_multi_install()); | 352 EXPECT_TRUE(pref_chrome_cf.is_multi_install()); |
380 EXPECT_TRUE(pref_chrome_cf.install_chrome()); | 353 EXPECT_TRUE(pref_chrome_cf.install_chrome()); |
381 EXPECT_FALSE(pref_chrome_cf.install_ceee()); | |
382 EXPECT_TRUE(pref_chrome_cf.install_chrome_frame()); | 354 EXPECT_TRUE(pref_chrome_cf.install_chrome_frame()); |
383 | |
384 EXPECT_TRUE(pref_all.is_multi_install()); | |
385 EXPECT_TRUE(pref_all.install_chrome()); | |
386 EXPECT_TRUE(pref_all.install_ceee()); | |
387 EXPECT_TRUE(pref_all.install_chrome_frame()); | |
388 } | 355 } |
389 | 356 |
OLD | NEW |