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

Side by Side Diff: cc/layers/texture_layer_impl_unittest.cc

Issue 1057283003: Remove parts of //cc we aren't using (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « cc/layers/texture_layer_impl.cc ('k') | cc/layers/texture_layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "cc/layers/texture_layer_impl.h"
6
7 #include "cc/output/context_provider.h"
8 #include "cc/output/output_surface.h"
9 #include "cc/test/layer_test_common.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace cc {
13 namespace {
14
15 void IgnoreCallback(uint32 sync_point,
16 bool lost,
17 BlockingTaskRunner* main_thread_task_runner) {
18 }
19
20 TEST(TextureLayerImplTest, Occlusion) {
21 gfx::Size layer_size(1000, 1000);
22 gfx::Size viewport_size(1000, 1000);
23
24 LayerTestCommon::LayerImplTest impl;
25
26 gpu::Mailbox mailbox;
27 impl.output_surface()->context_provider()->ContextGL()->GenMailboxCHROMIUM(
28 mailbox.name);
29 TextureMailbox texture_mailbox(mailbox, GL_TEXTURE_2D, 0);
30
31 TextureLayerImpl* texture_layer_impl =
32 impl.AddChildToRoot<TextureLayerImpl>();
33 texture_layer_impl->SetBounds(layer_size);
34 texture_layer_impl->SetContentBounds(layer_size);
35 texture_layer_impl->SetDrawsContent(true);
36 texture_layer_impl->SetTextureMailbox(
37 texture_mailbox,
38 SingleReleaseCallbackImpl::Create(base::Bind(&IgnoreCallback)));
39
40 impl.CalcDrawProps(viewport_size);
41
42 {
43 SCOPED_TRACE("No occlusion");
44 gfx::Rect occluded;
45 impl.AppendQuadsWithOcclusion(texture_layer_impl, occluded);
46
47 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(),
48 gfx::Rect(layer_size));
49 EXPECT_EQ(1u, impl.quad_list().size());
50 }
51
52 {
53 SCOPED_TRACE("Full occlusion");
54 gfx::Rect occluded(texture_layer_impl->visible_content_rect());
55 impl.AppendQuadsWithOcclusion(texture_layer_impl, occluded);
56
57 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect());
58 EXPECT_EQ(impl.quad_list().size(), 0u);
59 }
60
61 {
62 SCOPED_TRACE("Partial occlusion");
63 gfx::Rect occluded(200, 0, 800, 1000);
64 impl.AppendQuadsWithOcclusion(texture_layer_impl, occluded);
65
66 size_t partially_occluded_count = 0;
67 LayerTestCommon::VerifyQuadsAreOccluded(
68 impl.quad_list(), occluded, &partially_occluded_count);
69 // The layer outputs one quad, which is partially occluded.
70 EXPECT_EQ(1u, impl.quad_list().size());
71 EXPECT_EQ(1u, partially_occluded_count);
72 }
73 }
74
75 } // namespace
76 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/texture_layer_impl.cc ('k') | cc/layers/texture_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698