OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 | 5 |
6 #include "base/sys_info.h" | 6 #include "base/sys_info.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "ui/aura/root_window.h" | 8 #include "ui/aura/root_window.h" |
9 #include "ui/aura/root_window_host_x11.h" | 9 #include "ui/aura/root_window_host_x11.h" |
10 #include "ui/aura/test/aura_test_base.h" | 10 #include "ui/aura/test/aura_test_base.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 virtual void OnHostMoved(const gfx::Point& origin) OVERRIDE {} | 55 virtual void OnHostMoved(const gfx::Point& origin) OVERRIDE {} |
56 virtual void OnHostResized(const gfx::Size& size) OVERRIDE {} | 56 virtual void OnHostResized(const gfx::Size& size) OVERRIDE {} |
57 | 57 |
58 virtual float GetDeviceScaleFactor() OVERRIDE { | 58 virtual float GetDeviceScaleFactor() OVERRIDE { |
59 return 1.0f; | 59 return 1.0f; |
60 } | 60 } |
61 | 61 |
62 virtual aura::RootWindow* AsRootWindow() OVERRIDE { | 62 virtual aura::RootWindow* AsRootWindow() OVERRIDE { |
63 return NULL; | 63 return NULL; |
64 } | 64 } |
| 65 virtual const aura::RootWindow* AsRootWindow() const OVERRIDE { |
| 66 return NULL; |
| 67 } |
65 | 68 |
66 ui::EventType last_touch_type() { | 69 ui::EventType last_touch_type() { |
67 return last_touch_type_; | 70 return last_touch_type_; |
68 } | 71 } |
69 | 72 |
70 int last_touch_id() { | 73 int last_touch_id() { |
71 return last_touch_id_; | 74 return last_touch_id_; |
72 } | 75 } |
73 | 76 |
74 gfx::Point last_touch_location() { | 77 gfx::Point last_touch_location() { |
(...skipping 21 matching lines...) Expand all Loading... |
96 #if defined(OS_CHROMEOS) | 99 #if defined(OS_CHROMEOS) |
97 // Fake a ChromeOS running env. | 100 // Fake a ChromeOS running env. |
98 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n"; | 101 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n"; |
99 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); | 102 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); |
100 #endif // defined(OS_CHROMEOS) | 103 #endif // defined(OS_CHROMEOS) |
101 | 104 |
102 scoped_ptr<RootWindowHostX11> root_window_host( | 105 scoped_ptr<RootWindowHostX11> root_window_host( |
103 new RootWindowHostX11(gfx::Rect(0, 0, 2560, 1700))); | 106 new RootWindowHostX11(gfx::Rect(0, 0, 2560, 1700))); |
104 scoped_ptr<TestRootWindowHostDelegate> delegate( | 107 scoped_ptr<TestRootWindowHostDelegate> delegate( |
105 new TestRootWindowHostDelegate()); | 108 new TestRootWindowHostDelegate()); |
106 root_window_host->SetDelegate(delegate.get()); | 109 root_window_host->set_delegate(delegate.get()); |
107 | 110 |
108 std::vector<unsigned int> devices; | 111 std::vector<unsigned int> devices; |
109 devices.push_back(0); | 112 devices.push_back(0); |
110 ui::SetupTouchDevicesForTest(devices); | 113 ui::SetupTouchDevicesForTest(devices); |
111 std::vector<ui::Valuator> valuators; | 114 std::vector<ui::Valuator> valuators; |
112 | 115 |
113 EXPECT_EQ(ui::ET_UNKNOWN, delegate->last_touch_type()); | 116 EXPECT_EQ(ui::ET_UNKNOWN, delegate->last_touch_type()); |
114 EXPECT_EQ(-1, delegate->last_touch_id()); | 117 EXPECT_EQ(-1, delegate->last_touch_id()); |
115 | 118 |
116 #if defined(OS_CHROMEOS) | 119 #if defined(OS_CHROMEOS) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 #if defined(OS_CHROMEOS) | 163 #if defined(OS_CHROMEOS) |
161 TEST_F(RootWindowHostX11Test, DispatchTouchEventToTwoRootWindow) { | 164 TEST_F(RootWindowHostX11Test, DispatchTouchEventToTwoRootWindow) { |
162 // Fake a ChromeOS running env. | 165 // Fake a ChromeOS running env. |
163 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n"; | 166 const char* kLsbRelease = "CHROMEOS_RELEASE_NAME=Chromium OS\n"; |
164 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); | 167 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); |
165 | 168 |
166 scoped_ptr<RootWindowHostX11> root_window_host1( | 169 scoped_ptr<RootWindowHostX11> root_window_host1( |
167 new RootWindowHostX11(gfx::Rect(0, 0, 2560, 1700))); | 170 new RootWindowHostX11(gfx::Rect(0, 0, 2560, 1700))); |
168 scoped_ptr<TestRootWindowHostDelegate> delegate1( | 171 scoped_ptr<TestRootWindowHostDelegate> delegate1( |
169 new TestRootWindowHostDelegate()); | 172 new TestRootWindowHostDelegate()); |
170 root_window_host1->SetDelegate(delegate1.get()); | 173 root_window_host1->set_delegate(delegate1.get()); |
171 | 174 |
172 int host2_y_offset = 1700; | 175 int host2_y_offset = 1700; |
173 scoped_ptr<RootWindowHostX11> root_window_host2( | 176 scoped_ptr<RootWindowHostX11> root_window_host2( |
174 new RootWindowHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080))); | 177 new RootWindowHostX11(gfx::Rect(0, host2_y_offset, 1920, 1080))); |
175 scoped_ptr<TestRootWindowHostDelegate> delegate2( | 178 scoped_ptr<TestRootWindowHostDelegate> delegate2( |
176 new TestRootWindowHostDelegate()); | 179 new TestRootWindowHostDelegate()); |
177 root_window_host2->SetDelegate(delegate2.get()); | 180 root_window_host2->set_delegate(delegate2.get()); |
178 | 181 |
179 std::vector<unsigned int> devices; | 182 std::vector<unsigned int> devices; |
180 devices.push_back(0); | 183 devices.push_back(0); |
181 ui::SetupTouchDevicesForTest(devices); | 184 ui::SetupTouchDevicesForTest(devices); |
182 std::vector<ui::Valuator> valuators; | 185 std::vector<ui::Valuator> valuators; |
183 | 186 |
184 EXPECT_EQ(ui::ET_UNKNOWN, delegate1->last_touch_type()); | 187 EXPECT_EQ(ui::ET_UNKNOWN, delegate1->last_touch_type()); |
185 EXPECT_EQ(-1, delegate1->last_touch_id()); | 188 EXPECT_EQ(-1, delegate1->last_touch_id()); |
186 EXPECT_EQ(ui::ET_UNKNOWN, delegate2->last_touch_type()); | 189 EXPECT_EQ(ui::ET_UNKNOWN, delegate2->last_touch_type()); |
187 EXPECT_EQ(-1, delegate2->last_touch_id()); | 190 EXPECT_EQ(-1, delegate2->last_touch_id()); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 | 264 |
262 // Revert the CrOS testing env otherwise the following non-CrOS aura | 265 // Revert the CrOS testing env otherwise the following non-CrOS aura |
263 // tests will fail. | 266 // tests will fail. |
264 // Fake a ChromeOS running env. | 267 // Fake a ChromeOS running env. |
265 kLsbRelease = ""; | 268 kLsbRelease = ""; |
266 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); | 269 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); |
267 } | 270 } |
268 #endif // defined(OS_CHROMEOS) | 271 #endif // defined(OS_CHROMEOS) |
269 | 272 |
270 } // namespace aura | 273 } // namespace aura |
OLD | NEW |