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

Side by Side Diff: cc/resources/picture_layer_tiling_unittest.cc

Issue 441033002: cc: Clear tile priorities when tiling is reset. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update Created 6 years, 4 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/resources/picture_layer_tiling.cc ('k') | no next file » | 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/resources/picture_layer_tiling.h" 5 #include "cc/resources/picture_layer_tiling.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <set> 8 #include <set>
9 9
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 1859
1860 priority = tiling->TileAt(0, 1)->priority(ACTIVE_TREE); 1860 priority = tiling->TileAt(0, 1)->priority(ACTIVE_TREE);
1861 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); 1861 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible);
1862 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); 1862 EXPECT_EQ(TilePriority::NOW, priority.priority_bin);
1863 1863
1864 priority = tiling->TileAt(1, 0)->priority(ACTIVE_TREE); 1864 priority = tiling->TileAt(1, 0)->priority(ACTIVE_TREE);
1865 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); 1865 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible);
1866 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); 1866 EXPECT_EQ(TilePriority::NOW, priority.priority_bin);
1867 } 1867 }
1868 1868
1869 TEST(PictureLayerTilingTest, ResetClearsPriorities) {
1870 FakePictureLayerTilingClient client;
1871 scoped_ptr<TestablePictureLayerTiling> tiling;
1872
1873 client.SetTileSize(gfx::Size(100, 100));
1874 client.set_tree(ACTIVE_TREE);
1875 tiling = TestablePictureLayerTiling::Create(1.0f, // contents_scale
1876 gfx::Size(100, 100),
1877 &client);
1878 tiling->UpdateTilePriorities(ACTIVE_TREE,
1879 gfx::Rect(0, 0, 100, 100),
1880 1.0f,
1881 1.0f,
1882 NULL, // occlusion tracker
1883 NULL, // render target
1884 gfx::Transform()); // draw transform
1885
1886 std::vector<scoped_refptr<Tile> > tiles = tiling->AllRefTilesForTesting();
1887 ASSERT_GT(tiles.size(), 0u);
1888 for (std::vector<scoped_refptr<Tile> >::const_iterator it = tiles.begin();
1889 it != tiles.end();
1890 ++it) {
1891 EXPECT_NE(TilePriority(), (*it)->priority(ACTIVE_TREE));
1892 }
1893
1894 tiling->Reset();
1895 for (std::vector<scoped_refptr<Tile> >::const_iterator it = tiles.begin();
1896 it != tiles.end();
1897 ++it) {
1898 EXPECT_EQ(TilePriority(), (*it)->priority(ACTIVE_TREE));
1899 }
1900 tiles.clear();
1901 }
1902
1869 } // namespace 1903 } // namespace
1870 } // namespace cc 1904 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698