Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Unified Diff: ui/display/manager/chromeos/test/test_native_display_delegate.cc

Issue 2571543002: Fix use after free for cached_displays_. (Closed)
Patch Set: Add invalidate to tests. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/display/manager/chromeos/test/test_native_display_delegate.cc
diff --git a/ui/display/manager/chromeos/test/test_native_display_delegate.cc b/ui/display/manager/chromeos/test/test_native_display_delegate.cc
index 060dec2dfbfa599e82a082575e51ac14f295b957..9cd1bda4897fafa58aa03009d95a64112241aec9 100644
--- a/ui/display/manager/chromeos/test/test_native_display_delegate.cc
+++ b/ui/display/manager/chromeos/test/test_native_display_delegate.cc
@@ -10,6 +10,7 @@
#include "base/threading/thread_task_runner_handle.h"
#include "ui/display/manager/chromeos/test/action_logger.h"
#include "ui/display/types/display_mode.h"
+#include "ui/display/types/native_display_observer.h"
namespace ui {
namespace test {
@@ -62,6 +63,10 @@ void TestNativeDisplayDelegate::ForceDPMSOn() {
void TestNativeDisplayDelegate::GetDisplays(
const GetDisplaysCallback& callback) {
+ // This mimics the behavior of Ozone DRM when new display state arrives.
+ for (NativeDisplayObserver& observer : observers_)
+ observer.OnDisplaySnapshotsInvalidated();
+
if (run_async_) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(callback, outputs_));
@@ -144,10 +149,14 @@ bool TestNativeDisplayDelegate::SetColorCorrection(
return true;
}
-void TestNativeDisplayDelegate::AddObserver(NativeDisplayObserver* observer) {}
+void TestNativeDisplayDelegate::AddObserver(NativeDisplayObserver* observer) {
+ observers_.AddObserver(observer);
+}
void TestNativeDisplayDelegate::RemoveObserver(
- NativeDisplayObserver* observer) {}
+ NativeDisplayObserver* observer) {
+ observers_.RemoveObserver(observer);
+}
display::FakeDisplayController*
TestNativeDisplayDelegate::GetFakeDisplayController() {
« no previous file with comments | « ui/display/manager/chromeos/test/test_native_display_delegate.h ('k') | ui/display/types/native_display_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698