diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 21:59:03 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-31 21:59:03 +0000 |
commit | f847279a6fdb4f407233be3a52d4c70c5b11e697 (patch) | |
tree | 041dd9ba44e51d0fbc7628c0daae8b34e61842f0 /chrome/installer | |
parent | 5f8d121f337433a9426cfbbf87c4adbe93ce3459 (diff) | |
download | chromium_src-f847279a6fdb4f407233be3a52d4c70c5b11e697.zip chromium_src-f847279a6fdb4f407233be3a52d4c70c5b11e697.tar.gz chromium_src-f847279a6fdb4f407233be3a52d4c70c5b11e697.tar.bz2 |
fix unit tests
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22203 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r-- | chrome/installer/util/google_chrome_distribution_unittest.cc | 77 |
1 files changed, 50 insertions, 27 deletions
diff --git a/chrome/installer/util/google_chrome_distribution_unittest.cc b/chrome/installer/util/google_chrome_distribution_unittest.cc index c404061..f84916b 100644 --- a/chrome/installer/util/google_chrome_distribution_unittest.cc +++ b/chrome/installer/util/google_chrome_distribution_unittest.cc @@ -256,8 +256,8 @@ TEST(BrowserDistribution, AlternateAndNormalShortcutName) { } TEST(MasterPreferences, ParseDistroParams) { - std::wstring prefs; - ASSERT_TRUE(file_util::CreateTemporaryFileName(&prefs)); + std::wstring prefs_file; + ASSERT_TRUE(file_util::CreateTemporaryFileName(&prefs_file)); const char text[] = "{ \n" " \"distribution\": { \n" @@ -281,31 +281,49 @@ TEST(MasterPreferences, ParseDistroParams) { " }\n" "} \n"; - EXPECT_TRUE(file_util::WriteFile(prefs, text, sizeof(text))); - int result = installer_util::ParseDistributionPreferences(prefs); - EXPECT_FALSE(result & installer_util::MASTER_PROFILE_NOT_FOUND); - EXPECT_FALSE(result & installer_util::MASTER_PROFILE_ERROR); - EXPECT_TRUE(result & installer_util::MASTER_PROFILE_NO_FIRST_RUN_UI); - EXPECT_TRUE(result & installer_util::MASTER_PROFILE_SHOW_WELCOME); - EXPECT_TRUE(result & installer_util::MASTER_PROFILE_IMPORT_SEARCH_ENGINE); - EXPECT_TRUE(result & installer_util::MASTER_PROFILE_IMPORT_HISTORY); - EXPECT_TRUE(result & installer_util::MASTER_PROFILE_IMPORT_BOOKMARKS); - EXPECT_TRUE(result & installer_util::MASTER_PROFILE_IMPORT_HOME_PAGE); - EXPECT_TRUE(result & installer_util::MASTER_PROFILE_CREATE_ALL_SHORTCUTS); - EXPECT_TRUE(result & installer_util::MASTER_PROFILE_DO_NOT_LAUNCH_CHROME); - EXPECT_TRUE(result & installer_util::MASTER_PROFILE_MAKE_CHROME_DEFAULT); - EXPECT_TRUE(result & - installer_util::MASTER_PROFILE_MAKE_CHROME_DEFAULT_FOR_USER); - EXPECT_TRUE(result & installer_util::MASTER_PROFILE_SYSTEM_LEVEL); - EXPECT_TRUE(result & installer_util::MASTER_PROFILE_VERBOSE_LOGGING); - EXPECT_TRUE(result & installer_util::MASTER_PROFILE_REQUIRE_EULA); - EXPECT_TRUE(result & installer_util::MASTER_PROFILE_ALT_SHORTCUT_TXT); - EXPECT_TRUE(file_util::Delete(prefs, false)); + EXPECT_TRUE(file_util::WriteFile(prefs_file, text, sizeof(text))); + scoped_ptr<DictionaryValue> prefs( + installer_util::ParseDistributionPreferences( + FilePath::FromWStringHack(prefs_file))); + EXPECT_TRUE(prefs.get() != NULL); + EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), + installer_util::master_preferences::kDistroSkipFirstRunPref)); + EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), + installer_util::master_preferences::kDistroShowWelcomePage)); + + EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), + installer_util::master_preferences::kDistroImportSearchPref)); + EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), + installer_util::master_preferences::kDistroImportHistoryPref)); + EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), + installer_util::master_preferences::kDistroImportBookmarksPref)); + EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), + installer_util::master_preferences::kDistroImportHomePagePref)); + + EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), + installer_util::master_preferences::kCreateAllShortcuts)); + EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), + installer_util::master_preferences::kDoNotLaunchChrome)); + EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), + installer_util::master_preferences::kMakeChromeDefault)); + EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), + installer_util::master_preferences::kMakeChromeDefaultForUser)); + + EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), + installer_util::master_preferences::kSystemLevel)); + EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), + installer_util::master_preferences::kVerboseLogging)); + EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), + installer_util::master_preferences::kRequireEula)); + EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), + installer_util::master_preferences::kAltShortcutText)); + + EXPECT_TRUE(file_util::Delete(prefs_file, false)); } TEST(MasterPreferences, FirstRunTabs) { - std::wstring prefs; - ASSERT_TRUE(file_util::CreateTemporaryFileName(&prefs)); + std::wstring prefs_file; + ASSERT_TRUE(file_util::CreateTemporaryFileName(&prefs_file)); const char text[] = "{ \n" " \"distribution\": { \n" @@ -318,12 +336,17 @@ TEST(MasterPreferences, FirstRunTabs) { " ]\n" "} \n"; - EXPECT_TRUE(file_util::WriteFile(prefs, text, sizeof(text))); + EXPECT_TRUE(file_util::WriteFile(prefs_file, text, sizeof(text))); + scoped_ptr<DictionaryValue> prefs( + installer_util::ParseDistributionPreferences( + FilePath::FromWStringHack(prefs_file))); + EXPECT_TRUE(prefs.get() != NULL); + typedef std::vector<std::wstring> TabsVector; - TabsVector tabs = installer_util::ParseFirstRunTabs(prefs); + TabsVector tabs = installer_util::GetFirstRunTabs(prefs.get()); ASSERT_EQ(3, tabs.size()); EXPECT_EQ(L"http://google.com/f1", tabs[0]); EXPECT_EQ(L"https://google.com/f2", tabs[1]); EXPECT_EQ(L"new_tab_page", tabs[2]); - EXPECT_TRUE(file_util::Delete(prefs, false)); + EXPECT_TRUE(file_util::Delete(prefs_file, false)); } |