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

Side by Side Diff: cc/trees/layer_tree_host_unittest_delegated.cc

Issue 16871016: cc: Use BeginFrameArgs (Closed) Base URL: http://git.chromium.org/chromium/src.git@bfargs2
Patch Set: StateMachine test working; Reworked readback. Created 7 years, 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 "cc/layers/delegated_renderer_layer.h" 7 #include "cc/layers/delegated_renderer_layer.h"
8 #include "cc/layers/delegated_renderer_layer_client.h" 8 #include "cc/layers/delegated_renderer_layer_client.h"
9 #include "cc/layers/delegated_renderer_layer_impl.h" 9 #include "cc/layers/delegated_renderer_layer_impl.h"
10 #include "cc/output/delegated_frame_data.h" 10 #include "cc/output/delegated_frame_data.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { 148 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
149 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); 149 LayerImpl* root_impl = host_impl->active_tree()->root_layer();
150 FakeDelegatedRendererLayerImpl* delegated_impl = 150 FakeDelegatedRendererLayerImpl* delegated_impl =
151 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); 151 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
152 152
153 WebKit::WebGraphicsContext3D* context = 153 WebKit::WebGraphicsContext3D* context =
154 host_impl->resource_provider()->GraphicsContext3D(); 154 host_impl->resource_provider()->GraphicsContext3D();
155 155
156 ++num_activates_; 156 ++num_activates_;
157 switch (num_activates_) { 157 if (num_activates_ == 2) {
158 case 2:
159 EXPECT_TRUE(delegated_impl->ChildId()); 158 EXPECT_TRUE(delegated_impl->ChildId());
160 EXPECT_FALSE(did_reset_child_id_); 159 EXPECT_FALSE(did_reset_child_id_);
161 160
162 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, 161 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
163 GL_INNOCENT_CONTEXT_RESET_ARB); 162 GL_INNOCENT_CONTEXT_RESET_ARB);
164 break; 163 } else if (did_reset_child_id_) {
165 case 3:
166 EXPECT_TRUE(delegated_impl->ChildId()); 164 EXPECT_TRUE(delegated_impl->ChildId());
167 EXPECT_TRUE(did_reset_child_id_);
168 EndTest(); 165 EndTest();
169 break;
170 } 166 }
171 } 167 }
172 168
173 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, 169 virtual void InitializedRendererOnThread(LayerTreeHostImpl* host_impl,
174 bool success) OVERRIDE { 170 bool success) OVERRIDE {
175 EXPECT_TRUE(success); 171 EXPECT_TRUE(success);
176 172
177 if (num_activates_ < 2) 173 if (num_activates_ < 2)
178 return; 174 return;
179 175
180 LayerImpl* root_impl = host_impl->active_tree()->root_layer(); 176 LayerImpl* root_impl = host_impl->active_tree()->root_layer();
181 FakeDelegatedRendererLayerImpl* delegated_impl = 177 FakeDelegatedRendererLayerImpl* delegated_impl =
182 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); 178 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
183 179
184 EXPECT_EQ(2, num_activates_); 180 EXPECT_LE(2, num_activates_);
185 EXPECT_FALSE(delegated_impl->ChildId()); 181 EXPECT_FALSE(delegated_impl->ChildId());
186 did_reset_child_id_ = true; 182 did_reset_child_id_ = true;
187 } 183 }
188 184
189 virtual void AfterTest() OVERRIDE {} 185 virtual void AfterTest() OVERRIDE {}
190 186
191 protected: 187 protected:
192 int num_activates_; 188 int num_activates_;
193 bool did_reset_child_id_; 189 bool did_reset_child_id_;
194 }; 190 };
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 } 1283 }
1288 } 1284 }
1289 1285
1290 virtual void AfterTest() OVERRIDE {} 1286 virtual void AfterTest() OVERRIDE {}
1291 }; 1287 };
1292 1288
1293 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCommitWithoutTake); 1289 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCommitWithoutTake);
1294 1290
1295 } // namespace 1291 } // namespace
1296 } // namespace cc 1292 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698