Fix unittest key path in Brillo.
The unittests weren't able to find the keys if it's not run from the
update_engine_unittests directory.
Test: /data/nativetest/update_engine_unittests/update_engine_unittests
Bug: 26955860
Change-Id: I4c189cca2714986d3d2b2669b54a5dff9a488964
diff --git a/common/http_fetcher_unittest.cc b/common/http_fetcher_unittest.cc
index 0d4b5da..e287103 100644
--- a/common/http_fetcher_unittest.cc
+++ b/common/http_fetcher_unittest.cc
@@ -117,9 +117,7 @@
// Spawn the server process.
unique_ptr<brillo::Process> http_server(new brillo::ProcessImpl());
- base::FilePath test_server_path =
- test_utils::GetBuildArtifactsPath().Append("test_http_server");
- http_server->AddArg(test_server_path.value());
+ http_server->AddArg(test_utils::GetBuildArtifactsPath("test_http_server"));
http_server->RedirectUsingPipe(STDOUT_FILENO, false);
if (!http_server->Start()) {
diff --git a/common/test_utils.cc b/common/test_utils.cc
index 2de8ced..13ce6f9 100644
--- a/common/test_utils.cc
+++ b/common/test_utils.cc
@@ -263,5 +263,9 @@
return exe_path.DirName();
}
+string GetBuildArtifactsPath(const string& relative_path) {
+ return GetBuildArtifactsPath().Append(relative_path).value();
+}
+
} // namespace test_utils
} // namespace chromeos_update_engine
diff --git a/common/test_utils.h b/common/test_utils.h
index e4919d8..952cbea 100644
--- a/common/test_utils.h
+++ b/common/test_utils.h
@@ -190,6 +190,8 @@
// Returns the path where the build artifacts are stored. This is the directory
// where the unittest executable is being run from.
base::FilePath GetBuildArtifactsPath();
+// Returns the path of the build artifact specified in |relative_path|.
+std::string GetBuildArtifactsPath(const std::string& relative_path);
} // namespace test_utils