| OLD | NEW |
| 1 // Copyright (c) 2011 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 "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" |
| 11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 " \"import_bookmarks_from_file\": \"c:\\\\foo\",\n" | 53 " \"import_bookmarks_from_file\": \"c:\\\\foo\",\n" |
| 54 " \"import_home_page\": true,\n" | 54 " \"import_home_page\": true,\n" |
| 55 " \"create_all_shortcuts\": true,\n" | 55 " \"create_all_shortcuts\": true,\n" |
| 56 " \"do_not_launch_chrome\": true,\n" | 56 " \"do_not_launch_chrome\": true,\n" |
| 57 " \"make_chrome_default\": true,\n" | 57 " \"make_chrome_default\": true,\n" |
| 58 " \"make_chrome_default_for_user\": true,\n" | 58 " \"make_chrome_default_for_user\": true,\n" |
| 59 " \"system_level\": true,\n" | 59 " \"system_level\": true,\n" |
| 60 " \"verbose_logging\": true,\n" | 60 " \"verbose_logging\": true,\n" |
| 61 " \"require_eula\": true,\n" | 61 " \"require_eula\": true,\n" |
| 62 " \"alternate_shortcut_text\": true,\n" | 62 " \"alternate_shortcut_text\": true,\n" |
| 63 " \"oem_bubble\": true,\n" | |
| 64 " \"chrome_shortcut_icon_index\": 1,\n" | 63 " \"chrome_shortcut_icon_index\": 1,\n" |
| 65 " \"ping_delay\": 40,\n" | 64 " \"ping_delay\": 40,\n" |
| 66 " \"search_engine_experiment\": true\n" | 65 " \"search_engine_experiment\": true\n" |
| 67 " },\n" | 66 " },\n" |
| 68 " \"blah\": {\n" | 67 " \"blah\": {\n" |
| 69 " \"import_history\": false\n" | 68 " \"import_history\": false\n" |
| 70 " }\n" | 69 " }\n" |
| 71 "} \n"; | 70 "} \n"; |
| 72 | 71 |
| 73 EXPECT_TRUE(file_util::WriteFile(prefs_file(), text, sizeof(text))); | 72 EXPECT_TRUE(file_util::WriteFile(prefs_file(), text, sizeof(text))); |
| 74 installer::MasterPreferences prefs(prefs_file()); | 73 installer::MasterPreferences prefs(prefs_file()); |
| 75 | 74 |
| 76 const char* expected_true[] = { | 75 const char* expected_true[] = { |
| 77 installer::master_preferences::kDistroSkipFirstRunPref, | 76 installer::master_preferences::kDistroSkipFirstRunPref, |
| 78 installer::master_preferences::kDistroShowWelcomePage, | 77 installer::master_preferences::kDistroShowWelcomePage, |
| 79 installer::master_preferences::kDistroImportSearchPref, | 78 installer::master_preferences::kDistroImportSearchPref, |
| 80 installer::master_preferences::kDistroImportHistoryPref, | 79 installer::master_preferences::kDistroImportHistoryPref, |
| 81 installer::master_preferences::kDistroImportBookmarksPref, | 80 installer::master_preferences::kDistroImportBookmarksPref, |
| 82 installer::master_preferences::kDistroImportHomePagePref, | 81 installer::master_preferences::kDistroImportHomePagePref, |
| 83 installer::master_preferences::kCreateAllShortcuts, | 82 installer::master_preferences::kCreateAllShortcuts, |
| 84 installer::master_preferences::kDoNotLaunchChrome, | 83 installer::master_preferences::kDoNotLaunchChrome, |
| 85 installer::master_preferences::kMakeChromeDefault, | 84 installer::master_preferences::kMakeChromeDefault, |
| 86 installer::master_preferences::kMakeChromeDefaultForUser, | 85 installer::master_preferences::kMakeChromeDefaultForUser, |
| 87 installer::master_preferences::kSystemLevel, | 86 installer::master_preferences::kSystemLevel, |
| 88 installer::master_preferences::kVerboseLogging, | 87 installer::master_preferences::kVerboseLogging, |
| 89 installer::master_preferences::kRequireEula, | 88 installer::master_preferences::kRequireEula, |
| 90 installer::master_preferences::kAltShortcutText, | 89 installer::master_preferences::kAltShortcutText, |
| 91 installer::master_preferences::kAltFirstRunBubble, | |
| 92 installer::master_preferences::kSearchEngineExperimentPref, | 90 installer::master_preferences::kSearchEngineExperimentPref, |
| 93 }; | 91 }; |
| 94 | 92 |
| 95 for (int i = 0; i < arraysize(expected_true); ++i) { | 93 for (int i = 0; i < arraysize(expected_true); ++i) { |
| 96 bool value = false; | 94 bool value = false; |
| 97 EXPECT_TRUE(prefs.GetBool(expected_true[i], &value)); | 95 EXPECT_TRUE(prefs.GetBool(expected_true[i], &value)); |
| 98 EXPECT_TRUE(value) << expected_true[i]; | 96 EXPECT_TRUE(value) << expected_true[i]; |
| 99 } | 97 } |
| 100 | 98 |
| 101 std::string str_value; | 99 std::string str_value; |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 | 345 |
| 348 EXPECT_TRUE(pref_cf.is_multi_install()); | 346 EXPECT_TRUE(pref_cf.is_multi_install()); |
| 349 EXPECT_FALSE(pref_cf.install_chrome()); | 347 EXPECT_FALSE(pref_cf.install_chrome()); |
| 350 EXPECT_TRUE(pref_cf.install_chrome_frame()); | 348 EXPECT_TRUE(pref_cf.install_chrome_frame()); |
| 351 | 349 |
| 352 EXPECT_TRUE(pref_chrome_cf.is_multi_install()); | 350 EXPECT_TRUE(pref_chrome_cf.is_multi_install()); |
| 353 EXPECT_TRUE(pref_chrome_cf.install_chrome()); | 351 EXPECT_TRUE(pref_chrome_cf.install_chrome()); |
| 354 EXPECT_TRUE(pref_chrome_cf.install_chrome_frame()); | 352 EXPECT_TRUE(pref_chrome_cf.install_chrome_frame()); |
| 355 } | 353 } |
| 356 | 354 |
| OLD | NEW |