| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium 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 "ash/host/ash_window_tree_host_x11.h" | 5 #include "ash/host/ash_window_tree_host_x11.h" |
| 6 | 6 |
| 7 #undef None | 7 #undef None |
| 8 #undef Bool | 8 #undef Bool |
| 9 | 9 |
| 10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 // Send X touch events to one WindowTreeHost. The WindowTreeHost's | 62 // Send X touch events to one WindowTreeHost. The WindowTreeHost's |
| 63 // delegate will get corresponding ui::TouchEvent if the touch events | 63 // delegate will get corresponding ui::TouchEvent if the touch events |
| 64 // are targeting this WindowTreeHost. | 64 // are targeting this WindowTreeHost. |
| 65 TEST_F(AshWindowTreeHostX11Test, DispatchTouchEventToOneRootWindow) { | 65 TEST_F(AshWindowTreeHostX11Test, DispatchTouchEventToOneRootWindow) { |
| 66 // Fake a ChromeOS running env. | 66 // Fake a ChromeOS running env. |
| 67 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n"; | 67 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n"; |
| 68 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); | 68 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); |
| 69 | 69 |
| 70 scoped_ptr<aura::WindowTreeHostX11> window_tree_host( | 70 scoped_ptr<aura::WindowTreeHostX11> window_tree_host( |
| 71 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); | 71 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700), context_factory())); |
| 72 window_tree_host->InitHost(); | 72 window_tree_host->InitHost(); |
| 73 scoped_ptr<RootWindowEventHandler> handler( | 73 scoped_ptr<RootWindowEventHandler> handler( |
| 74 new RootWindowEventHandler(window_tree_host.get())); | 74 new RootWindowEventHandler(window_tree_host.get())); |
| 75 | 75 |
| 76 std::vector<unsigned int> devices; | 76 std::vector<unsigned int> devices; |
| 77 devices.push_back(0); | 77 devices.push_back(0); |
| 78 ui::SetUpTouchDevicesForTest(devices); | 78 ui::SetUpTouchDevicesForTest(devices); |
| 79 std::vector<ui::Valuator> valuators; | 79 std::vector<ui::Valuator> valuators; |
| 80 | 80 |
| 81 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type()); | 81 EXPECT_EQ(ui::ET_UNKNOWN, handler->last_touch_type()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 // Send X touch events to two WindowTreeHost. The WindowTreeHost which is | 128 // Send X touch events to two WindowTreeHost. The WindowTreeHost which is |
| 129 // the event target of the X touch events should generate the corresponding | 129 // the event target of the X touch events should generate the corresponding |
| 130 // ui::TouchEvent for its delegate. | 130 // ui::TouchEvent for its delegate. |
| 131 TEST_F(AshWindowTreeHostX11Test, DispatchTouchEventToTwoRootWindow) { | 131 TEST_F(AshWindowTreeHostX11Test, DispatchTouchEventToTwoRootWindow) { |
| 132 // Fake a ChromeOS running env. | 132 // Fake a ChromeOS running env. |
| 133 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n"; | 133 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n"; |
| 134 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); | 134 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); |
| 135 | 135 |
| 136 scoped_ptr<aura::WindowTreeHostX11> window_tree_host1( | 136 scoped_ptr<aura::WindowTreeHostX11> window_tree_host1( |
| 137 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700))); | 137 new AshWindowTreeHostX11(gfx::Rect(0, 0, 2560, 1700), context_factory())); |
| 138 window_tree_host1->InitHost(); | 138 window_tree_host1->InitHost(); |
| 139 scoped_ptr<RootWindowEventHandler> handler1( | 139 scoped_ptr<RootWindowEventHandler> handler1( |
| 140 new RootWindowEventHandler(window_tree_host1.get())); | 140 new RootWindowEventHandler(window_tree_host1.get())); |
| 141 | 141 |
| 142 int host2_y_offset = 1700; | 142 int host2_y_offset = 1700; |
| 143 scoped_ptr<aura::WindowTreeHostX11> window_tree_host2( | 143 scoped_ptr<aura::WindowTreeHostX11> window_tree_host2( |
| 144 new AshWindowTreeHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080))); | 144 new AshWindowTreeHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080), |
| 145 context_factory())); |
| 145 window_tree_host2->InitHost(); | 146 window_tree_host2->InitHost(); |
| 146 scoped_ptr<RootWindowEventHandler> handler2( | 147 scoped_ptr<RootWindowEventHandler> handler2( |
| 147 new RootWindowEventHandler(window_tree_host2.get())); | 148 new RootWindowEventHandler(window_tree_host2.get())); |
| 148 | 149 |
| 149 std::vector<unsigned int> devices; | 150 std::vector<unsigned int> devices; |
| 150 devices.push_back(0); | 151 devices.push_back(0); |
| 151 ui::SetUpTouchDevicesForTest(devices); | 152 ui::SetUpTouchDevicesForTest(devices); |
| 152 std::vector<ui::Valuator> valuators; | 153 std::vector<ui::Valuator> valuators; |
| 153 | 154 |
| 154 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); | 155 EXPECT_EQ(ui::ET_UNKNOWN, handler1->last_touch_type()); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 handler2.reset(); | 241 handler2.reset(); |
| 241 | 242 |
| 242 // Revert the CrOS testing env otherwise the following non-CrOS aura | 243 // Revert the CrOS testing env otherwise the following non-CrOS aura |
| 243 // tests will fail. | 244 // tests will fail. |
| 244 // Fake a ChromeOS running env. | 245 // Fake a ChromeOS running env. |
| 245 kLsbRelease = ""; | 246 kLsbRelease = ""; |
| 246 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); | 247 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); |
| 247 } | 248 } |
| 248 | 249 |
| 249 } // namespace aura | 250 } // namespace aura |
| OLD | NEW |