| 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());
|
| }
|
|
|
| + const base::FilePath::CharType* cld_data_file_name;
|
| base::ScopedTempDir temp_dir_;
|
| component_updater::CldComponentInstallerTraits traits;
|
| };
|
|
|
| TEST_F(CldComponentInstallerTest, SetLatestCldDataFile) {
|
| - ASSERT_TRUE(component_updater::GetLatestCldDataFile().empty());
|
| 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 =
|
| - 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
|
|
|