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

Side by Side Diff: ui/gfx/compositor/layer_unittest.cc

Issue 8136005: Makes visbility inherited. That is, in order for a window to be (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Window now gets visibility from Layer. Created 9 years, 2 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/gfx/canvas_skia.h" 9 #include "ui/gfx/canvas_skia.h"
10 #include "ui/gfx/compositor/compositor_observer.h" 10 #include "ui/gfx/compositor/compositor_observer.h"
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 EXPECT_TRUE(NULL != l121->texture()); 469 EXPECT_TRUE(NULL != l121->texture());
470 EXPECT_TRUE(NULL != l122->texture()); 470 EXPECT_TRUE(NULL != l122->texture());
471 471
472 // Toggling l2's visibility should drop all sub-layer textures. 472 // Toggling l2's visibility should drop all sub-layer textures.
473 l12->SetVisible(false); 473 l12->SetVisible(false);
474 EXPECT_EQ(NULL, l12->texture()); 474 EXPECT_EQ(NULL, l12->texture());
475 EXPECT_EQ(NULL, l121->texture()); 475 EXPECT_EQ(NULL, l121->texture());
476 EXPECT_EQ(NULL, l122->texture()); 476 EXPECT_EQ(NULL, l122->texture());
477 } 477 }
478 478
479 // Various visibile/drawn assertions.
480 TEST_F(LayerTest, Visibility) {
481 scoped_ptr<Layer> l1(new Layer(NULL, Layer::LAYER_HAS_TEXTURE));
482 scoped_ptr<Layer> l2(new Layer(NULL, Layer::LAYER_HAS_TEXTURE));
483 scoped_ptr<Layer> l3(new Layer(NULL, Layer::LAYER_HAS_TEXTURE));
484 l1->Add(l2.get());
485 l2->Add(l3.get());
486
487 NullLayerDelegate delegate;
488 l1->set_delegate(&delegate);
489 l2->set_delegate(&delegate);
490 l3->set_delegate(&delegate);
491
492 // Layers should initially be drawn.
493 EXPECT_TRUE(l1->IsDrawn());
494 EXPECT_TRUE(l2->IsDrawn());
495 EXPECT_TRUE(l3->IsDrawn());
496
497 compositor()->SetRootLayer(l1.get());
498
499 Draw();
500
501 l1->SetVisible(false);
502 EXPECT_FALSE(l1->IsDrawn());
503 EXPECT_FALSE(l2->IsDrawn());
504 EXPECT_FALSE(l3->IsDrawn());
505
506 l3->SetVisible(false);
507 EXPECT_FALSE(l1->IsDrawn());
508 EXPECT_FALSE(l2->IsDrawn());
509 EXPECT_FALSE(l3->IsDrawn());
510
511 l1->SetVisible(true);
512 EXPECT_TRUE(l1->IsDrawn());
513 EXPECT_TRUE(l2->IsDrawn());
514 EXPECT_FALSE(l3->IsDrawn());
515 }
516
479 } // namespace ui 517 } // namespace ui
480 518
OLDNEW
« ui/aura/window.cc ('K') | « ui/gfx/compositor/layer.cc ('k') | views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698