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

Side by Side Diff: chrome/browser/translate/cld_data_harness.cc

Issue 2034413003: Delete the non-static CLD data source logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to latest master Created 4 years, 6 months 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/translate/cld_data_harness.h"
6
7 #include "base/lazy_instance.h"
8 #include "base/macros.h"
9 #include "base/path_service.h"
10 #include "chrome/browser/translate/component_cld_data_harness.h"
11 #include "chrome/browser/translate/standalone_cld_data_harness.h"
12 #include "chrome/common/chrome_paths.h"
13 #include "components/translate/content/common/cld_data_source.h"
14 #include "testing/gtest/include/gtest/gtest.h"
15
16 namespace {
17 // This constant yields the version of the CRX that has been extracted into
18 // the test data directory, and must be kept in sync with what is there.
19 // A reciprocal comment has been placed in
20 // chrome/test/data/cld2_component/README.chromium; don't update one without
21 // updating the other.
22 const base::FilePath::CharType kCrxVersion[] = FILE_PATH_LITERAL("160");
23
24 class StaticCldDataHarness : public test::CldDataHarness {
25 public:
26 StaticCldDataHarness() {}
27 ~StaticCldDataHarness() override {};
28 void Init() override {
29 translate::CldDataSource::Set(
30 translate::CldDataSource::GetStaticDataSource());
31 }
32 private:
33 DISALLOW_COPY_AND_ASSIGN(StaticCldDataHarness);
34 };
35
36 } // namespace
37
38 namespace test {
39
40 const base::FilePath::CharType* CldDataHarness::GetTestDataSourceCrxVersion() {
41 return kCrxVersion;
42 }
43
44 void CldDataHarness::GetTestDataSourceDirectory(base::FilePath* out_path) {
45 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, out_path));
46 *out_path =
47 out_path->Append(FILE_PATH_LITERAL("cld2_component")).Append(kCrxVersion);
48 }
49
50 // static
51 std::unique_ptr<CldDataHarness> CldDataHarness::CreateStaticDataHarness() {
52 return std::unique_ptr<CldDataHarness>(new StaticCldDataHarness());
53 }
54
55 // static
56 std::unique_ptr<CldDataHarness> CldDataHarness::CreateStandaloneDataHarness() {
57 return std::unique_ptr<CldDataHarness>(new StandaloneCldDataHarness());
58 }
59
60 // static
61 std::unique_ptr<CldDataHarness> CldDataHarness::CreateComponentDataHarness() {
62 return std::unique_ptr<CldDataHarness>(new ComponentCldDataHarness());
63 }
64
65 } // namespace test
OLDNEW
« no previous file with comments | « chrome/browser/translate/cld_data_harness.h ('k') | chrome/browser/translate/cld_data_harness_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698