Chromium Code Reviews| Index: chrome/common/mac/app_mode_chrome_locator_unittest.mm |
| diff --git a/chrome/common/mac/app_mode_chrome_locator_unittest.mm b/chrome/common/mac/app_mode_chrome_locator_unittest.mm |
| index ecaed7d513aee3adf1b94c1ae58e20942acc707c..22bd0e811ceda1d34c6792eda240c9c4ef7862f6 100644 |
| --- a/chrome/common/mac/app_mode_chrome_locator_unittest.mm |
| +++ b/chrome/common/mac/app_mode_chrome_locator_unittest.mm |
| @@ -11,6 +11,7 @@ |
| #include "base/files/scoped_temp_dir.h" |
| #include "base/path_service.h" |
| #include "chrome/common/chrome_constants.h" |
| +#include "chrome/common/chrome_version_info.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| namespace { |
| @@ -44,28 +45,86 @@ TEST(ChromeLocatorTest, GetNonExistentBundleInfo) { |
| ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| base::FilePath executable_path; |
| - base::string16 raw_version; |
| base::FilePath version_path; |
| base::FilePath framework_path; |
| EXPECT_FALSE(app_mode::GetChromeBundleInfo(temp_dir.path(), |
| - &executable_path, &raw_version, &version_path, &framework_path)); |
| + std::string(), |
| + &executable_path, |
| + &version_path, |
| + &framework_path)); |
| } |
| TEST(ChromeLocatorTest, GetChromeBundleInfo) { |
| - using app_mode::GetChromeBundleInfo; |
| + base::FilePath chrome_bundle_path; |
| + GetChromeBundlePath(&chrome_bundle_path); |
| + ASSERT_TRUE(base::DirectoryExists(chrome_bundle_path)); |
| + base::FilePath executable_path; |
| + base::FilePath version_path; |
| + base::FilePath framework_path; |
| + EXPECT_TRUE(app_mode::GetChromeBundleInfo(chrome_bundle_path, |
| + std::string(), |
| + &executable_path, |
| + &version_path, |
| + &framework_path)); |
| + EXPECT_TRUE(base::PathExists(executable_path)); |
| + EXPECT_TRUE(base::DirectoryExists(version_path)); |
| + EXPECT_TRUE(base::PathExists(framework_path)); |
| +} |
| + |
| +TEST(ChromeLocatorTest, GetChromeBundleInfoWithVersion) { |
| base::FilePath chrome_bundle_path; |
| GetChromeBundlePath(&chrome_bundle_path); |
| ASSERT_TRUE(base::DirectoryExists(chrome_bundle_path)); |
| base::FilePath executable_path; |
| - base::string16 raw_version; |
| base::FilePath version_path; |
| base::FilePath framework_path; |
| - EXPECT_TRUE(GetChromeBundleInfo(chrome_bundle_path, |
| - &executable_path, &raw_version, &version_path, &framework_path)); |
| + EXPECT_TRUE(app_mode::GetChromeBundleInfo(chrome_bundle_path, |
| + chrome::VersionInfo().Version(), |
| + &executable_path, |
| + &version_path, |
| + &framework_path)); |
| + EXPECT_TRUE(base::PathExists(executable_path)); |
| + EXPECT_TRUE(base::DirectoryExists(version_path)); |
| + EXPECT_TRUE(base::PathExists(framework_path)); |
| +} |
| + |
| +TEST(ChromeLocatorTest, GetChromeBundleInfoWithVersionFailure) { |
| + base::FilePath chrome_bundle_path; |
| + GetChromeBundlePath(&chrome_bundle_path); |
| + ASSERT_TRUE(base::DirectoryExists(chrome_bundle_path)); |
| + |
| + base::FilePath executable_path; |
| + base::FilePath version_path; |
| + base::FilePath framework_path; |
| + EXPECT_FALSE(app_mode::GetChromeBundleInfo(chrome_bundle_path, |
| + std::string("invalid_version"), |
| + &executable_path, |
| + &version_path, |
| + &framework_path)); |
| +} |
| + |
| +TEST(ChromeLocatorTest, GetChromeBundleInfoWithVersionSuccess) { |
| + base::FilePath chrome_bundle_path; |
| + GetChromeBundlePath(&chrome_bundle_path); |
| + ASSERT_TRUE(base::DirectoryExists(chrome_bundle_path)); |
| + |
| + // Symlink "valid_version" to the actual version directory. |
| + ASSERT_TRUE(base::CreateSymbolicLink( |
|
tapted
2014/08/26 07:12:48
I'm not sure what this test is for - comment?... (
jackhou1
2014/08/26 08:15:14
Done.
|
| + base::FilePath(chrome::VersionInfo().Version()), |
| + chrome_bundle_path.Append("Contents").Append("Versions").Append( |
| + "valid_version"))); |
| + |
| + base::FilePath executable_path; |
| + base::FilePath version_path; |
| + base::FilePath framework_path; |
| + EXPECT_TRUE(app_mode::GetChromeBundleInfo(chrome_bundle_path, |
| + std::string("valid_version"), |
| + &executable_path, |
| + &version_path, |
| + &framework_path)); |
| EXPECT_TRUE(base::PathExists(executable_path)); |
| - EXPECT_GT(raw_version.size(), 0U); |
| EXPECT_TRUE(base::DirectoryExists(version_path)); |
| EXPECT_TRUE(base::PathExists(framework_path)); |
| } |