OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS 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 <gflags/gflags.h> | 5 #include <gflags/gflags.h> |
6 #include <gtest/gtest.h> | 6 #include <gtest/gtest.h> |
7 | 7 |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "window_manager/clutter_interface.h" | 10 #include "window_manager/clutter_interface.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 TEST_F(PanelBarTest, Basic) { | 36 TEST_F(PanelBarTest, Basic) { |
37 // First, create a toplevel window. | 37 // First, create a toplevel window. |
38 XWindow toplevel_xid = CreateSimpleWindow(); | 38 XWindow toplevel_xid = CreateSimpleWindow(); |
39 MockXConnection::WindowInfo* toplevel_info = | 39 MockXConnection::WindowInfo* toplevel_info = |
40 xconn_->GetWindowInfoOrDie(toplevel_xid); | 40 xconn_->GetWindowInfoOrDie(toplevel_xid); |
41 SendInitialEventsForWindow(toplevel_xid); | 41 SendInitialEventsForWindow(toplevel_xid); |
42 | 42 |
43 // It should be initially focused. | 43 // It should be initially focused. |
44 EXPECT_EQ(toplevel_xid, xconn_->focused_xid()); | 44 EXPECT_EQ(toplevel_xid, xconn_->focused_xid()); |
45 SendFocusEvents(xconn_->GetRootWindow(), toplevel_xid); | 45 SendFocusEvents(xconn_->GetRootWindow(), toplevel_xid); |
46 EXPECT_EQ(toplevel_xid, wm_->active_window_xid()); | 46 EXPECT_EQ(toplevel_xid, GetActiveWindowProperty()); |
47 | 47 |
48 // Now create a panel titlebar, and then the actual panel window. | 48 // Now create a panel titlebar, and then the actual panel window. |
49 const int initial_titlebar_height = 16; | 49 const int initial_titlebar_height = 16; |
50 XWindow titlebar_xid = CreateTitlebarWindow(100, initial_titlebar_height); | 50 XWindow titlebar_xid = CreateTitlebarWindow(100, initial_titlebar_height); |
51 MockXConnection::WindowInfo* titlebar_info = | 51 MockXConnection::WindowInfo* titlebar_info = |
52 xconn_->GetWindowInfoOrDie(titlebar_xid); | 52 xconn_->GetWindowInfoOrDie(titlebar_xid); |
53 SendInitialEventsForWindow(titlebar_xid); | 53 SendInitialEventsForWindow(titlebar_xid); |
54 | 54 |
55 const int initial_panel_width = 250; | 55 const int initial_panel_width = 250; |
56 const int initial_panel_height = 400; | 56 const int initial_panel_height = 400; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 MockXConnection::InitButtonPressEvent( | 112 MockXConnection::InitButtonPressEvent( |
113 &event, panel_xid, 0, 0, 1); // x, y, button | 113 &event, panel_xid, 0, 0, 1); // x, y, button |
114 EXPECT_TRUE(wm_->HandleEvent(&event)); | 114 EXPECT_TRUE(wm_->HandleEvent(&event)); |
115 EXPECT_EQ(None, xconn_->pointer_grab_xid()); | 115 EXPECT_EQ(None, xconn_->pointer_grab_xid()); |
116 EXPECT_EQ(panel_xid, xconn_->focused_xid()); | 116 EXPECT_EQ(panel_xid, xconn_->focused_xid()); |
117 EXPECT_FALSE(panel_info->all_buttons_grabbed); | 117 EXPECT_FALSE(panel_info->all_buttons_grabbed); |
118 | 118 |
119 // Send FocusOut and FocusIn events and check that the active window hint | 119 // Send FocusOut and FocusIn events and check that the active window hint |
120 // is updated to contain the panel window. | 120 // is updated to contain the panel window. |
121 SendFocusEvents(toplevel_xid, panel_xid); | 121 SendFocusEvents(toplevel_xid, panel_xid); |
122 EXPECT_EQ(panel_xid, wm_->active_window_xid()); | 122 EXPECT_EQ(panel_xid, GetActiveWindowProperty()); |
123 | 123 |
124 // Create a second toplevel window. | 124 // Create a second toplevel window. |
125 XWindow toplevel_xid2 = CreateSimpleWindow(); | 125 XWindow toplevel_xid2 = CreateSimpleWindow(); |
126 MockXConnection::WindowInfo* toplevel_info2 = | 126 MockXConnection::WindowInfo* toplevel_info2 = |
127 xconn_->GetWindowInfoOrDie(toplevel_xid2); | 127 xconn_->GetWindowInfoOrDie(toplevel_xid2); |
128 SendInitialEventsForWindow(toplevel_xid2); | 128 SendInitialEventsForWindow(toplevel_xid2); |
129 Window* toplevel_win2 = wm_->GetWindow(toplevel_xid2); | 129 Window* toplevel_win2 = wm_->GetWindow(toplevel_xid2); |
130 ASSERT_TRUE(toplevel_win2 != NULL); | 130 ASSERT_TRUE(toplevel_win2 != NULL); |
131 | 131 |
132 // The panel's and titlebar's client and composited windows should be | 132 // The panel's and titlebar's client and composited windows should be |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 EXPECT_TRUE(panel->is_expanded()); | 174 EXPECT_TRUE(panel->is_expanded()); |
175 EXPECT_EQ(panel_xid, xconn_->focused_xid()); | 175 EXPECT_EQ(panel_xid, xconn_->focused_xid()); |
176 EXPECT_EQ(panel_xid, GetActiveWindowProperty()); | 176 EXPECT_EQ(panel_xid, GetActiveWindowProperty()); |
177 } | 177 } |
178 | 178 |
179 } // namespace chromeos | 179 } // namespace chromeos |
180 | 180 |
181 int main(int argc, char **argv) { | 181 int main(int argc, char **argv) { |
182 return chromeos::InitAndRunTests(&argc, argv, &FLAGS_logtostderr); | 182 return chromeos::InitAndRunTests(&argc, argv, &FLAGS_logtostderr); |
183 } | 183 } |
OLD | NEW |