Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(716)

Side by Side Diff: chrome/installer/util/master_preferences_unittest.cc

Issue 1571343002: [Merge M48] Remove support for chrome_shortcut_icon_index master_pref. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/installer/util/master_preferences_constants.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 " \"do_not_create_desktop_shortcut\": true,\n" 62 " \"do_not_create_desktop_shortcut\": true,\n"
63 " \"do_not_create_quick_launch_shortcut\": true,\n" 63 " \"do_not_create_quick_launch_shortcut\": true,\n"
64 " \"do_not_create_taskbar_shortcut\": true,\n" 64 " \"do_not_create_taskbar_shortcut\": true,\n"
65 " \"do_not_launch_chrome\": true,\n" 65 " \"do_not_launch_chrome\": true,\n"
66 " \"make_chrome_default\": true,\n" 66 " \"make_chrome_default\": true,\n"
67 " \"make_chrome_default_for_user\": true,\n" 67 " \"make_chrome_default_for_user\": true,\n"
68 " \"system_level\": true,\n" 68 " \"system_level\": true,\n"
69 " \"verbose_logging\": true,\n" 69 " \"verbose_logging\": true,\n"
70 " \"require_eula\": true,\n" 70 " \"require_eula\": true,\n"
71 " \"alternate_shortcut_text\": true,\n" 71 " \"alternate_shortcut_text\": true,\n"
72 " \"chrome_shortcut_icon_index\": 1,\n"
73 " \"ping_delay\": 40\n" 72 " \"ping_delay\": 40\n"
74 " },\n" 73 " },\n"
75 " \"blah\": {\n" 74 " \"blah\": {\n"
76 " \"import_history\": false\n" 75 " \"import_history\": false\n"
77 " }\n" 76 " }\n"
78 "} \n"; 77 "} \n";
79 78
80 EXPECT_TRUE(base::WriteFile(prefs_file(), text, 79 EXPECT_TRUE(base::WriteFile(prefs_file(), text,
81 static_cast<int>(strlen(text)))); 80 static_cast<int>(strlen(text))));
82 installer::MasterPreferences prefs(prefs_file()); 81 installer::MasterPreferences prefs(prefs_file());
(...skipping 23 matching lines...) Expand all
106 EXPECT_TRUE(prefs.GetBool(expected_true[i], &value)); 105 EXPECT_TRUE(prefs.GetBool(expected_true[i], &value));
107 EXPECT_TRUE(value) << expected_true[i]; 106 EXPECT_TRUE(value) << expected_true[i];
108 } 107 }
109 108
110 std::string str_value; 109 std::string str_value;
111 EXPECT_TRUE(prefs.GetString( 110 EXPECT_TRUE(prefs.GetString(
112 installer::master_preferences::kDistroImportBookmarksFromFilePref, 111 installer::master_preferences::kDistroImportBookmarksFromFilePref,
113 &str_value)); 112 &str_value));
114 EXPECT_STREQ("c:\\foo", str_value.c_str()); 113 EXPECT_STREQ("c:\\foo", str_value.c_str());
115 114
116 int icon_index = 0;
117 EXPECT_TRUE(prefs.GetInt(
118 installer::master_preferences::kChromeShortcutIconIndex,
119 &icon_index));
120 EXPECT_EQ(icon_index, 1);
121 int ping_delay = 90; 115 int ping_delay = 90;
122 EXPECT_TRUE(prefs.GetInt(installer::master_preferences::kDistroPingDelay, 116 EXPECT_TRUE(prefs.GetInt(installer::master_preferences::kDistroPingDelay,
123 &ping_delay)); 117 &ping_delay));
124 EXPECT_EQ(ping_delay, 40); 118 EXPECT_EQ(ping_delay, 40);
125 } 119 }
126 120
127 TEST_F(MasterPreferencesTest, ParseMissingDistroParams) { 121 TEST_F(MasterPreferencesTest, ParseMissingDistroParams) {
128 const char text[] = 122 const char text[] =
129 "{ \n" 123 "{ \n"
130 " \"distribution\": { \n" 124 " \"distribution\": { \n"
131 " \"import_search_engine\": true,\n" 125 " \"import_search_engine\": true,\n"
132 " \"import_bookmarks\": false,\n" 126 " \"import_bookmarks\": false,\n"
133 " \"import_bookmarks_from_file\": \"\",\n" 127 " \"import_bookmarks_from_file\": \"\",\n"
134 " \"do_not_create_desktop_shortcut\": true,\n" 128 " \"do_not_create_desktop_shortcut\": true,\n"
135 " \"do_not_create_quick_launch_shortcut\": true,\n" 129 " \"do_not_create_quick_launch_shortcut\": true,\n"
136 " \"do_not_launch_chrome\": true,\n" 130 " \"do_not_launch_chrome\": true\n"
137 " \"chrome_shortcut_icon_index\": \"bac\"\n"
138 " }\n" 131 " }\n"
139 "} \n"; 132 "} \n";
140 133
141 EXPECT_TRUE(base::WriteFile(prefs_file(), text, 134 EXPECT_TRUE(base::WriteFile(prefs_file(), text,
142 static_cast<int>(strlen(text)))); 135 static_cast<int>(strlen(text))));
143 installer::MasterPreferences prefs(prefs_file()); 136 installer::MasterPreferences prefs(prefs_file());
144 EXPECT_TRUE(prefs.read_from_file()); 137 EXPECT_TRUE(prefs.read_from_file());
145 138
146 ExpectedBooleans expected_bool[] = { 139 ExpectedBooleans expected_bool[] = {
147 { installer::master_preferences::kDistroImportSearchPref, true }, 140 { installer::master_preferences::kDistroImportSearchPref, true },
(...skipping 19 matching lines...) Expand all
167 160
168 for (int i = 0; i < arraysize(missing_bools); ++i) { 161 for (int i = 0; i < arraysize(missing_bools); ++i) {
169 EXPECT_FALSE(prefs.GetBool(missing_bools[i], &value)) << missing_bools[i]; 162 EXPECT_FALSE(prefs.GetBool(missing_bools[i], &value)) << missing_bools[i];
170 } 163 }
171 164
172 std::string str_value; 165 std::string str_value;
173 EXPECT_FALSE(prefs.GetString( 166 EXPECT_FALSE(prefs.GetString(
174 installer::master_preferences::kDistroImportBookmarksFromFilePref, 167 installer::master_preferences::kDistroImportBookmarksFromFilePref,
175 &str_value)); 168 &str_value));
176 169
177 int icon_index = 0;
178 EXPECT_FALSE(prefs.GetInt(
179 installer::master_preferences::kChromeShortcutIconIndex,
180 &icon_index));
181 EXPECT_EQ(icon_index, 0);
182
183 int ping_delay = 90; 170 int ping_delay = 90;
184 EXPECT_FALSE(prefs.GetInt( 171 EXPECT_FALSE(prefs.GetInt(
185 installer::master_preferences::kDistroPingDelay, &ping_delay)); 172 installer::master_preferences::kDistroPingDelay, &ping_delay));
186 EXPECT_EQ(ping_delay, 90); 173 EXPECT_EQ(ping_delay, 90);
187 } 174 }
188 175
189 TEST_F(MasterPreferencesTest, FirstRunTabs) { 176 TEST_F(MasterPreferencesTest, FirstRunTabs) {
190 const char text[] = 177 const char text[] =
191 "{ \n" 178 "{ \n"
192 " \"distribution\": { \n" 179 " \"distribution\": { \n"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 // The MasterPreferences dictionary should also conjure up the new setting 467 // The MasterPreferences dictionary should also conjure up the new setting
481 // as per EnforceLegacyPreferences. 468 // as per EnforceLegacyPreferences.
482 const base::ListValue* new_startup_urls_list = NULL; 469 const base::ListValue* new_startup_urls_list = NULL;
483 EXPECT_TRUE(master_dictionary.GetList(prefs::kURLsToRestoreOnStartup, 470 EXPECT_TRUE(master_dictionary.GetList(prefs::kURLsToRestoreOnStartup,
484 &new_startup_urls_list)); 471 &new_startup_urls_list));
485 ASSERT_TRUE(new_startup_urls_list != NULL); 472 ASSERT_TRUE(new_startup_urls_list != NULL);
486 std::string new_url_value; 473 std::string new_url_value;
487 EXPECT_TRUE(new_startup_urls_list->GetString(0, &new_url_value)); 474 EXPECT_TRUE(new_startup_urls_list->GetString(0, &new_url_value));
488 EXPECT_EQ("http://www.example.com", new_url_value); 475 EXPECT_EQ("http://www.example.com", new_url_value);
489 } 476 }
OLDNEW
« no previous file with comments | « chrome/installer/util/master_preferences_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698