Chromium Code Reviews| Index: chrome/browser/component_updater/test/cld_component_installer_unittest.cc |
| diff --git a/chrome/browser/component_updater/test/cld_component_installer_unittest.cc b/chrome/browser/component_updater/test/cld_component_installer_unittest.cc |
| index 6fc4f14b73b4dcd57bae5db09d4c016425f926fc..7791f14027030079b69415a0c3d41029b38bd6b9 100644 |
| --- a/chrome/browser/component_updater/test/cld_component_installer_unittest.cc |
| +++ b/chrome/browser/component_updater/test/cld_component_installer_unittest.cc |
| @@ -16,6 +16,7 @@ |
| #include "chrome/browser/component_updater/cld_component_installer.h" |
| #include "chrome/common/chrome_constants.h" |
| #include "chrome/common/chrome_paths.h" |
| +#include "components/translate/content/browser/data_file_browser_cld_data_provider.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| #include "testing/platform_test.h" |
| @@ -33,21 +34,25 @@ class CldComponentInstallerTest : public PlatformTest { |
| // created *as temp files*, they will still get cleaned up automagically. |
| ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| + cld_data_file_name = |
| + component_updater::CldComponentInstallerTraits::GetCldDataFileName(); |
| + |
| // The "latest CLD data file" is a static piece of information, and thus |
| // for correctness we empty it before each test. |
| traits.SetLatestCldDataFile(base::FilePath()); |
| } |
|
Takashi Toyoshima
2014/06/23 08:50:00
following members can be protected.
Andrew Hayden (chromium.org)
2014/06/23 13:20:35
Done.
|
| + const base::FilePath::CharType* cld_data_file_name; |
|
Takashi Toyoshima
2014/06/23 08:50:00
cld_data_file_name_
Andrew Hayden (chromium.org)
2014/06/23 13:20:35
Now that I've removed the getter from cld_componen
|
| base::ScopedTempDir temp_dir_; |
| component_updater::CldComponentInstallerTraits traits; |
|
Takashi Toyoshima
2014/06/23 08:50:00
traits_
Andrew Hayden (chromium.org)
2014/06/23 13:20:34
Done.
|
| }; |
|
Takashi Toyoshima
2014/06/23 08:50:00
DISALLOW_...
Andrew Hayden (chromium.org)
2014/06/23 13:20:34
Done.
|
| TEST_F(CldComponentInstallerTest, SetLatestCldDataFile) { |
| - ASSERT_TRUE(component_updater::GetLatestCldDataFile().empty()); |
|
Takashi Toyoshima
2014/06/23 08:50:00
I'm not sure it is worth doing, but this check can
Andrew Hayden (chromium.org)
2014/06/23 13:20:35
Added equivalent check to setup.
|
| const base::FilePath expected(FILE_PATH_LITERAL("test/foo.test")); |
| traits.SetLatestCldDataFile(expected); |
| - base::FilePath result = component_updater::GetLatestCldDataFile(); |
| + base::FilePath result = |
| + translate::DataFileBrowserCldDataProvider::GetCldDataFilePath(); |
| ASSERT_EQ(expected, result); |
| } |
| @@ -60,7 +65,7 @@ TEST_F(CldComponentInstallerTest, VerifyInstallation) { |
| FILE_PATH_LITERAL("all")); |
| ASSERT_TRUE(base::CreateDirectory(data_file_dir)); |
| const base::FilePath data_file = |
|
Takashi Toyoshima
2014/06/23 08:50:00
no line break
Andrew Hayden (chromium.org)
2014/06/23 13:20:35
Done.
|
| - data_file_dir.Append(chrome::kCLDDataFilename); |
| + data_file_dir.Append(cld_data_file_name); |
| const std::string test_data("fake cld2 data file content here :)"); |
| ASSERT_EQ(static_cast<int32>(test_data.length()), |
| base::WriteFile(data_file, test_data.c_str(), test_data.length())); |
| @@ -78,7 +83,7 @@ TEST_F(CldComponentInstallerTest, GetInstalledPath) { |
| const base::FilePath base_dir; |
| const base::FilePath result = |
| CldComponentInstallerTraits::GetInstalledPath(base_dir); |
| - ASSERT_TRUE(EndsWith(result.value(), chrome::kCLDDataFilename, true)); |
| + ASSERT_TRUE(EndsWith(result.value(), cld_data_file_name, true)); |
| } |
| TEST_F(CldComponentInstallerTest, GetBaseDirectory) { |
| @@ -101,11 +106,12 @@ TEST_F(CldComponentInstallerTest, ComponentReady) { |
| const base::FilePath install_dir(FILE_PATH_LITERAL("/foo")); |
| const base::Version version("1.2.3.4"); |
| traits.ComponentReady(version, install_dir, manifest.Pass()); |
| - base::FilePath result = component_updater::GetLatestCldDataFile(); |
| + base::FilePath result = |
| + translate::DataFileBrowserCldDataProvider::GetCldDataFilePath(); |
| ASSERT_TRUE(StartsWith(result.AsUTF16Unsafe(), |
| install_dir.AsUTF16Unsafe(), |
| true)); |
| - ASSERT_TRUE(EndsWith(result.value(), chrome::kCLDDataFilename, true)); |
| + ASSERT_TRUE(EndsWith(result.value(), cld_data_file_name, true)); |
| } |
| } // namespace component_updater |