Commit 551fb984 authored by Charles Harrison's avatar Charles Harrison Committed by Commit Bot

[oom] Add debug logs to EXPECT to root-cause flakes

After looking through the code, it seems the only thing that could
be going wrong here is |app_state| not thinking we have running
activities during the unit test.

This CL will let us figure out if app_state is the member at fault here,
and hopefully what to do about it.

Bug: 819592
Change-Id: I3f43b3b7ec5dab8c7c5e6ca0b4fa9f2967e4ea9f
Reviewed-on: https://chromium-review.googlesource.com/958190Reviewed-by: default avatarSiddhartha S <ssid@chromium.org>
Commit-Queue: Charlie Harrison <csharrison@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542621}
parent caef6e1e
......@@ -55,21 +55,22 @@ class CrashDumpWaiter : public breakpad::CrashDumpManager::Observer {
// Waits for the crash dump notification and returns whether the crash was
// considered a foreground oom.
bool Wait() {
const breakpad::CrashDumpManager::CrashDumpDetails& Wait() {
waiter_.Run();
return last_crash_was_oom_.value();
return last_crash_details_.value();
}
private:
// CrashDumpManager::Observer:
void OnCrashDumpProcessed(
const breakpad::CrashDumpManager::CrashDumpDetails& details) override {
last_crash_was_oom_ = breakpad::CrashDumpManager::IsForegroundOom(details);
last_crash_details_ = details;
waiter_.Quit();
}
base::RunLoop waiter_;
base::Optional<bool> last_crash_was_oom_;
base::Optional<breakpad::CrashDumpManager::CrashDumpDetails>
last_crash_details_;
DISALLOW_COPY_AND_ASSIGN(CrashDumpWaiter);
};
#endif // defined(OS_ANDROID)
......@@ -139,8 +140,13 @@ class OutOfMemoryReporterTest : public ChromeRenderViewHostTestHarness,
#if defined(OS_ANDROID)
CrashDumpWaiter crash_waiter;
std::move(crash_closure).Run();
bool was_oom = crash_waiter.Wait();
EXPECT_EQ(expect_oom, was_oom);
const breakpad::CrashDumpManager::CrashDumpDetails& details =
crash_waiter.Wait();
EXPECT_EQ(expect_oom, breakpad::CrashDumpManager::IsForegroundOom(details))
<< "process_type: " << details.process_type
<< " termination_status: " << details.termination_status
<< " file_size: " << details.file_size
<< " app_state: " << details.app_state;
// Since the observer list is not ordered, it isn't guaranteed that the
// OutOfMemoryReporter will be notified at this point. Flush the current
......
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