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 { | |
oshima
2015/10/22 21:47:42
danakj@, I'm not sure if this is right place, way
| |
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); | |
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 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.
| |
6398 PostSetNextCommitForcesRedrawToMainThread(); | |
danakj
2015/10/22 23:15:29
not needed, we'll draw the first frame
oshima
2015/10/23 18:05:36
Done.
| |
6399 PostSetNeedsCommitToMainThread(); | |
6400 } | |
6401 | |
6402 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | |
6403 int frame = host_impl->active_tree()->source_frame_number(); | |
6404 if (frame == -1) { | |
6405 host_impl->active_tree()->QueuePinnedSwapPromise( | |
6406 make_scoped_ptr(new PaintedScaleSwapPromise())); | |
6407 } | |
6408 } | |
6409 | |
6410 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
| |
6411 EndTest(); | |
6412 } | |
6413 | |
6414 void AfterTest() override {} | |
6415 }; | |
6416 | |
6417 MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); | |
6418 | |
6381 } // namespace | 6419 } // namespace |
6382 } // namespace cc | 6420 } // namespace cc |
OLD | NEW |