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

Side by Side Diff: test_lib.h

Issue 6902072: wm: Update a lot of code to use structs from geometry.h. (Closed) Base URL: ssh://gitrw.chromium.org:9222/window_manager.git@master
Patch Set: move override-redirect stacking and visibility into Window Created 9 years, 7 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 OS Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef WINDOW_MANAGER_TEST_LIB_H_ 5 #ifndef WINDOW_MANAGER_TEST_LIB_H_
6 #define WINDOW_MANAGER_TEST_LIB_H_ 6 #define WINDOW_MANAGER_TEST_LIB_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include <gtest/gtest.h> 10 #include <gtest/gtest.h>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 // Create a new WindowManager object using the existing X connection, 77 // Create a new WindowManager object using the existing X connection,
78 // compositor, etc. and store it in |wm_|. 78 // compositor, etc. and store it in |wm_|.
79 void CreateNewWm(); 79 void CreateNewWm();
80 80
81 // Call CreateNewWm() and then call its Init() method and ensure that it 81 // Call CreateNewWm() and then call its Init() method and ensure that it
82 // succeeds. 82 // succeeds.
83 void CreateAndInitNewWm(); 83 void CreateAndInitNewWm();
84 84
85 // Create a basic window with no special type. 85 // Create a basic window with no special type.
86 XWindow CreateBasicWindow(int x, int y, int width, int height); 86 XWindow CreateBasicWindow(const Rect& bounds);
87 87
88 // Create a toplevel client window with the passed-in position and 88 // Create a toplevel client window with the passed-in position and
89 // dimensions. It has type WINDOW_TYPE_CHROME_TOPLEVEL. 89 // dimensions. It has type WINDOW_TYPE_CHROME_TOPLEVEL.
90 XWindow CreateToplevelWindow(int tab_count, int selected_tab, 90 XWindow CreateToplevelWindow(int tab_count,
91 int x, int y, int width, int height); 91 int selected_tab,
92 const Rect& bounds);
92 93
93 // Create a snapshot client window with the passed-in position and 94 // Create a snapshot client window with the passed-in position and
94 // dimensions and associated parent toplevel window. 95 // dimensions and associated parent toplevel window.
95 XWindow CreateSnapshotWindow(XWindow parent_xid, int index, 96 XWindow CreateSnapshotWindow(XWindow parent_xid,
96 int x, int y, 97 int index,
97 int width, int height); 98 const Rect& bounds);
98 99
99 // Creates a fav icon window for the associated snapshot. 100 // Creates a fav icon window for the associated snapshot.
100 XWindow CreateFavIconWindow(XWindow snapshot_xid, 101 XWindow CreateFavIconWindow(XWindow snapshot_xid, const Size& size);
101 int width, int height);
102 102
103 // Creates a title window for the associated snapshot. 103 // Creates a title window for the associated snapshot.
104 XWindow CreateTitleWindow(XWindow snapshot_xid, 104 XWindow CreateTitleWindow(XWindow snapshot_xid, const Size& size);
105 int width, int height);
106 105
107 // Creates a decoration window (favicon or title) for the associated 106 // Creates a decoration window (favicon or title) for the associated
108 // snapshot window. 107 // snapshot window.
109 XWindow CreateDecorationWindow(XWindow snapshot_xid, 108 XWindow CreateDecorationWindow(XWindow snapshot_xid,
110 chromeos::WmIpcWindowType type, 109 chromeos::WmIpcWindowType type,
111 int width, int height); 110 const Size& size);
112 111
113 // Creates a toplevel client window with an arbitrary size. 112 // Creates a toplevel client window with an arbitrary size.
114 XWindow CreateSimpleWindow(); 113 XWindow CreateSimpleWindow();
115 114
116 // Creates a snapshot client window with an arbitrary size. 115 // Creates a snapshot client window with an arbitrary size.
117 // |toplevel_xid| is the id of the associated toplevel window. 116 // |toplevel_xid| is the id of the associated toplevel window.
118 // |index| is the index of the snapshot within the given toplevel 117 // |index| is the index of the snapshot within the given toplevel
119 // window. 118 // window.
120 XWindow CreateSimpleSnapshotWindow(XWindow toplevel_xid, int index); 119 XWindow CreateSimpleSnapshotWindow(XWindow toplevel_xid, int index);
121 120
122 // Create a panel titlebar or content window. Muck around with the 121 // Create a panel titlebar or content window. Muck around with the
123 // |*new_panel*| members below to change content window parameters. 122 // |*new_panel*| members below to change content window parameters.
124 XWindow CreatePanelTitlebarWindow(int width, int height); 123 XWindow CreatePanelTitlebarWindow(const Size& size);
125 XWindow CreatePanelContentWindow(int width, int height, XWindow titlebar_xid); 124 XWindow CreatePanelContentWindow(const Size& size, XWindow titlebar_xid);
126 125
127 // Create titlebar and content windows for a panel, show them, and return 126 // Create titlebar and content windows for a panel, show them, and return
128 // a pointer to the Panel object. 127 // a pointer to the Panel object.
129 Panel* CreatePanel(int width, int titlebar_height, int content_height); 128 Panel* CreatePanel(int width, int titlebar_height, int content_height);
130 129
131 // Simulates a change in the selected tab and tab count in a chrome 130 // Simulates a change in the selected tab and tab count in a chrome
132 // toplevel window. 131 // toplevel window.
133 void ChangeTabInfo(XWindow toplevel_xid, 132 void ChangeTabInfo(XWindow toplevel_xid,
134 int tab_count, 133 int tab_count,
135 int selected_tab, 134 int selected_tab,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // Send a key press and release to the given xid. 169 // Send a key press and release to the given xid.
171 void SendKey(XWindow xid, 170 void SendKey(XWindow xid,
172 KeyBindings::KeyCombo key, 171 KeyBindings::KeyCombo key,
173 XTime press_timestamp, 172 XTime press_timestamp,
174 XTime release_timestamp); 173 XTime release_timestamp);
175 174
176 // Send a _NET_ACTIVE_WINDOW message asking the window manager to focus a 175 // Send a _NET_ACTIVE_WINDOW message asking the window manager to focus a
177 // window. 176 // window.
178 void SendActiveWindowMessage(XWindow xid); 177 void SendActiveWindowMessage(XWindow xid);
179 178
180 // Invoke Window::HandleConfigureNotify() using the client window's size. 179 // Initialize a ConfigureNotify event for |xid|'s current bounds and stacking
181 // The Window class defers resizing its actor until it sees a 180 // and pass it to WindowManager::HandleEvent().
182 // ConfigureNotify event; this can be used to make sure that the actor's 181 void SendConfigureNotifyEvent(XWindow xid);
183 // size matches the current client size.
184 void NotifyWindowAboutSize(Window* win);
185 182
186 // Set the _CHROME_LOGGED_IN property on the root window to describe 183 // Set the _CHROME_LOGGED_IN property on the root window to describe
187 // whether Chrome is logged in or not, and send a PropertyNotify event to 184 // whether Chrome is logged in or not, and send a PropertyNotify event to
188 // the window manager (if it's non-NULL). 185 // the window manager (if it's non-NULL).
189 void SetLoggedInState(bool logged_in); 186 void SetLoggedInState(bool logged_in);
190 187
191 // Append an atom to an integer property on a window. 188 // Append an atom to an integer property on a window.
192 void AppendAtomToProperty( 189 void AppendAtomToProperty(
193 XWindow xid, XAtom property_atom, XAtom atom_to_add); 190 XWindow xid, XAtom property_atom, XAtom atom_to_add);
194 191
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 virtual bool HandleWindowMapRequest(Window* win) { 381 virtual bool HandleWindowMapRequest(Window* win) {
385 num_map_requests_++; 382 num_map_requests_++;
386 return should_return_true_for_map_requests_; 383 return should_return_true_for_map_requests_;
387 } 384 }
388 virtual void HandleWindowMap(Window* win) { num_mapped_windows_++; } 385 virtual void HandleWindowMap(Window* win) { num_mapped_windows_++; }
389 virtual void HandleWindowUnmap(Window* win) { num_unmapped_windows_++; } 386 virtual void HandleWindowUnmap(Window* win) { num_unmapped_windows_++; }
390 virtual void HandleWindowPixmapFetch(Window* win) { 387 virtual void HandleWindowPixmapFetch(Window* win) {
391 num_fetched_pixmaps_++; 388 num_fetched_pixmaps_++;
392 } 389 }
393 virtual void HandleWindowConfigureRequest(Window* win, 390 virtual void HandleWindowConfigureRequest(Window* win,
394 int req_x, int req_y, 391 const Rect& requested_bounds) {}
395 int req_width, int req_height) {}
396 virtual void HandleButtonPress(XWindow xid, 392 virtual void HandleButtonPress(XWindow xid,
397 int x, int y, 393 const Point& relative_pos,
398 int x_root, int y_root, 394 const Point& absolute_pos,
399 int button, 395 int button,
400 XTime timestamp) { 396 XTime timestamp) {
401 num_button_presses_++; 397 num_button_presses_++;
402 } 398 }
403 virtual void HandleButtonRelease(XWindow xid, 399 virtual void HandleButtonRelease(XWindow xid,
404 int x, int y, 400 const Point& relative_pos,
405 int x_root, int y_root, 401 const Point& absolute_pos,
406 int button, 402 int button,
407 XTime timestamp) {} 403 XTime timestamp) {}
408 virtual void HandlePointerEnter(XWindow xid, 404 virtual void HandlePointerEnter(XWindow xid,
409 int x, int y, 405 const Point& relative_pos,
410 int x_root, int y_root, 406 const Point& absolute_pos,
411 XTime timestamp) {} 407 XTime timestamp) {}
412 virtual void HandlePointerLeave(XWindow xid, 408 virtual void HandlePointerLeave(XWindow xid,
413 int x, int y, 409 const Point& relative_pos,
414 int x_root, int y_root, 410 const Point& absolute_pos,
415 XTime timestamp) {} 411 XTime timestamp) {}
416 virtual void HandlePointerMotion(XWindow xid, 412 virtual void HandlePointerMotion(XWindow xid,
417 int x, int y, 413 const Point& relative_pos,
418 int x_root, int y_root, 414 const Point& absolute_pos,
419 XTime timestamp) {} 415 XTime timestamp) {}
420 virtual void HandleChromeMessage(const WmIpc::Message& msg) { 416 virtual void HandleChromeMessage(const WmIpc::Message& msg) {
421 chrome_messages_.push_back(msg); 417 chrome_messages_.push_back(msg);
422 } 418 }
423 virtual void HandleClientMessage(XWindow xid, 419 virtual void HandleClientMessage(XWindow xid,
424 XAtom message_type, 420 XAtom message_type,
425 const long data[5]) {} 421 const long data[5]) {}
426 virtual void HandleFocusChange(XWindow xid, bool focus_in) {} 422 virtual void HandleFocusChange(XWindow xid, bool focus_in) {}
427 virtual void HandleWindowPropertyChange(XWindow xid, XAtom xatom) {} 423 virtual void HandleWindowPropertyChange(XWindow xid, XAtom xatom) {}
428 virtual void OwnDestroyedWindow(DestroyedWindow* destroyed_win, XWindow xid) { 424 virtual void OwnDestroyedWindow(DestroyedWindow* destroyed_win, XWindow xid) {
(...skipping 16 matching lines...) Expand all
445 // Messages received via HandleChromeMessage(). 441 // Messages received via HandleChromeMessage().
446 std::vector<WmIpc::Message> chrome_messages_; 442 std::vector<WmIpc::Message> chrome_messages_;
447 443
448 // DestroyedWindow objects that WindowManager has given to us. 444 // DestroyedWindow objects that WindowManager has given to us.
449 std::set<std::tr1::shared_ptr<DestroyedWindow> > destroyed_windows_; 445 std::set<std::tr1::shared_ptr<DestroyedWindow> > destroyed_windows_;
450 }; 446 };
451 447
452 } // namespace window_manager 448 } // namespace window_manager
453 449
454 #endif // WINDOW_MANAGER_TEST_LIB_H_ 450 #endif // WINDOW_MANAGER_TEST_LIB_H_
OLDNEW
« no previous file with comments | « screen_locker_handler_test.cc ('k') | test_lib.cc » ('j') | window.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698