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

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

Issue 56204: Merge r13043.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/branches/172/src/
Patch Set: Created 11 years, 8 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 | « no previous file | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 GoogleChromeDistribution class. 5 // Unit tests for GoogleChromeDistribution class.
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/registry.h" 9 #include "base/registry.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 std::wstring uninstall_metrics_string; 222 std::wstring uninstall_metrics_string;
223 GoogleChromeDistribution* dist = static_cast<GoogleChromeDistribution*>( 223 GoogleChromeDistribution* dist = static_cast<GoogleChromeDistribution*>(
224 BrowserDistribution::GetDistribution()); 224 BrowserDistribution::GetDistribution());
225 EXPECT_TRUE( 225 EXPECT_TRUE(
226 dist->ExtractUninstallMetrics(*static_cast<DictionaryValue*>(root.get()), 226 dist->ExtractUninstallMetrics(*static_cast<DictionaryValue*>(root.get()),
227 &uninstall_metrics_string)); 227 &uninstall_metrics_string));
228 EXPECT_EQ(expected_url_string, uninstall_metrics_string); 228 EXPECT_EQ(expected_url_string, uninstall_metrics_string);
229 } 229 }
230 230
231 #else
232 // The distribution strings should not be empty. The unit tests are not linking
233 // with the chrome resources so we cannot test official build.
234 TEST(BrowserDistribution, StringsTest) {
235 BrowserDistribution *dist = BrowserDistribution::GetDistribution();
236 ASSERT_TRUE(dist != NULL);
237 std::wstring name = dist->GetApplicationName();
238 EXPECT_FALSE(name.empty());
239 std::wstring desc = dist->GetAppDescription();
240 EXPECT_FALSE(desc.empty());
241 std::wstring alt_name = dist->GetAlternateApplicationName();
242 EXPECT_FALSE(alt_name.empty());
243 }
244
245 // The shortcut strings obtained by the shell utility functions should not
246 // be empty or be the same.
247 TEST(BrowserDistribution, AlternateAndNormalShortcutName) {
248 std::wstring normal_name;
249 std::wstring alternate_name;
250 EXPECT_TRUE(ShellUtil::GetChromeShortcutName(&normal_name, false));
251 EXPECT_TRUE(ShellUtil::GetChromeShortcutName(&alternate_name, true));
252 EXPECT_NE(normal_name, alternate_name);
253 EXPECT_FALSE(normal_name.empty());
254 EXPECT_FALSE(alternate_name.empty());
255 }
231 #endif 256 #endif
232 257
233 TEST(MasterPreferences, ParseDistroParams) { 258 TEST(MasterPreferences, ParseDistroParams) {
234 std::wstring prefs; 259 std::wstring prefs;
235 ASSERT_TRUE(file_util::CreateTemporaryFileName(&prefs)); 260 ASSERT_TRUE(file_util::CreateTemporaryFileName(&prefs));
236 const char text[] = 261 const char text[] =
237 "{ \n" 262 "{ \n"
238 " \"distribution\": { \n" 263 " \"distribution\": { \n"
239 " \"skip_first_run_ui\": true,\n" 264 " \"skip_first_run_ui\": true,\n"
240 " \"show_welcome_page\": true,\n" 265 " \"show_welcome_page\": true,\n"
(...skipping 23 matching lines...) Expand all
264 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_CREATE_ALL_SHORTCUTS); 289 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_CREATE_ALL_SHORTCUTS);
265 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_DO_NOT_LAUNCH_CHROME); 290 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_DO_NOT_LAUNCH_CHROME);
266 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_MAKE_CHROME_DEFAULT); 291 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_MAKE_CHROME_DEFAULT);
267 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_SYSTEM_LEVEL); 292 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_SYSTEM_LEVEL);
268 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_VERBOSE_LOGGING); 293 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_VERBOSE_LOGGING);
269 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_REQUIRE_EULA); 294 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_REQUIRE_EULA);
270 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_ALT_SHORTCUT_TXT); 295 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_ALT_SHORTCUT_TXT);
271 EXPECT_TRUE(file_util::Delete(prefs, false)); 296 EXPECT_TRUE(file_util::Delete(prefs, false));
272 } 297 }
273 298
274 // The distribution strings should not be empty on chrome or chromium distros.
275 TEST(BrowserDistribution, StringsTest) {
276 BrowserDistribution *dist = BrowserDistribution::GetDistribution();
277 ASSERT_TRUE(dist != NULL);
278 std::wstring name = dist->GetApplicationName();
279 EXPECT_FALSE(name.empty());
280 std::wstring desc = dist->GetAppDescription();
281 EXPECT_FALSE(desc.empty());
282 std::wstring alt_name = dist->GetAlternateApplicationName();
283 EXPECT_FALSE(alt_name.empty());
284 }
285
286 // The shortcut strings obtained by the shell utility functions should not
287 // be empty or be the same.
288 TEST(BrowserDistribution, AlternateAndNormalShortcutName) {
289 std::wstring normal_name;
290 std::wstring alternate_name;
291 EXPECT_TRUE(ShellUtil::GetChromeShortcutName(&normal_name, false));
292 EXPECT_TRUE(ShellUtil::GetChromeShortcutName(&alternate_name, true));
293 EXPECT_NE(normal_name, alternate_name);
294 EXPECT_FALSE(normal_name.empty());
295 EXPECT_FALSE(alternate_name.empty());
296 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698