Commit eeb2d080 authored by Maksim Ivanov's avatar Maksim Ivanov Committed by Commit Bot

Error log from PathService::CheckedGet

Log the error details, including the key, when crashing in
base::PathService::CheckedGet().

Bug: none
Change-Id: I69386d92cc335c82012a247c9cef255d8fefea57
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2291150Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Maksim Ivanov <emaxx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789657}
parent 4b773ef1
......@@ -15,6 +15,7 @@
#include "base/check_op.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/synchronization/lock.h"
#include "build/build_config.h"
......@@ -231,7 +232,7 @@ bool PathService::Get(int key, FilePath* result) {
FilePath PathService::CheckedGet(int key) {
FilePath path;
CHECK(Get(key, &path));
LOG_IF(FATAL, !Get(key, &path)) << "Failed to get the path for " << key;
return path;
}
......
......@@ -157,7 +157,7 @@ TEST_F(PathServiceTest, CheckedGetFailure) {
constexpr int kBadKey = PATH_END;
FilePath path;
EXPECT_FALSE(PathService::Get(kBadKey, &path));
EXPECT_CHECK_DEATH(PathService::CheckedGet(kBadKey));
EXPECT_DEATH(PathService::CheckedGet(kBadKey), "Failed to get the path");
}
#endif // GTEST_HAS_DEATH_TEST
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment