athena: Add a test for split-view controller.
[chromium-blink-merge.git] / cc / test / mock_occlusion_tracker.h
blob649eb7634bde19ce003ca3df26fbf592e66d3d0d
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CC_TEST_MOCK_OCCLUSION_TRACKER_H_
6 #define CC_TEST_MOCK_OCCLUSION_TRACKER_H_
8 #include "cc/trees/occlusion_tracker.h"
10 namespace cc {
12 template <typename LayerType>
13 class MockOcclusionTracker : public OcclusionTracker<LayerType> {
14 // This class is used for testing only. It fakes just enough information to
15 // calculate unoccluded content rect and unoccluded contributing surface
16 // content rect. It calls the helper function of occlusion tracker to avoid
17 // DCHECKs since testing environment won't be set up properly to pass those.
18 public:
19 MockOcclusionTracker()
20 : OcclusionTracker<LayerType>(gfx::Rect(0, 0, 1000, 1000)) {
21 typename OcclusionTracker<LayerType>::StackObject stack_obj;
22 OcclusionTracker<LayerType>::stack_.push_back(stack_obj);
23 OcclusionTracker<LayerType>::stack_.push_back(stack_obj);
26 explicit MockOcclusionTracker(const gfx::Rect& screen_scissor_rect)
27 : OcclusionTracker<LayerType>(screen_scissor_rect) {
28 typename OcclusionTracker<LayerType>::StackObject stack_obj;
29 OcclusionTracker<LayerType>::stack_.push_back(stack_obj);
30 OcclusionTracker<LayerType>::stack_.push_back(stack_obj);
33 void set_occluded_target_rect(const gfx::Rect& occluded) {
34 OcclusionTracker<LayerType>::stack_.back().occlusion_from_inside_target =
35 occluded;
38 void set_occluded_target_rect_for_contributing_surface(
39 const gfx::Rect& occluded) {
40 OcclusionTracker<
41 LayerType>::stack_[OcclusionTracker<LayerType>::stack_.size() - 2]
42 .occlusion_from_inside_target = occluded;
45 private:
46 DISALLOW_COPY_AND_ASSIGN(MockOcclusionTracker);
49 } // namespace cc
51 #endif // CC_TEST_MOCK_OCCLUSION_TRACKER_H_