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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 1412663005: Introduce painted-device-scale-factor and use it when --enable-use-zoom-for-dsf is specified. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index e75b3e9a2ba4a0324fee2176942bc83c2080f5a7..1c7c270bb1d7635e1be089cdd75adcde98acc86e 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -6378,5 +6378,43 @@ class LayerTreeHostTestDestroyWhileInitializingOutputSurface
MULTI_THREAD_TEST_F(LayerTreeHostTestDestroyWhileInitializingOutputSurface);
+class LayerTreeHostTestPaintedDeviceScaleFactor : public LayerTreeHostTest {
oshima 2015/10/22 21:47:42 danakj@, I'm not sure if this is right place, way
+ class PaintedScaleSwapPromise : public SwapPromise {
+ public:
+ PaintedScaleSwapPromise() {}
+ ~PaintedScaleSwapPromise() override {}
+ void DidActivate() override {}
+ void DidSwap(CompositorFrameMetadata* metadata) override {
+ EXPECT_EQ(2.0f, metadata->device_scale_factor);
+ }
+ void DidNotSwap(DidNotSwapReason reason) override {}
+ int64 TraceId() const override { return 0; }
+ };
+
+ protected:
+ void BeginTest() override {
+ layer_tree_host()->SetPaintedDeviceScaleFactor(2.0f);
+ ASSERT_EQ(1.0f, layer_tree_host()->device_scale_factor());
danakj 2015/10/22 23:15:29 EXPECT_EQ
oshima 2015/10/23 18:05:36 Done.
+ PostSetNextCommitForcesRedrawToMainThread();
danakj 2015/10/22 23:15:29 not needed, we'll draw the first frame
oshima 2015/10/23 18:05:36 Done.
+ PostSetNeedsCommitToMainThread();
+ }
+
+ void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
+ int frame = host_impl->active_tree()->source_frame_number();
+ if (frame == -1) {
+ host_impl->active_tree()->QueuePinnedSwapPromise(
+ make_scoped_ptr(new PaintedScaleSwapPromise()));
+ }
+ }
+
+ void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override {
danakj 2015/10/22 23:15:29 Can you just use https://code.google.com/p/chromiu
oshima 2015/10/23 18:05:36 Thanks, I'll look into it.
oshima 2015/10/23 22:05:02 Actually I could just check the last frame here. L
+ EndTest();
+ }
+
+ void AfterTest() override {}
+};
+
+MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor);
+
} // namespace
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698