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 <algorithm> | 5 #include <algorithm> |
6 #include <cstdarg> | 6 #include <cstdarg> |
7 | 7 |
8 #include <gflags/gflags.h> | 8 #include <gflags/gflags.h> |
9 #include <gtest/gtest.h> | 9 #include <gtest/gtest.h> |
10 | 10 |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 reparent_event->type = ReparentNotify; | 665 reparent_event->type = ReparentNotify; |
666 reparent_event->window = xid2; | 666 reparent_event->window = xid2; |
667 reparent_event->parent = 324324; // arbitrary number | 667 reparent_event->parent = 324324; // arbitrary number |
668 EXPECT_TRUE(wm_->HandleEvent(&event)); | 668 EXPECT_TRUE(wm_->HandleEvent(&event)); |
669 | 669 |
670 // The properties should be unset. | 670 // The properties should be unset. |
671 TestIntArrayProperty(root_xid, list_atom, 0); | 671 TestIntArrayProperty(root_xid, list_atom, 0); |
672 TestIntArrayProperty(root_xid, stacking_atom, 0); | 672 TestIntArrayProperty(root_xid, stacking_atom, 0); |
673 } | 673 } |
674 | 674 |
| 675 TEST_F(WindowManagerTest, WmIpcVersion) { |
| 676 // We should assume version 0 if we haven't received a message from Chrome. |
| 677 EXPECT_EQ(0, wm_->wm_ipc_version()); |
| 678 |
| 679 // Now send the WM a message telling it that Chrome is using version 3. |
| 680 // We use WmIpc to generate the XEvent for us and then pass it to |
| 681 // WindowManager::HandleEvent(). |
| 682 MockXConnection::WindowInfo* info = xconn_->GetWindowInfoOrDie(wm_->wm_xid()); |
| 683 EXPECT_TRUE(info->client_messages.empty()); |
| 684 WmIpc::Message msg(WmIpc::Message::WM_NOTIFY_IPC_VERSION); |
| 685 msg.set_param(0, 3); |
| 686 ASSERT_TRUE(wm_->wm_ipc()->SendMessage(wm_->wm_xid(), msg)); |
| 687 ASSERT_EQ(static_cast<size_t>(1), info->client_messages.size()); |
| 688 XEvent event; |
| 689 event.xclient = info->client_messages[0]; |
| 690 EXPECT_TRUE(wm_->HandleEvent(&event)); |
| 691 EXPECT_EQ(3, wm_->wm_ipc_version()); |
| 692 } |
| 693 |
675 } // namespace window_manager | 694 } // namespace window_manager |
676 | 695 |
677 int main(int argc, char **argv) { | 696 int main(int argc, char **argv) { |
678 return window_manager::InitAndRunTests(&argc, argv, &FLAGS_logtostderr); | 697 return window_manager::InitAndRunTests(&argc, argv, &FLAGS_logtostderr); |
679 } | 698 } |
OLD | NEW |