Commit 481767eb authored by Lukasz Anforowicz's avatar Lukasz Anforowicz Committed by Commit Bot

Speculative fix for flakiness of MemoryPressureLoadsNotAllTabs.

The test flakily crashes with an unknown callstack (the crash is not
reproducible locally).  The speculation is that the crash is related
to dereferencing a null base::MemoryPressureMonitor::Get().  If this is
indeed the case, then the crash should be fixed by using
base::test::FakeMemoryPressureMonitor in the test (rather than directly
dispatching a memory pressure notification from the test).

Bug: 887545
Change-Id: Ib922ebe4c7f85ec028f4bb202f2357c71e20687a
Reviewed-on: https://chromium-review.googlesource.com/1236502Reviewed-by: default avatarChris Hamilton <chrisha@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592913}
parent 049e50ca
......@@ -12,7 +12,7 @@
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
#include "base/memory/memory_pressure_listener.h"
#include "base/memory/fake_memory_pressure_monitor.h"
#include "base/process/launch.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind_test_util.h"
......@@ -149,8 +149,9 @@ class SessionRestoreTest : public InProcessBrowserTest {
Browser* new_browser = window_observer.WaitForSingleNewBrowser();
// Stop loading anything more if we are running out of space.
if (!no_memory_pressure) {
base::MemoryPressureListener::NotifyMemoryPressure(
base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL);
fake_memory_pressure_monitor_.SetAndNotifyMemoryPressure(
base::MemoryPressureMonitor::MemoryPressureLevel::
MEMORY_PRESSURE_LEVEL_CRITICAL);
}
restore_observer.Wait();
......@@ -207,6 +208,9 @@ class SessionRestoreTest : public InProcessBrowserTest {
GURL url3_;
const BrowserList* active_browser_list_;
private:
base::test::FakeMemoryPressureMonitor fake_memory_pressure_monitor_;
};
// SessionRestorePolicy that always allow tabs to load.
......
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