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

Side by Side Diff: cc/layer_tree_host_unittest_delegated.cc

Issue 12328118: cc: DelegatedRendererLayer creates a ChildId with the ResourceProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/test/layer_tree_test_common.h » ('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 2013 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/layer_tree_host.h"
6
7 #include "cc/delegated_renderer_layer.h"
8 #include "cc/delegated_renderer_layer_impl.h"
9 #include "cc/layer_tree_impl.h"
10 #include "cc/test/layer_tree_test_common.h"
11 #include "gpu/GLES2/gl2extchromium.h"
12
13 namespace cc {
14 namespace {
15
16 // These tests deal with delegated renderer layers.
17 class LayerTreeHostDelegatedTest : public ThreadedTest {};
18
19 class LayerTreeHostDelegatedTestCreateChildId
20 : public LayerTreeHostDelegatedTest {
21 public:
22 virtual void setupTree() OVERRIDE {
23 root_ = Layer::create();
24 root_->setBounds(gfx::Size(10, 10));
25
26 delegated_ = DelegatedRendererLayer::Create();
27 delegated_->setBounds(gfx::Size(10, 10));
28 delegated_->setIsDrawable(true);
29
30 root_->addChild(delegated_);
31 m_layerTreeHost->setRootLayer(root_);
32 LayerTreeHostDelegatedTest::setupTree();
33 }
34
35 virtual void beginTest() OVERRIDE {
36 num_activates_ = 0;
37 did_reset_child_id_ = false;
38 postSetNeedsCommitToMainThread();
39 }
40
41 virtual void treeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
42 LayerImpl* root_impl = host_impl->activeTree()->RootLayer();
43 DelegatedRendererLayerImpl* delegated_impl =
44 static_cast<DelegatedRendererLayerImpl*>(root_impl->children()[0]);
45
46 ++num_activates_;
47 switch(num_activates_) {
48 case 1:
49 EXPECT_TRUE(delegated_impl->child_id());
50 EXPECT_FALSE(did_reset_child_id_);
51
52 host_impl->resourceProvider()->graphicsContext3D()->loseContextCHROMIUM(
53 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB);
54 break;
55 case 2:
56 EXPECT_TRUE(delegated_impl->child_id());
57 EXPECT_TRUE(did_reset_child_id_);
58 endTest();
59 break;
60 }
61 }
62
63 virtual void initializedRendererOnThread(LayerTreeHostImpl* host_impl,
64 bool success) OVERRIDE {
65 EXPECT_TRUE(success);
66
67 if (!num_activates_)
68 return;
69
70 LayerImpl* root_impl = host_impl->activeTree()->RootLayer();
71 DelegatedRendererLayerImpl* delegated_impl =
72 static_cast<DelegatedRendererLayerImpl*>(root_impl->children()[0]);
73
74 EXPECT_EQ(1, num_activates_);
75 EXPECT_FALSE(delegated_impl->child_id());
76 did_reset_child_id_ = true;
77 }
78
79 virtual void afterTest() OVERRIDE {}
80
81 protected:
82 int num_activates_;
83 bool did_reset_child_id_;
84 scoped_refptr<Layer> root_;
85 scoped_refptr<DelegatedRendererLayer> delegated_;
86 };
87
88 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCreateChildId)
89
90 } // namespace
91 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/test/layer_tree_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698