Commit 815fc2fe authored by David Dorwin's avatar David Dorwin Committed by Commit Bot

[fuchsia] Make fuchsia.memorypressure.Provider disconnects fatal

This service is required.

Bug: 1094035
Change-Id: I9f13d02df4edcaa411b3c32dd9408594b5864586
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2255781
Auto-Submit: David Dorwin <ddorwin@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Commit-Queue: David Dorwin <ddorwin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781935}
parent c2864a25
......@@ -34,9 +34,7 @@ SystemMemoryPressureEvaluatorFuchsia::SystemMemoryPressureEvaluatorFuchsia(
std::unique_ptr<util::MemoryPressureVoter> voter)
: util::SystemMemoryPressureEvaluator(std::move(voter)), binding_(this) {
binding_.set_error_handler([](zx_status_t status) {
// TODO(https://crbug.com/1020698): Update fuchsia.web docs to make this a
// required service, and make this a FATAL log.
ZX_LOG(WARNING, status) << "fuchsia.memorypressure.Provider disconnected.";
ZX_LOG(FATAL, status) << "fuchsia.memorypressure.Provider disconnected";
});
DVLOG(1) << "Registering for memory pressure updates.";
......
......@@ -60,13 +60,18 @@ class SystemMemoryPressureEvaluatorFuchsiaTest
fuchsia::memorypressure::WatcherPtr watcher_;
};
TEST_F(SystemMemoryPressureEvaluatorFuchsiaTest, ProviderUnavailable) {
using SystemMemoryPressureEvaluatorFuchsiaDeathTest =
SystemMemoryPressureEvaluatorFuchsiaTest;
TEST_F(SystemMemoryPressureEvaluatorFuchsiaDeathTest, ProviderUnavailable) {
auto voter = std::make_unique<MockMemoryPressureVoter>();
SystemMemoryPressureEvaluatorFuchsia evaluator(std::move(voter));
// Spin the loop to allow the evaluator to notice that the Provider is not
// available, to verify that that doesn't trigger a fatal failure.
base::RunLoop().RunUntilIdle();
// available and verify that this causes a fatal failure.
ASSERT_DEATH(base::RunLoop().RunUntilIdle(),
"fuchsia\\.memorypressure\\.Provider disconnected: "
"ZX_ERR_PEER_CLOSED \\(-24\\)");
}
TEST_F(SystemMemoryPressureEvaluatorFuchsiaTest, Basic) {
......
......@@ -15,6 +15,7 @@
"fuchsia.intl.PropertyProvider",
"fuchsia.logger.Log",
"fuchsia.logger.LogSink",
"fuchsia.memorypressure.Provider",
"fuchsia.process.Launcher",
"fuchsia.sys.Environment",
"fuchsia.sys.Loader",
......
......@@ -10,3 +10,5 @@ per-file web_engine_browser_interface_binders.*=file://ipc/SECURITY_OWNERS
# For sandbox security review.
per-file context_provider_impl.*=set noparent
per-file context_provider_impl.*=file://fuchsia/SECURITY_OWNERS
per-file *.cmx=set noparent
per-file *.cmx=file://fuchsia/SECURITY_OWNERS
......@@ -13,6 +13,7 @@
"fuchsia.logger.LogSink",
"fuchsia.media.Audio",
"fuchsia.media.SessionAudioConsumerFactory",
"fuchsia.memorypressure.Provider",
"fuchsia.net.NameLookup",
"fuchsia.netstack.Netstack",
"fuchsia.posix.socket.Provider",
......
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