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

Unified Diff: content/browser/renderer_host/compositor_resize_lock_unittest.cc

Issue 2790623003: ui: Rework CompositorResizeLock interaction with DelegatedFrameHost (Closed)
Patch Set: shouldskip: allowskipafterframe Created 3 years, 8 months 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: content/browser/renderer_host/compositor_resize_lock_unittest.cc
diff --git a/content/browser/renderer_host/compositor_resize_lock_unittest.cc b/content/browser/renderer_host/compositor_resize_lock_unittest.cc
index 6d3468f1bf9602736dfd202956715a2da8f466f0..5199b3db716014f2f21aee8dd909eb3ea06e0fa2 100644
--- a/content/browser/renderer_host/compositor_resize_lock_unittest.cc
+++ b/content/browser/renderer_host/compositor_resize_lock_unittest.cc
@@ -4,6 +4,8 @@
#include "content/browser/renderer_host/compositor_resize_lock.h"
+#include "base/bind.h"
+#include "base/callback.h"
#include "base/memory/ptr_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/compositor/test/fake_compositor_lock.h"
@@ -129,5 +131,45 @@ TEST(CompositorResizeLockTest, EndAfterTimeout) {
}
}
+class CallbackClient : public FakeCompositorResizeLockClient {
+ public:
+ CallbackClient() = default;
+
+ void CompositorResizeLockEnded() override {
+ std::move(resize_lock_ended_).Run();
+ }
+
+ void set_resize_lock_ended(base::OnceClosure c) {
+ resize_lock_ended_ = std::move(c);
+ }
+
+ private:
+ base::OnceClosure resize_lock_ended_;
+};
+
+TEST(CompositorResizeLockTest, TimeoutSetBeforeClientTold) {
+ CallbackClient resize_client;
+ gfx::Size resize_to(10, 11);
+
+ {
+ CompositorResizeLock resize_lock(&resize_client, resize_to);
+ resize_lock.Lock();
+
+ // When the resize lock times out, it should report that before telling
+ // the client about that.
+ bool saw_resize_lock_end = false;
+ auto resize_lock_ended = [](CompositorResizeLock* resize_lock, bool* saw) {
+ EXPECT_TRUE(resize_lock->timed_out());
+ *saw = true;
+ };
+ resize_client.set_resize_lock_ended(
+ base::BindOnce(resize_lock_ended, &resize_lock, &saw_resize_lock_end));
+
+ // A timeout tells the client that the lock ended.
+ resize_client.CauseTimeout();
+ EXPECT_TRUE(saw_resize_lock_end);
+ }
+}
+
} // namespace
} // namespace content
« no previous file with comments | « content/browser/renderer_host/compositor_resize_lock.cc ('k') | content/browser/renderer_host/delegated_frame_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698