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

Side by Side Diff: ui/aura/window_unittest.cc

Issue 10181005: aura: Hide transient children of a Window when the window hides. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 8 years, 8 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 | « ui/aura/window.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/aura/window.h" 5 #include "ui/aura/window.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 w1.reset(CreateTestWindowWithId(4, parent.get())); 1035 w1.reset(CreateTestWindowWithId(4, parent.get()));
1036 w2 = CreateTestWindowWithId(5, w3.get()); 1036 w2 = CreateTestWindowWithId(5, w3.get());
1037 w1->AddTransientChild(w2); 1037 w1->AddTransientChild(w2);
1038 parent->StackChildAtTop(w3.get()); 1038 parent->StackChildAtTop(w3.get());
1039 // Stack w1 at the top (end), this shouldn't affect w2 since it has a 1039 // Stack w1 at the top (end), this shouldn't affect w2 since it has a
1040 // different parent. 1040 // different parent.
1041 parent->StackChildAtTop(w1.get()); 1041 parent->StackChildAtTop(w1.get());
1042 ASSERT_EQ(2u, parent->children().size()); 1042 ASSERT_EQ(2u, parent->children().size());
1043 EXPECT_EQ(w3.get(), parent->children()[0]); 1043 EXPECT_EQ(w3.get(), parent->children()[0]);
1044 EXPECT_EQ(w1.get(), parent->children()[1]); 1044 EXPECT_EQ(w1.get(), parent->children()[1]);
1045
1046 // Hiding parent should hide transient children.
1047 EXPECT_TRUE(w2->IsVisible());
1048 w1->Hide();
1049 EXPECT_FALSE(w2->IsVisible());
1045 } 1050 }
1046 1051
1047 // Tests that when a focused window is closed, its parent inherits the focus. 1052 // Tests that when a focused window is closed, its parent inherits the focus.
1048 TEST_F(WindowTest, FocusedWindowTest) { 1053 TEST_F(WindowTest, FocusedWindowTest) {
1049 scoped_ptr<Window> parent(CreateTestWindowWithId(0, NULL)); 1054 scoped_ptr<Window> parent(CreateTestWindowWithId(0, NULL));
1050 scoped_ptr<Window> child(CreateTestWindowWithId(1, parent.get())); 1055 scoped_ptr<Window> child(CreateTestWindowWithId(1, parent.get()));
1051 1056
1052 parent->Show(); 1057 parent->Show();
1053 1058
1054 child->Focus(); 1059 child->Focus();
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 w2->SetParent(w1.get()); 1932 w2->SetParent(w1.get());
1928 1933
1929 w1.reset(); 1934 w1.reset();
1930 1935
1931 // We should be able to deref w2 still, but its parent should now be NULL. 1936 // We should be able to deref w2 still, but its parent should now be NULL.
1932 EXPECT_EQ(NULL, w2->parent()); 1937 EXPECT_EQ(NULL, w2->parent());
1933 } 1938 }
1934 1939
1935 } // namespace test 1940 } // namespace test
1936 } // namespace aura 1941 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698