| Index: components/safe_browsing_db/prefix_set_unittest.cc
|
| diff --git a/chrome/browser/safe_browsing/prefix_set_unittest.cc b/components/safe_browsing_db/prefix_set_unittest.cc
|
| similarity index 97%
|
| rename from chrome/browser/safe_browsing/prefix_set_unittest.cc
|
| rename to components/safe_browsing_db/prefix_set_unittest.cc
|
| index c858e3bf9e5a4949fb0653783056b78d90a0c98b..b980e716e3bb95721629a28975d6f95e4aa25c07 100644
|
| --- a/chrome/browser/safe_browsing/prefix_set_unittest.cc
|
| +++ b/components/safe_browsing_db/prefix_set_unittest.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 "chrome/browser/safe_browsing/prefix_set.h"
|
| +#include "components/safe_browsing_db/prefix_set.h"
|
|
|
| #include <algorithm>
|
| #include <iterator>
|
| @@ -19,7 +19,7 @@
|
| #include "base/rand_util.h"
|
| #include "base/strings/string_number_conversions.h"
|
| #include "base/strings/string_util.h"
|
| -#include "chrome/common/chrome_paths.h"
|
| +#include "components/safe_browsing_db/safe_browsing_db_util.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "testing/platform_test.h"
|
|
|
| @@ -176,14 +176,20 @@ class PrefixSetTest : public PlatformTest {
|
| ASSERT_EQ(new_size_64, size_64);
|
| }
|
|
|
| + base::FilePath TestFilePath() {
|
| + base::FilePath path;
|
| + PathService::Get(base::DIR_SOURCE_ROOT, &path);
|
| + return path.AppendASCII("components")
|
| + .AppendASCII("test")
|
| + .AppendASCII("data")
|
| + .AppendASCII("SafeBrowsingDb");
|
| + }
|
| +
|
| // Fill |prefixes| with values read from a reference file. The reference file
|
| // was generated from a specific |shared_prefixes_|.
|
| bool ReadReferencePrefixes(std::vector<SBPrefix>* prefixes) {
|
| const char kRefname[] = "PrefixSetRef";
|
| - base::FilePath ref_path;
|
| - if (!PathService::Get(chrome::DIR_TEST_DATA, &ref_path))
|
| - return false;
|
| - ref_path = ref_path.AppendASCII("SafeBrowsing");
|
| + base::FilePath ref_path = TestFilePath();
|
| ref_path = ref_path.AppendASCII(kRefname);
|
|
|
| base::ScopedFILE file(base::OpenFile(ref_path, "r"));
|
| @@ -685,9 +691,7 @@ TEST_F(PrefixSetTest, Version2) {
|
| ASSERT_TRUE(ReadReferencePrefixes(&ref_prefixes));
|
|
|
| const char kBasename[] = "PrefixSetVersion2";
|
| - base::FilePath golden_path;
|
| - ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &golden_path));
|
| - golden_path = golden_path.AppendASCII("SafeBrowsing");
|
| + base::FilePath golden_path = TestFilePath();
|
| golden_path = golden_path.AppendASCII(kBasename);
|
|
|
| scoped_ptr<const PrefixSet> prefix_set(PrefixSet::LoadFile(golden_path));
|
| @@ -704,9 +708,7 @@ TEST_F(PrefixSetTest, Version3) {
|
| ASSERT_TRUE(ReadReferencePrefixes(&ref_prefixes));
|
|
|
| const char kBasename[] = "PrefixSetVersion3";
|
| - base::FilePath golden_path;
|
| - ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &golden_path));
|
| - golden_path = golden_path.AppendASCII("SafeBrowsing");
|
| + base::FilePath golden_path = TestFilePath();
|
| golden_path = golden_path.AppendASCII(kBasename);
|
|
|
| scoped_ptr<const PrefixSet> prefix_set(PrefixSet::LoadFile(golden_path));
|
|
|