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

Side by Side Diff: chrome_watchdog_test.cc

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
« no previous file with comments | « chrome_watchdog.h ('k') | event_consumer.h » ('j') | window.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/logging.h" 8 #include "base/logging.h"
9 #include "cros/chromeos_wm_ipc_enums.h" 9 #include "cros/chromeos_wm_ipc_enums.h"
10 #include "window_manager/chrome_watchdog.h" 10 #include "window_manager/chrome_watchdog.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 xconn_->SetIntProperty(non_chrome_xid, kPidAtom, kCardinalAtom, kPid); 53 xconn_->SetIntProperty(non_chrome_xid, kPidAtom, kCardinalAtom, kPid);
54 xconn_->SetStringProperty(non_chrome_xid, kClientMachineAtom, GetHostname()); 54 xconn_->SetStringProperty(non_chrome_xid, kClientMachineAtom, GetHostname());
55 SendInitialEventsForWindow(non_chrome_xid); 55 SendInitialEventsForWindow(non_chrome_xid);
56 xconn_->GetWindowInfoOrDie(non_chrome_xid)->client_messages.clear(); 56 xconn_->GetWindowInfoOrDie(non_chrome_xid)->client_messages.clear();
57 EXPECT_FALSE(watchdog->SendPingToChrome(kTimestamp, kTimeoutMs)); 57 EXPECT_FALSE(watchdog->SendPingToChrome(kTimestamp, kTimeoutMs));
58 EXPECT_TRUE( 58 EXPECT_TRUE(
59 xconn_->GetWindowInfoOrDie(non_chrome_xid)->client_messages.empty()); 59 xconn_->GetWindowInfoOrDie(non_chrome_xid)->client_messages.empty());
60 60
61 // We should also fail if we only have a Chrome window that doesn't 61 // We should also fail if we only have a Chrome window that doesn't
62 // support _NET_WM_PING... 62 // support _NET_WM_PING...
63 XWindow non_ping_xid = CreateToplevelWindow(2, 0, 0, 0, 640, 480); 63 XWindow non_ping_xid = CreateToplevelWindow(2, 0, Rect(0, 0, 640, 480));
64 xconn_->SetIntProperty(non_ping_xid, kPidAtom, kCardinalAtom, kPid); 64 xconn_->SetIntProperty(non_ping_xid, kPidAtom, kCardinalAtom, kPid);
65 xconn_->SetStringProperty(non_ping_xid, kClientMachineAtom, GetHostname()); 65 xconn_->SetStringProperty(non_ping_xid, kClientMachineAtom, GetHostname());
66 SendInitialEventsForWindow(non_ping_xid); 66 SendInitialEventsForWindow(non_ping_xid);
67 EXPECT_FALSE(watchdog->SendPingToChrome(kTimestamp, kTimeoutMs)); 67 EXPECT_FALSE(watchdog->SendPingToChrome(kTimestamp, kTimeoutMs));
68 68
69 // ... or that's running on a different host... 69 // ... or that's running on a different host...
70 XWindow other_host_xid = CreateToplevelWindow(2, 0, 0, 0, 640, 480); 70 XWindow other_host_xid = CreateToplevelWindow(2, 0, Rect(0, 0, 640, 480));
71 AppendAtomToProperty(other_host_xid, kProtocolsAtom, kPingAtom); 71 AppendAtomToProperty(other_host_xid, kProtocolsAtom, kPingAtom);
72 xconn_->SetIntProperty(other_host_xid, kPidAtom, kCardinalAtom, kPid); 72 xconn_->SetIntProperty(other_host_xid, kPidAtom, kCardinalAtom, kPid);
73 xconn_->SetStringProperty(other_host_xid, kClientMachineAtom, "bogus123"); 73 xconn_->SetStringProperty(other_host_xid, kClientMachineAtom, "bogus123");
74 SendInitialEventsForWindow(other_host_xid); 74 SendInitialEventsForWindow(other_host_xid);
75 EXPECT_FALSE(watchdog->SendPingToChrome(kTimestamp, kTimeoutMs)); 75 EXPECT_FALSE(watchdog->SendPingToChrome(kTimestamp, kTimeoutMs));
76 76
77 // ... or that didn't supply its PID. 77 // ... or that didn't supply its PID.
78 XWindow no_pid_xid = CreateToplevelWindow(2, 0, 0, 0, 640, 480); 78 XWindow no_pid_xid = CreateToplevelWindow(2, 0, Rect(0, 0, 640, 480));
79 AppendAtomToProperty(no_pid_xid, kProtocolsAtom, kPingAtom); 79 AppendAtomToProperty(no_pid_xid, kProtocolsAtom, kPingAtom);
80 xconn_->SetStringProperty(no_pid_xid, kClientMachineAtom, GetHostname()); 80 xconn_->SetStringProperty(no_pid_xid, kClientMachineAtom, GetHostname());
81 SendInitialEventsForWindow(no_pid_xid); 81 SendInitialEventsForWindow(no_pid_xid);
82 EXPECT_FALSE(watchdog->SendPingToChrome(kTimestamp, kTimeoutMs)); 82 EXPECT_FALSE(watchdog->SendPingToChrome(kTimestamp, kTimeoutMs));
83 83
84 // Now create a Chrome window that supports _NET_WM_PING and has supplied 84 // Now create a Chrome window that supports _NET_WM_PING and has supplied
85 // a PID and is running on the local host, and check that it receives a 85 // a PID and is running on the local host, and check that it receives a
86 // message. 86 // message.
87 XWindow toplevel_xid = CreateToplevelWindow(2, 0, 0, 0, 640, 480); 87 XWindow toplevel_xid = CreateToplevelWindow(2, 0, Rect(0, 0, 640, 480));
88 AppendAtomToProperty(toplevel_xid, kProtocolsAtom, kPingAtom); 88 AppendAtomToProperty(toplevel_xid, kProtocolsAtom, kPingAtom);
89 xconn_->SetIntProperty(toplevel_xid, kPidAtom, kCardinalAtom, kPid); 89 xconn_->SetIntProperty(toplevel_xid, kPidAtom, kCardinalAtom, kPid);
90 xconn_->SetStringProperty(toplevel_xid, kClientMachineAtom, GetHostname()); 90 xconn_->SetStringProperty(toplevel_xid, kClientMachineAtom, GetHostname());
91 SendInitialEventsForWindow(toplevel_xid); 91 SendInitialEventsForWindow(toplevel_xid);
92 MockXConnection::WindowInfo* toplevel_info = 92 MockXConnection::WindowInfo* toplevel_info =
93 xconn_->GetWindowInfoOrDie(toplevel_xid); 93 xconn_->GetWindowInfoOrDie(toplevel_xid);
94 toplevel_info->client_messages.clear(); 94 toplevel_info->client_messages.clear();
95 EXPECT_TRUE(watchdog->SendPingToChrome(kTimestamp, kTimeoutMs)); 95 EXPECT_TRUE(watchdog->SendPingToChrome(kTimestamp, kTimeoutMs));
96 96
97 // Also check the contents of the message, per EWMH's specification of 97 // Also check the contents of the message, per EWMH's specification of
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 138 }
139 139
140 } // namespace window_manager 140 } // namespace window_manager
141 141
142 int main(int argc, char** argv) { 142 int main(int argc, char** argv) {
143 // Ensure that we don't really send signals to processes. 143 // Ensure that we don't really send signals to processes.
144 window_manager::AutoReset<bool> flag_resetter( 144 window_manager::AutoReset<bool> flag_resetter(
145 &FLAGS_kill_chrome_if_hanging, false); 145 &FLAGS_kill_chrome_if_hanging, false);
146 return window_manager::InitAndRunTests(&argc, argv, &FLAGS_logtostderr); 146 return window_manager::InitAndRunTests(&argc, argv, &FLAGS_logtostderr);
147 } 147 }
OLDNEW
« no previous file with comments | « chrome_watchdog.h ('k') | event_consumer.h » ('j') | window.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698