| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/heads_up_display_layer.h" | 5 #include "cc/heads_up_display_layer.h" |
| 6 #include "cc/layer.h" | 6 #include "cc/layer.h" |
| 7 #include "cc/layer_tree_host.h" | 7 #include "cc/layer_tree_host.h" |
| 8 #include "cc/test/layer_tree_test_common.h" | 8 #include "cc/test/layer_tree_test_common.h" |
| 9 | 9 |
| 10 namespace cc { | 10 namespace cc { |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 class HeadsUpDisplayTest : public ThreadedTest { | 13 class HeadsUpDisplayTest : public ThreadedTest { |
| 14 protected: | 14 protected: |
| 15 virtual void initializeSettings(LayerTreeSettings& settings) OVERRIDE | 15 virtual void initializeSettings(LayerTreeSettings& settings) OVERRIDE |
| 16 { | 16 { |
| 17 // Enable the HUD without requiring text. | 17 // Enable the HUD without requiring text. |
| 18 settings.initialDebugState.showPropertyChangedRects = true; | 18 settings.initialDebugState.showPropertyChangedRects = true; |
| 19 } | 19 } |
| 20 }; | 20 }; |
| 21 | 21 |
| 22 class DrawsContentLayer : public Layer { | 22 class DrawsContentLayer : public Layer { |
| 23 public: | 23 public: |
| 24 static scoped_refptr<DrawsContentLayer> create() { return make_scoped_refptr
(new DrawsContentLayer()); } | 24 static scoped_refptr<DrawsContentLayer> Create() { return make_scoped_refptr
(new DrawsContentLayer()); } |
| 25 virtual bool drawsContent() const OVERRIDE { return true; } | 25 virtual bool DrawsContent() const OVERRIDE { return true; } |
| 26 | 26 |
| 27 private: | 27 private: |
| 28 DrawsContentLayer() : Layer() { } | 28 DrawsContentLayer() : Layer() { } |
| 29 virtual ~DrawsContentLayer() | 29 virtual ~DrawsContentLayer() |
| 30 { | 30 { |
| 31 } | 31 } |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 class HudWithRootLayerChange : public HeadsUpDisplayTest { | 34 class HudWithRootLayerChange : public HeadsUpDisplayTest { |
| 35 public: | 35 public: |
| 36 HudWithRootLayerChange() | 36 HudWithRootLayerChange() |
| 37 : m_rootLayer1(DrawsContentLayer::create()) | 37 : m_rootLayer1(DrawsContentLayer::Create()) |
| 38 , m_rootLayer2(DrawsContentLayer::create()) | 38 , m_rootLayer2(DrawsContentLayer::Create()) |
| 39 , m_numCommits(0) | 39 , m_numCommits(0) |
| 40 { | 40 { |
| 41 } | 41 } |
| 42 | 42 |
| 43 virtual void beginTest() OVERRIDE | 43 virtual void beginTest() OVERRIDE |
| 44 { | 44 { |
| 45 m_rootLayer1->setBounds(gfx::Size(30, 30)); | 45 m_rootLayer1->SetBounds(gfx::Size(30, 30)); |
| 46 m_rootLayer2->setBounds(gfx::Size(30, 30)); | 46 m_rootLayer2->SetBounds(gfx::Size(30, 30)); |
| 47 | 47 |
| 48 postSetNeedsCommitToMainThread(); | 48 postSetNeedsCommitToMainThread(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 virtual void didCommit() OVERRIDE | 51 virtual void didCommit() OVERRIDE |
| 52 { | 52 { |
| 53 ++m_numCommits; | 53 ++m_numCommits; |
| 54 | 54 |
| 55 ASSERT_TRUE(m_layerTreeHost->hudLayer()); | 55 ASSERT_TRUE(m_layerTreeHost->hudLayer()); |
| 56 | 56 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 int m_numCommits; | 101 int m_numCommits; |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 TEST_F(HudWithRootLayerChange, runMultiThread) | 104 TEST_F(HudWithRootLayerChange, runMultiThread) |
| 105 { | 105 { |
| 106 runTest(true); | 106 runTest(true); |
| 107 } | 107 } |
| 108 | 108 |
| 109 } // namespace | 109 } // namespace |
| 110 } // namespace cc | 110 } // namespace cc |
| OLD | NEW |