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

Side by Side Diff: cc/layer_tree_host_unittest_scroll.cc

Issue 11662003: cc: Put context-loss tests in layer_tree_host_unittest_context.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 80cols Created 7 years, 11 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_unittest_context.cc ('k') | cc/resource_provider_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
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/layer_tree_host.h" 5 #include "cc/layer_tree_host.h"
6 6
7 #include "cc/content_layer.h" 7 #include "cc/content_layer.h"
8 #include "cc/layer.h" 8 #include "cc/layer.h"
9 #include "cc/layer_impl.h" 9 #include "cc/layer_impl.h"
10 #include "cc/layer_tree_impl.h" 10 #include "cc/layer_tree_impl.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 TEST_F(LayerTreeHostScrollTestFractionalScroll, runMultiThread) 235 TEST_F(LayerTreeHostScrollTestFractionalScroll, runMultiThread)
236 { 236 {
237 runTest(true); 237 runTest(true);
238 } 238 }
239 239
240 class LayerTreeHostScrollTestCaseWithChild : 240 class LayerTreeHostScrollTestCaseWithChild :
241 public LayerTreeHostScrollTest, 241 public LayerTreeHostScrollTest,
242 public WebKit::WebLayerScrollClient { 242 public WebKit::WebLayerScrollClient {
243 public: 243 public:
244 LayerTreeHostScrollTestCaseWithChild( 244 LayerTreeHostScrollTestCaseWithChild()
245 float device_scale_factor, bool scroll_child_layer) 245 : initial_offset_(10, 20),
246 : device_scale_factor_(device_scale_factor),
247 scroll_child_layer_(scroll_child_layer),
248 initial_offset_(10, 20),
249 javascript_scroll_(40, 5), 246 javascript_scroll_(40, 5),
250 scroll_amount_(2, -1), 247 scroll_amount_(2, -1),
251 num_scrolls_(0) { 248 num_scrolls_(0) {
252 } 249 }
253 250
254 virtual void setupTree() OVERRIDE { 251 virtual void setupTree() OVERRIDE {
255 m_layerTreeHost->setDeviceScaleFactor(device_scale_factor_); 252 m_layerTreeHost->setDeviceScaleFactor(device_scale_factor_);
256 253
257 scoped_refptr<Layer> root_layer = Layer::create(); 254 scoped_refptr<Layer> root_layer = Layer::create();
258 root_layer->setBounds(gfx::Size(10, 10)); 255 root_layer->setBounds(gfx::Size(10, 10));
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 EXPECT_EQ(0, num_scrolls_); 426 EXPECT_EQ(0, num_scrolls_);
430 EXPECT_VECTOR_EQ( 427 EXPECT_VECTOR_EQ(
431 javascript_scroll_ + scroll_amount_, 428 javascript_scroll_ + scroll_amount_,
432 final_scroll_offset_); 429 final_scroll_offset_);
433 } else { 430 } else {
434 EXPECT_EQ(2, num_scrolls_); 431 EXPECT_EQ(2, num_scrolls_);
435 EXPECT_VECTOR_EQ(gfx::Vector2d(), final_scroll_offset_); 432 EXPECT_VECTOR_EQ(gfx::Vector2d(), final_scroll_offset_);
436 } 433 }
437 } 434 }
438 435
439 private: 436 protected:
440 float device_scale_factor_; 437 float device_scale_factor_;
441 bool scroll_child_layer_; 438 bool scroll_child_layer_;
439
442 gfx::Vector2d initial_offset_; 440 gfx::Vector2d initial_offset_;
443 gfx::Vector2d javascript_scroll_; 441 gfx::Vector2d javascript_scroll_;
444 gfx::Vector2d scroll_amount_; 442 gfx::Vector2d scroll_amount_;
445 int num_scrolls_; 443 int num_scrolls_;
446 gfx::Vector2d final_scroll_offset_; 444 gfx::Vector2d final_scroll_offset_;
447 445
448 FakeContentLayerClient fake_content_layer_client_; 446 FakeContentLayerClient fake_content_layer_client_;
449 447
450 scoped_refptr<Layer> root_scroll_layer_; 448 scoped_refptr<Layer> root_scroll_layer_;
451 scoped_refptr<Layer> child_layer_; 449 scoped_refptr<Layer> child_layer_;
452 scoped_refptr<Layer> expected_scroll_layer_; 450 scoped_refptr<Layer> expected_scroll_layer_;
453 scoped_refptr<Layer> expected_no_scroll_layer_; 451 scoped_refptr<Layer> expected_no_scroll_layer_;
454 }; 452 };
455 453
456 MULTI_THREAD_TEST_P2(LayerTreeHostScrollTestCaseWithChild, 454 TEST_F(LayerTreeHostScrollTestCaseWithChild, DeviceScaleFactor1_ScrollChild) {
457 DeviceScaleFactor1, 1.0f, 455 device_scale_factor_ = 1.f;
458 ScrollChild, true) 456 scroll_child_layer_ = true;
459 MULTI_THREAD_TEST_P2(LayerTreeHostScrollTestCaseWithChild, 457 runTest(true);
460 DeviceScaleFactor15, 1.5f, 458 }
461 ScrollChild, true) 459
462 MULTI_THREAD_TEST_P2(LayerTreeHostScrollTestCaseWithChild, 460 TEST_F(LayerTreeHostScrollTestCaseWithChild, DeviceScaleFactor15_ScrollChild) {
463 DeviceScaleFactor2, 2.0f, 461 device_scale_factor_ = 1.5f;
464 ScrollChild, true) 462 scroll_child_layer_ = true;
465 MULTI_THREAD_TEST_P2(LayerTreeHostScrollTestCaseWithChild, 463 runTest(true);
466 DeviceScaleFactor1, 1.0f, 464 }
467 ScrollRootScrollLayer, false) 465
468 MULTI_THREAD_TEST_P2(LayerTreeHostScrollTestCaseWithChild, 466 TEST_F(LayerTreeHostScrollTestCaseWithChild, DeviceScaleFactor2_ScrollChild) {
469 DeviceScaleFactor15, 1.5f, 467 device_scale_factor_ = 2.f;
470 ScrollRootScrollLayer, false) 468 scroll_child_layer_ = true;
471 MULTI_THREAD_TEST_P2(LayerTreeHostScrollTestCaseWithChild, 469 runTest(true);
472 DeviceScaleFactor2, 2.0f, 470 }
473 ScrollRootScrollLayer, false) 471
472 TEST_F(LayerTreeHostScrollTestCaseWithChild,
473 DeviceScaleFactor1_ScrollRootScrollLayer) {
474 device_scale_factor_ = 1.f;
475 scroll_child_layer_ = false;
476 runTest(true);
477 }
478
479 TEST_F(LayerTreeHostScrollTestCaseWithChild,
480 DeviceScaleFactor15_ScrollRootScrollLayer) {
481 device_scale_factor_ = 1.5f;
482 scroll_child_layer_ = false;
483 runTest(true);
484 }
485
486 TEST_F(LayerTreeHostScrollTestCaseWithChild,
487 DeviceScaleFactor2_ScrollRootScrollLayer) {
488 device_scale_factor_ = 2.f;
489 scroll_child_layer_ = false;
490 runTest(true);
491 }
474 492
475 } // namespace 493 } // namespace
476 } // namespace cc 494 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host_unittest_context.cc ('k') | cc/resource_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698