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

Side by Side Diff: cc/layer_tree_host_unittest.cc

Issue 11275113: Remove most remaining references to IntRect and FloatRect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compositor bindings Created 8 years, 1 month 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_unittest.cc ('k') | cc/layer_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 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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/layer_tree_host.h" 7 #include "cc/layer_tree_host.h"
8 8
9 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "cc/content_layer.h" 10 #include "cc/content_layer.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 308
309 virtual void didCommit() OVERRIDE 309 virtual void didCommit() OVERRIDE
310 { 310 {
311 m_numCommits++; 311 m_numCommits++;
312 if (m_numCommits == 1) { 312 if (m_numCommits == 1) {
313 // Make the viewport empty so the host says it can't draw. 313 // Make the viewport empty so the host says it can't draw.
314 m_layerTreeHost->setViewportSize(gfx::Size(0, 0), gfx::Size(0, 0)); 314 m_layerTreeHost->setViewportSize(gfx::Size(0, 0), gfx::Size(0, 0));
315 315
316 scoped_array<char> pixels(new char[4]); 316 scoped_array<char> pixels(new char[4]);
317 m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get( )), IntRect(0, 0, 1, 1)); 317 m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get( )), gfx::Rect(0, 0, 1, 1));
318 } else if (m_numCommits == 2) { 318 } else if (m_numCommits == 2) {
319 m_layerTreeHost->setNeedsRedraw(); 319 m_layerTreeHost->setNeedsRedraw();
320 m_layerTreeHost->setNeedsCommit(); 320 m_layerTreeHost->setNeedsCommit();
321 } else 321 } else
322 endTest(); 322 endTest();
323 } 323 }
324 324
325 virtual void afterTest() OVERRIDE 325 virtual void afterTest() OVERRIDE
326 { 326 {
327 } 327 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 } 432 }
433 433
434 virtual void didCommitAndDrawFrame() OVERRIDE 434 virtual void didCommitAndDrawFrame() OVERRIDE
435 { 435 {
436 m_numCommits++; 436 m_numCommits++;
437 if (m_numCommits == 1) { 437 if (m_numCommits == 1) {
438 m_layerTreeHost->setVisible(false); 438 m_layerTreeHost->setVisible(false);
439 m_layerTreeHost->setNeedsCommit(); 439 m_layerTreeHost->setNeedsCommit();
440 m_layerTreeHost->setNeedsCommit(); 440 m_layerTreeHost->setNeedsCommit();
441 scoped_array<char> pixels(new char[4]); 441 scoped_array<char> pixels(new char[4]);
442 m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get( )), IntRect(0, 0, 1, 1)); 442 m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get( )), gfx::Rect(0, 0, 1, 1));
443 } else 443 } else
444 endTest(); 444 endTest();
445 445
446 } 446 }
447 447
448 virtual void afterTest() OVERRIDE 448 virtual void afterTest() OVERRIDE
449 { 449 {
450 } 450 }
451 451
452 private: 452 private:
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 WebFilterOperations filters; 1916 WebFilterOperations filters;
1917 filters.append(WebFilterOperation::createBlurFilter(10)); 1917 filters.append(WebFilterOperation::createBlurFilter(10));
1918 child->setFilters(filters); 1918 child->setFilters(filters);
1919 } 1919 }
1920 1920
1921 m_layerTreeHost->setRootLayer(rootLayer); 1921 m_layerTreeHost->setRootLayer(rootLayer);
1922 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( )); 1922 m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds( ));
1923 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ; 1923 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ;
1924 m_layerTreeHost->commitComplete(); 1924 m_layerTreeHost->commitComplete();
1925 1925
1926 EXPECT_RECT_EQ(cc::IntRect(), child2->occludedScreenSpace().bounds()); 1926 EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds());
1927 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); 1927 EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
1928 EXPECT_RECT_EQ(cc::IntRect(), grandChild->occludedScreenSpace().bounds() ); 1928 EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
1929 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); 1929 EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
1930 EXPECT_RECT_EQ(cc::IntRect(30, 40, 170, 160), child->occludedScreenSpace ().bounds()); 1930 EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace() .bounds());
1931 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); 1931 EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
1932 EXPECT_RECT_EQ(cc::IntRect(10, 70, 190, 130), rootLayer->occludedScreenS pace().bounds()); 1932 EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpa ce().bounds());
1933 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); 1933 EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
1934 1934
1935 // Kill the layerTreeHost immediately. 1935 // Kill the layerTreeHost immediately.
1936 m_layerTreeHost->setRootLayer(0); 1936 m_layerTreeHost->setRootLayer(0);
1937 m_layerTreeHost.reset(); 1937 m_layerTreeHost.reset();
1938 1938
1939 LayerTreeHost::setNeedsFilterContext(false); 1939 LayerTreeHost::setNeedsFilterContext(false);
1940 endTest(); 1940 endTest();
1941 } 1941 }
1942 1942
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1979 } 1979 }
1980 1980
1981 m_layerTreeHost->setRootLayer(layers[0].get()); 1981 m_layerTreeHost->setRootLayer(layers[0].get());
1982 m_layerTreeHost->setViewportSize(layers[0]->bounds(), layers[0]->bounds( )); 1982 m_layerTreeHost->setViewportSize(layers[0]->bounds(), layers[0]->bounds( ));
1983 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); 1983 ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded());
1984 ResourceUpdateQueue queue; 1984 ResourceUpdateQueue queue;
1985 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ; 1985 m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()) ;
1986 m_layerTreeHost->commitComplete(); 1986 m_layerTreeHost->commitComplete();
1987 1987
1988 for (int i = 0; i < numSurfaces-1; ++i) { 1988 for (int i = 0; i < numSurfaces-1; ++i) {
1989 cc::IntRect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1); 1989 gfx::Rect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1);
1990 1990
1991 EXPECT_RECT_EQ(expectedOcclusion, layers[i]->occludedScreenSpace().b ounds()); 1991 EXPECT_RECT_EQ(expectedOcclusion, layers[i]->occludedScreenSpace().b ounds());
1992 EXPECT_EQ(1u, layers[i]->occludedScreenSpace().rects().size()); 1992 EXPECT_EQ(1u, layers[i]->occludedScreenSpace().rects().size());
1993 } 1993 }
1994 1994
1995 // Kill the layerTreeHost immediately. 1995 // Kill the layerTreeHost immediately.
1996 m_layerTreeHost->setRootLayer(0); 1996 m_layerTreeHost->setRootLayer(0);
1997 m_layerTreeHost.reset(); 1997 m_layerTreeHost.reset();
1998 1998
1999 endTest(); 1999 endTest();
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 2515
2516 class LayerTreeHostTestCompositeAndReadbackCleanup : public LayerTreeHostTest { 2516 class LayerTreeHostTestCompositeAndReadbackCleanup : public LayerTreeHostTest {
2517 public: 2517 public:
2518 LayerTreeHostTestCompositeAndReadbackCleanup() { } 2518 LayerTreeHostTestCompositeAndReadbackCleanup() { }
2519 2519
2520 virtual void beginTest() OVERRIDE 2520 virtual void beginTest() OVERRIDE
2521 { 2521 {
2522 Layer* rootLayer = m_layerTreeHost->rootLayer(); 2522 Layer* rootLayer = m_layerTreeHost->rootLayer();
2523 2523
2524 scoped_array<char> pixels(new char[4]); 2524 scoped_array<char> pixels(new char[4]);
2525 m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get()), IntRect(0, 0, 1, 1)); 2525 m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get()), gfx::Rect(0, 0, 1, 1));
2526 EXPECT_FALSE(rootLayer->renderSurface()); 2526 EXPECT_FALSE(rootLayer->renderSurface());
2527 2527
2528 endTest(); 2528 endTest();
2529 } 2529 }
2530 2530
2531 virtual void afterTest() OVERRIDE 2531 virtual void afterTest() OVERRIDE
2532 { 2532 {
2533 } 2533 }
2534 }; 2534 };
2535 2535
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
3266 int m_numCommitsDeferred; 3266 int m_numCommitsDeferred;
3267 int m_numCompleteCommits; 3267 int m_numCompleteCommits;
3268 }; 3268 };
3269 3269
3270 TEST_F(LayerTreeHostTestDeferCommits, runMultiThread) 3270 TEST_F(LayerTreeHostTestDeferCommits, runMultiThread)
3271 { 3271 {
3272 runTest(true); 3272 runTest(true);
3273 } 3273 }
3274 3274
3275 } // namespace 3275 } // namespace
OLDNEW
« no previous file with comments | « cc/layer_tree_host_impl_unittest.cc ('k') | cc/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698