| OLD | NEW |
| 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 ASSERT_TRUE(root.get()); | 220 ASSERT_TRUE(root.get()); |
| 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 #endif |
| 230 | 231 |
| 231 #else | |
| 232 // The distribution strings should not be empty. The unit tests are not linking | 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. | 233 // with the chrome resources so we cannot test official build. |
| 234 TEST(BrowserDistribution, StringsTest) { | 234 TEST(BrowserDistribution, StringsTest) { |
| 235 BrowserDistribution *dist = BrowserDistribution::GetDistribution(); | 235 BrowserDistribution *dist = BrowserDistribution::GetDistribution(); |
| 236 ASSERT_TRUE(dist != NULL); | 236 ASSERT_TRUE(dist != NULL); |
| 237 std::wstring name = dist->GetApplicationName(); | 237 std::wstring name = dist->GetApplicationName(); |
| 238 EXPECT_FALSE(name.empty()); | 238 EXPECT_FALSE(name.empty()); |
| 239 std::wstring desc = dist->GetAppDescription(); | 239 std::wstring desc = dist->GetAppDescription(); |
| 240 EXPECT_FALSE(desc.empty()); | 240 EXPECT_FALSE(desc.empty()); |
| 241 std::wstring alt_name = dist->GetAlternateApplicationName(); | 241 std::wstring alt_name = dist->GetAlternateApplicationName(); |
| 242 EXPECT_FALSE(alt_name.empty()); | 242 EXPECT_FALSE(alt_name.empty()); |
| 243 } | 243 } |
| 244 | 244 |
| 245 // The shortcut strings obtained by the shell utility functions should not | 245 // The shortcut strings obtained by the shell utility functions should not |
| 246 // be empty or be the same. | 246 // be empty or be the same. |
| 247 TEST(BrowserDistribution, AlternateAndNormalShortcutName) { | 247 TEST(BrowserDistribution, AlternateAndNormalShortcutName) { |
| 248 std::wstring normal_name; | 248 std::wstring normal_name; |
| 249 std::wstring alternate_name; | 249 std::wstring alternate_name; |
| 250 EXPECT_TRUE(ShellUtil::GetChromeShortcutName(&normal_name, false)); | 250 EXPECT_TRUE(ShellUtil::GetChromeShortcutName(&normal_name, false)); |
| 251 EXPECT_TRUE(ShellUtil::GetChromeShortcutName(&alternate_name, true)); | 251 EXPECT_TRUE(ShellUtil::GetChromeShortcutName(&alternate_name, true)); |
| 252 EXPECT_NE(normal_name, alternate_name); | 252 EXPECT_NE(normal_name, alternate_name); |
| 253 EXPECT_FALSE(normal_name.empty()); | 253 EXPECT_FALSE(normal_name.empty()); |
| 254 EXPECT_FALSE(alternate_name.empty()); | 254 EXPECT_FALSE(alternate_name.empty()); |
| 255 } | 255 } |
| 256 #endif | |
| 257 | 256 |
| 258 TEST(MasterPreferences, ParseDistroParams) { | 257 TEST(MasterPreferences, ParseDistroParams) { |
| 259 std::wstring prefs; | 258 std::wstring prefs; |
| 260 ASSERT_TRUE(file_util::CreateTemporaryFileName(&prefs)); | 259 ASSERT_TRUE(file_util::CreateTemporaryFileName(&prefs)); |
| 261 const char text[] = | 260 const char text[] = |
| 262 "{ \n" | 261 "{ \n" |
| 263 " \"distribution\": { \n" | 262 " \"distribution\": { \n" |
| 264 " \"skip_first_run_ui\": true,\n" | 263 " \"skip_first_run_ui\": true,\n" |
| 265 " \"show_welcome_page\": true,\n" | 264 " \"show_welcome_page\": true,\n" |
| 266 " \"import_search_engine\": true,\n" | 265 " \"import_search_engine\": true,\n" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 289 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_CREATE_ALL_SHORTCUTS); | 288 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_CREATE_ALL_SHORTCUTS); |
| 290 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_DO_NOT_LAUNCH_CHROME); | 289 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_DO_NOT_LAUNCH_CHROME); |
| 291 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_MAKE_CHROME_DEFAULT); | 290 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_MAKE_CHROME_DEFAULT); |
| 292 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_SYSTEM_LEVEL); | 291 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_SYSTEM_LEVEL); |
| 293 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_VERBOSE_LOGGING); | 292 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_VERBOSE_LOGGING); |
| 294 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_REQUIRE_EULA); | 293 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_REQUIRE_EULA); |
| 295 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_ALT_SHORTCUT_TXT); | 294 EXPECT_TRUE(result & installer_util::MASTER_PROFILE_ALT_SHORTCUT_TXT); |
| 296 EXPECT_TRUE(file_util::Delete(prefs, false)); | 295 EXPECT_TRUE(file_util::Delete(prefs, false)); |
| 297 } | 296 } |
| 298 | 297 |
| OLD | NEW |