Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / translate / cld_data_harness.cc
blob1a3a7f3eb1864aaca71f1aa384aaee20d27140f9
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.
5 #include "chrome/browser/translate/cld_data_harness.h"
7 #include "base/lazy_instance.h"
8 #include "base/path_service.h"
9 #include "chrome/browser/translate/component_cld_data_harness.h"
10 #include "chrome/browser/translate/standalone_cld_data_harness.h"
11 #include "chrome/common/chrome_paths.h"
12 #include "components/translate/content/common/cld_data_source.h"
13 #include "testing/gtest/include/gtest/gtest.h"
15 namespace {
16 // This constant yields the version of the CRX that has been extracted into
17 // the test data directory, and must be kept in sync with what is there.
18 // A reciprocal comment has been placed in
19 // chrome/test/data/cld2_component/README.chromium; don't update one without
20 // updating the other.
21 const base::FilePath::CharType kCrxVersion[] = FILE_PATH_LITERAL("160");
23 class StaticCldDataHarness : public test::CldDataHarness {
24 public:
25 StaticCldDataHarness() {}
26 ~StaticCldDataHarness() override {};
27 void Init() override {
28 translate::CldDataSource::Set(
29 translate::CldDataSource::GetStaticDataSource());
31 private:
32 DISALLOW_COPY_AND_ASSIGN(StaticCldDataHarness);
35 } // namespace
37 namespace test {
39 const base::FilePath::CharType* CldDataHarness::GetTestDataSourceCrxVersion() {
40 return kCrxVersion;
43 void CldDataHarness::GetTestDataSourceDirectory(base::FilePath* out_path) {
44 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, out_path));
45 *out_path =
46 out_path->Append(FILE_PATH_LITERAL("cld2_component")).Append(kCrxVersion);
49 // static
50 scoped_ptr<CldDataHarness>
51 CldDataHarness::CreateStaticDataHarness() {
52 return scoped_ptr<CldDataHarness>(new StaticCldDataHarness());
55 // static
56 scoped_ptr<CldDataHarness>
57 CldDataHarness::CreateStandaloneDataHarness() {
58 return scoped_ptr<CldDataHarness>(new StandaloneCldDataHarness());
61 // static
62 scoped_ptr<CldDataHarness>
63 CldDataHarness::CreateComponentDataHarness() {
64 return scoped_ptr<CldDataHarness>(new ComponentCldDataHarness());
67 } // namespace test