Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(786)

Unified Diff: chrome/browser/translate/component_cld_data_harness.cc

Issue 461633002: Refactor language detection logic to allow non-static CLD data sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make some of the harness factory methods private Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/translate/component_cld_data_harness.cc
diff --git a/chrome/browser/translate/component_cld_data_harness.cc b/chrome/browser/translate/component_cld_data_harness.cc
index 45909ee9a5e7fe584039c507a283550c19b678f4..dc5f1bd3175da84e6d153edf36b27cfd22c662b3 100644
--- a/chrome/browser/translate/component_cld_data_harness.cc
+++ b/chrome/browser/translate/component_cld_data_harness.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "component_cld_data_harness.h"
+#include "chrome/browser/translate/component_cld_data_harness.h"
#include "base/base_paths.h"
#include "base/files/file_util.h"
@@ -10,6 +10,8 @@
#include "base/path_service.h"
#include "chrome/browser/component_updater/cld_component_installer.h"
#include "chrome/common/chrome_paths.h"
+#include "components/component_updater/component_updater_paths.h"
+#include "components/translate/content/common/cld_data_source.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -22,10 +24,6 @@ const base::FilePath::CharType kComponentDataFileName[] =
namespace test {
-ComponentCldDataHarness::ComponentCldDataHarness() {
- // Constructor does nothing in all cases. See Init() for initialization.
-}
-
ComponentCldDataHarness::~ComponentCldDataHarness() {
DVLOG(1) << "Tearing down CLD data harness";
// Dynamic data mode is enabled and we are using the component updater.
@@ -38,6 +36,8 @@ ComponentCldDataHarness::~ComponentCldDataHarness() {
void ComponentCldDataHarness::Init() {
DVLOG(1) << "Initializing CLD data harness";
// Dynamic data mode is enabled and we are using the component updater.
+ translate::CldDataSource::Set(
+ translate::CldDataSource::GetComponentDataSource());
ASSERT_NO_FATAL_FAILURE(CopyComponentTree());
base::FilePath data_file;
GetComponentDataFileDestination(&data_file);
@@ -56,7 +56,8 @@ void ComponentCldDataHarness::ClearComponentDataFileState() {
// parallel test processes.
void ComponentCldDataHarness::GetExtractedComponentDestination(
base::FilePath* out_path) {
- ASSERT_TRUE(PathService::Get(chrome::DIR_COMPONENT_CLD2, out_path));
+ ASSERT_TRUE(PathService::Get(component_updater::DIR_COMPONENT_CLD2,
+ out_path));
}
void ComponentCldDataHarness::GetComponentDataFileDestination(
@@ -91,9 +92,4 @@ void ComponentCldDataHarness::CopyComponentTree() {
ASSERT_TRUE(base::PathExists(check_path));
}
-scoped_ptr<CldDataHarness> CreateCldDataHarness() {
- scoped_ptr<CldDataHarness> result(new ComponentCldDataHarness());
- return result.Pass();
-}
-
} // namespace test
« no previous file with comments | « chrome/browser/translate/component_cld_data_harness.h ('k') | chrome/browser/translate/standalone_cld_data_harness.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698