OLD | NEW |
---|---|
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 6360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6371 // that this works correctly and the output surface is destroyed on | 6371 // that this works correctly and the output surface is destroyed on |
6372 // the correct thread. | 6372 // the correct thread. |
6373 EndTest(); | 6373 EndTest(); |
6374 } | 6374 } |
6375 | 6375 |
6376 void AfterTest() override {} | 6376 void AfterTest() override {} |
6377 }; | 6377 }; |
6378 | 6378 |
6379 MULTI_THREAD_TEST_F(LayerTreeHostTestDestroyWhileInitializingOutputSurface); | 6379 MULTI_THREAD_TEST_F(LayerTreeHostTestDestroyWhileInitializingOutputSurface); |
6380 | 6380 |
6381 class LayerTreeHostTestPaintedDeviceScaleFactor : public LayerTreeHostTest { | |
6382 class PaintedScaleSwapPromise : public SwapPromise { | |
6383 public: | |
6384 PaintedScaleSwapPromise() {} | |
6385 ~PaintedScaleSwapPromise() override {} | |
6386 void DidActivate() override {} | |
6387 void DidSwap(CompositorFrameMetadata* metadata) override { | |
6388 EXPECT_EQ(2.0f, metadata->device_scale_factor); | |
enne (OOO)
2015/10/23 21:21:25
Maybe include a device scale factor on the composi
oshima
2015/10/23 22:05:02
I added additional check in SwapBuffersOnThread.
| |
6389 } | |
6390 void DidNotSwap(DidNotSwapReason reason) override {} | |
6391 int64 TraceId() const override { return 0; } | |
6392 }; | |
6393 | |
6394 protected: | |
6395 void BeginTest() override { | |
6396 layer_tree_host()->SetPaintedDeviceScaleFactor(2.0f); | |
6397 EXPECT_EQ(1.0f, layer_tree_host()->device_scale_factor()); | |
6398 PostSetNeedsCommitToMainThread(); | |
6399 } | |
6400 | |
6401 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | |
6402 int frame = host_impl->active_tree()->source_frame_number(); | |
6403 if (frame == -1) { | |
6404 host_impl->active_tree()->QueuePinnedSwapPromise( | |
6405 make_scoped_ptr(new PaintedScaleSwapPromise())); | |
6406 } | |
6407 } | |
6408 | |
6409 void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override { | |
6410 EndTest(); | |
6411 } | |
6412 | |
6413 void AfterTest() override {} | |
6414 }; | |
6415 | |
6416 MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); | |
6417 | |
6381 } // namespace | 6418 } // namespace |
6382 } // namespace cc | 6419 } // namespace cc |
OLD | NEW |