| 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 // Unit tests for master preferences related methods. | 5 // Unit tests for master preferences related methods. |
| 6 | 6 |
| 7 #include "chrome/installer/util/master_preferences.h" | 7 #include "chrome/installer/util/master_preferences.h" |
| 8 | 8 |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 | 319 |
| 320 base::CommandLine chrome_install( | 320 base::CommandLine chrome_install( |
| 321 base::CommandLine::FromString(chrome_cmd.str())); | 321 base::CommandLine::FromString(chrome_cmd.str())); |
| 322 | 322 |
| 323 installer::MasterPreferences pref_chrome(chrome_install); | 323 installer::MasterPreferences pref_chrome(chrome_install); |
| 324 | 324 |
| 325 EXPECT_FALSE(pref_chrome.is_multi_install()); | 325 EXPECT_FALSE(pref_chrome.is_multi_install()); |
| 326 EXPECT_TRUE(pref_chrome.install_chrome()); | 326 EXPECT_TRUE(pref_chrome.install_chrome()); |
| 327 } | 327 } |
| 328 | 328 |
| 329 TEST_F(MasterPreferencesTest, TestMultiInstallConfig) { | 329 TEST_F(MasterPreferencesTest, TestMultiInstallIgnoredConfig) { |
| 330 using installer::switches::kMultiInstall; | 330 using installer::switches::kMultiInstall; |
| 331 using installer::switches::kChrome; | 331 using installer::switches::kChrome; |
| 332 | 332 |
| 333 std::wstringstream chrome_cmd, cf_cmd, chrome_cf_cmd; | 333 std::wstringstream chrome_cmd, cf_cmd, chrome_cf_cmd; |
| 334 chrome_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome; | 334 chrome_cmd << "setup.exe --" << kMultiInstall << " --" << kChrome; |
| 335 | 335 |
| 336 base::CommandLine chrome_install( | 336 base::CommandLine chrome_install( |
| 337 base::CommandLine::FromString(chrome_cmd.str())); | 337 base::CommandLine::FromString(chrome_cmd.str())); |
| 338 | 338 |
| 339 installer::MasterPreferences pref_chrome(chrome_install); | 339 installer::MasterPreferences pref_chrome(chrome_install); |
| 340 | 340 |
| 341 EXPECT_TRUE(pref_chrome.is_multi_install()); | 341 EXPECT_FALSE(pref_chrome.is_multi_install()); |
| 342 EXPECT_TRUE(pref_chrome.install_chrome()); | 342 EXPECT_TRUE(pref_chrome.install_chrome()); |
| 343 } | 343 } |
| 344 | 344 |
| 345 TEST_F(MasterPreferencesTest, EnforceLegacyCreateAllShortcutsFalse) { | 345 TEST_F(MasterPreferencesTest, EnforceLegacyCreateAllShortcutsFalse) { |
| 346 static const char kCreateAllShortcutsFalsePrefs[] = | 346 static const char kCreateAllShortcutsFalsePrefs[] = |
| 347 "{" | 347 "{" |
| 348 " \"distribution\": {" | 348 " \"distribution\": {" |
| 349 " \"create_all_shortcuts\": false" | 349 " \"create_all_shortcuts\": false" |
| 350 " }" | 350 " }" |
| 351 "}"; | 351 "}"; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 } | 453 } |
| 454 { | 454 { |
| 455 ScopedGoogleUpdateIsMachine env_setter("2"); | 455 ScopedGoogleUpdateIsMachine env_setter("2"); |
| 456 installer::MasterPreferences prefs( | 456 installer::MasterPreferences prefs( |
| 457 base::CommandLine(base::FilePath(FILE_PATH_LITERAL("setup.exe")))); | 457 base::CommandLine(base::FilePath(FILE_PATH_LITERAL("setup.exe")))); |
| 458 bool value = false; | 458 bool value = false; |
| 459 prefs.GetBool(installer::master_preferences::kSystemLevel, &value); | 459 prefs.GetBool(installer::master_preferences::kSystemLevel, &value); |
| 460 EXPECT_FALSE(value); | 460 EXPECT_FALSE(value); |
| 461 } | 461 } |
| 462 } | 462 } |
| OLD | NEW |