| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 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/compositor/compositor.h" | 10 #include "window_manager/compositor/compositor.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 XWindow toplevel_xid = CreateSimpleWindow(); | 44 XWindow toplevel_xid = CreateSimpleWindow(); |
| 45 SendInitialEventsForWindow(toplevel_xid); | 45 SendInitialEventsForWindow(toplevel_xid); |
| 46 | 46 |
| 47 // It should be initially focused. | 47 // It should be initially focused. |
| 48 EXPECT_EQ(toplevel_xid, xconn_->focused_xid()); | 48 EXPECT_EQ(toplevel_xid, xconn_->focused_xid()); |
| 49 EXPECT_EQ(toplevel_xid, GetActiveWindowProperty()); | 49 EXPECT_EQ(toplevel_xid, GetActiveWindowProperty()); |
| 50 | 50 |
| 51 // Now create a panel titlebar, and then the content window. | 51 // Now create a panel titlebar, and then the content window. |
| 52 const int initial_titlebar_height = 16; | 52 const int initial_titlebar_height = 16; |
| 53 XWindow titlebar_xid = | 53 XWindow titlebar_xid = |
| 54 CreatePanelTitlebarWindow(100, initial_titlebar_height); | 54 CreatePanelTitlebarWindow(Size(100, initial_titlebar_height)); |
| 55 MockXConnection::WindowInfo* titlebar_info = | 55 MockXConnection::WindowInfo* titlebar_info = |
| 56 xconn_->GetWindowInfoOrDie(titlebar_xid); | 56 xconn_->GetWindowInfoOrDie(titlebar_xid); |
| 57 SendInitialEventsForWindow(titlebar_xid); | 57 SendInitialEventsForWindow(titlebar_xid); |
| 58 | 58 |
| 59 const int initial_content_width = 250; | 59 const int initial_content_width = 250; |
| 60 const int initial_content_height = 400; | 60 const int initial_content_height = 400; |
| 61 XWindow content_xid = CreatePanelContentWindow( | 61 XWindow content_xid = CreatePanelContentWindow( |
| 62 initial_content_width, initial_content_height, titlebar_xid); | 62 Size(initial_content_width, initial_content_height), titlebar_xid); |
| 63 MockXConnection::WindowInfo* content_info = | 63 MockXConnection::WindowInfo* content_info = |
| 64 xconn_->GetWindowInfoOrDie(content_xid); | 64 xconn_->GetWindowInfoOrDie(content_xid); |
| 65 SendInitialEventsForWindow(content_xid); | 65 SendInitialEventsForWindow(content_xid); |
| 66 | 66 |
| 67 // The panel's content window should take the focus, and no button grab | 67 // The panel's content window should take the focus, and no button grab |
| 68 // should be installed yet. | 68 // should be installed yet. |
| 69 EXPECT_EQ(content_xid, xconn_->focused_xid()); | 69 EXPECT_EQ(content_xid, xconn_->focused_xid()); |
| 70 EXPECT_EQ(content_xid, GetActiveWindowProperty()); | 70 EXPECT_EQ(content_xid, GetActiveWindowProperty()); |
| 71 | 71 |
| 72 // Click on the toplevel window to give it the focus again. A button | 72 // Click on the toplevel window to give it the focus again. A button |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 xconn_->InitButtonPressEvent(&event, panel->content_xid(), Point(0, 0), 1); | 1103 xconn_->InitButtonPressEvent(&event, panel->content_xid(), Point(0, 0), 1); |
| 1104 wm_->HandleEvent(&event); | 1104 wm_->HandleEvent(&event); |
| 1105 EXPECT_EQ(transient_xid, xconn_->focused_xid()); | 1105 EXPECT_EQ(transient_xid, xconn_->focused_xid()); |
| 1106 } | 1106 } |
| 1107 | 1107 |
| 1108 } // namespace window_manager | 1108 } // namespace window_manager |
| 1109 | 1109 |
| 1110 int main(int argc, char** argv) { | 1110 int main(int argc, char** argv) { |
| 1111 return window_manager::InitAndRunTests(&argc, argv, &FLAGS_logtostderr); | 1111 return window_manager::InitAndRunTests(&argc, argv, &FLAGS_logtostderr); |
| 1112 } | 1112 } |
| OLD | NEW |