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

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

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 years, 9 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/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_pixeltest_masks.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 2455 matching lines...) Expand 10 before | Expand all | Expand 10 after
2466 2466
2467 // TODO(bokan): Convert these tests to create inner and outer viewports. 2467 // TODO(bokan): Convert these tests to create inner and outer viewports.
2468 class LayerTreeHostImplTopControlsTest : public LayerTreeHostImplTest { 2468 class LayerTreeHostImplTopControlsTest : public LayerTreeHostImplTest {
2469 public: 2469 public:
2470 LayerTreeHostImplTopControlsTest() 2470 LayerTreeHostImplTopControlsTest()
2471 // Make the clip size the same as the layer (content) size so the layer is 2471 // Make the clip size the same as the layer (content) size so the layer is
2472 // non-scrollable. 2472 // non-scrollable.
2473 : layer_size_(10, 10), 2473 : layer_size_(10, 10),
2474 clip_size_(layer_size_), 2474 clip_size_(layer_size_),
2475 top_controls_height_(50) { 2475 top_controls_height_(50) {
2476 settings_.calculate_top_controls_position = true;
2477 settings_.use_pinch_virtual_viewport = true; 2476 settings_.use_pinch_virtual_viewport = true;
2478 2477
2479 viewport_size_ = gfx::Size(clip_size_.width(), 2478 viewport_size_ = gfx::Size(clip_size_.width(),
2480 clip_size_.height() + top_controls_height_); 2479 clip_size_.height() + top_controls_height_);
2481 } 2480 }
2482 2481
2483 bool CreateHostImpl(const LayerTreeSettings& settings, 2482 bool CreateHostImpl(const LayerTreeSettings& settings,
2484 scoped_ptr<OutputSurface> output_surface) override { 2483 scoped_ptr<OutputSurface> output_surface) override {
2485 bool init = 2484 bool init =
2486 LayerTreeHostImplTest::CreateHostImpl(settings, output_surface.Pass()); 2485 LayerTreeHostImplTest::CreateHostImpl(settings, output_surface.Pass());
2487 if (init && settings.calculate_top_controls_position) { 2486 if (init) {
2488 host_impl_->active_tree()->set_top_controls_height(top_controls_height_); 2487 host_impl_->active_tree()->set_top_controls_height(top_controls_height_);
2489 host_impl_->active_tree()->SetCurrentTopControlsShownRatio(1.f); 2488 host_impl_->active_tree()->SetCurrentTopControlsShownRatio(1.f);
2490 } 2489 }
2491 return init; 2490 return init;
2492 } 2491 }
2493 2492
2494 void SetupTopControlsAndScrollLayer() { 2493 void SetupTopControlsAndScrollLayer() {
2495 scoped_ptr<LayerImpl> root = 2494 scoped_ptr<LayerImpl> root =
2496 LayerImpl::Create(host_impl_->active_tree(), 1); 2495 LayerImpl::Create(host_impl_->active_tree(), 1);
2497 scoped_ptr<LayerImpl> root_clip = 2496 scoped_ptr<LayerImpl> root_clip =
(...skipping 4921 matching lines...) Expand 10 before | Expand all | Expand 10 after
7419 EXPECT_EQ(0, set_needs_commit_count); 7418 EXPECT_EQ(0, set_needs_commit_count);
7420 EXPECT_EQ(2, set_needs_redraw_count); 7419 EXPECT_EQ(2, set_needs_redraw_count);
7421 EXPECT_EQ(1, forward_to_main_count); 7420 EXPECT_EQ(1, forward_to_main_count);
7422 } 7421 }
7423 } 7422 }
7424 7423
7425 class LayerTreeHostImplWithTopControlsTest : public LayerTreeHostImplTest { 7424 class LayerTreeHostImplWithTopControlsTest : public LayerTreeHostImplTest {
7426 public: 7425 public:
7427 void SetUp() override { 7426 void SetUp() override {
7428 LayerTreeSettings settings = DefaultSettings(); 7427 LayerTreeSettings settings = DefaultSettings();
7429 settings.calculate_top_controls_position = true;
7430 CreateHostImpl(settings, CreateOutputSurface()); 7428 CreateHostImpl(settings, CreateOutputSurface());
7431 host_impl_->active_tree()->set_top_controls_height(top_controls_height_); 7429 host_impl_->active_tree()->set_top_controls_height(top_controls_height_);
7432 host_impl_->sync_tree()->set_top_controls_height(top_controls_height_); 7430 host_impl_->sync_tree()->set_top_controls_height(top_controls_height_);
7433 host_impl_->active_tree()->SetCurrentTopControlsShownRatio(1.f); 7431 host_impl_->active_tree()->SetCurrentTopControlsShownRatio(1.f);
7434 } 7432 }
7435 7433
7436 protected: 7434 protected:
7437 static const int top_controls_height_; 7435 static const int top_controls_height_;
7438 }; 7436 };
7439 7437
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
8448 // surface. 8446 // surface.
8449 EXPECT_EQ(0, num_lost_surfaces_); 8447 EXPECT_EQ(0, num_lost_surfaces_);
8450 host_impl_->DidLoseOutputSurface(); 8448 host_impl_->DidLoseOutputSurface();
8451 EXPECT_EQ(1, num_lost_surfaces_); 8449 EXPECT_EQ(1, num_lost_surfaces_);
8452 host_impl_->DidLoseOutputSurface(); 8450 host_impl_->DidLoseOutputSurface();
8453 EXPECT_LE(1, num_lost_surfaces_); 8451 EXPECT_LE(1, num_lost_surfaces_);
8454 } 8452 }
8455 8453
8456 } // namespace 8454 } // namespace
8457 } // namespace cc 8455 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_pixeltest_masks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698