OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/aura/root_window.h" | 5 #include "ui/aura/root_window.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/aura/client/event_client.h" | 10 #include "ui/aura/client/event_client.h" |
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 | 1174 |
1175 private: | 1175 private: |
1176 bool* got_destroying_; | 1176 bool* got_destroying_; |
1177 bool* has_valid_root_; | 1177 bool* has_valid_root_; |
1178 | 1178 |
1179 DISALLOW_COPY_AND_ASSIGN(ValidRootDuringDestructionWindowObserver); | 1179 DISALLOW_COPY_AND_ASSIGN(ValidRootDuringDestructionWindowObserver); |
1180 }; | 1180 }; |
1181 | 1181 |
1182 } // namespace | 1182 } // namespace |
1183 | 1183 |
| 1184 #if defined(USE_OZONE) |
| 1185 // Creating multiple RootWindowHostOzone instances is broken. |
| 1186 #define MAYBE_ValidRootDuringDestruction DISABLED_ValidRootDuringDestruction |
| 1187 #else |
| 1188 #define MAYBE_ValidRootDuringDestruction ValidRootDuringDestruction |
| 1189 #endif |
| 1190 |
1184 // Verifies GetRootWindow() from ~Window returns a valid root. | 1191 // Verifies GetRootWindow() from ~Window returns a valid root. |
1185 TEST_F(RootWindowTest, ValidRootDuringDestruction) { | 1192 TEST_F(RootWindowTest, MAYBE_ValidRootDuringDestruction) { |
1186 bool got_destroying = false; | 1193 bool got_destroying = false; |
1187 bool has_valid_root = false; | 1194 bool has_valid_root = false; |
1188 ValidRootDuringDestructionWindowObserver observer(&got_destroying, | 1195 ValidRootDuringDestructionWindowObserver observer(&got_destroying, |
1189 &has_valid_root); | 1196 &has_valid_root); |
1190 { | 1197 { |
1191 scoped_ptr<RootWindow> root_window( | 1198 scoped_ptr<RootWindow> root_window( |
1192 new RootWindow(RootWindow::CreateParams(gfx::Rect(0, 0, 100, 100)))); | 1199 new RootWindow(RootWindow::CreateParams(gfx::Rect(0, 0, 100, 100)))); |
1193 root_window->Init(); | 1200 root_window->Init(); |
1194 // Owned by RootWindow. | 1201 // Owned by RootWindow. |
1195 Window* w1 = CreateNormalWindow(1, root_window->window(), NULL); | 1202 Window* w1 = CreateNormalWindow(1, root_window->window(), NULL); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 private: | 1294 private: |
1288 RootWindow* root_; | 1295 RootWindow* root_; |
1289 bool got_mouse_event_; | 1296 bool got_mouse_event_; |
1290 bool got_destroy_; | 1297 bool got_destroy_; |
1291 | 1298 |
1292 DISALLOW_COPY_AND_ASSIGN(DeleteRootFromHeldMouseEventDelegate); | 1299 DISALLOW_COPY_AND_ASSIGN(DeleteRootFromHeldMouseEventDelegate); |
1293 }; | 1300 }; |
1294 | 1301 |
1295 } // namespace | 1302 } // namespace |
1296 | 1303 |
| 1304 #if defined(USE_OZONE) |
| 1305 // Creating multiple RootWindowHostOzone instances is broken. |
| 1306 #define MAYBE_DeleteRootFromHeldMouseEvent DISABLED_DeleteRootFromHeldMouseEvent |
| 1307 #else |
| 1308 #define MAYBE_DeleteRootFromHeldMouseEvent DeleteRootFromHeldMouseEvent |
| 1309 #endif |
| 1310 |
1297 // Verifies if a RootWindow is deleted from dispatching a held mouse event we | 1311 // Verifies if a RootWindow is deleted from dispatching a held mouse event we |
1298 // don't crash. | 1312 // don't crash. |
1299 TEST_F(RootWindowTest, DeleteRootFromHeldMouseEvent) { | 1313 TEST_F(RootWindowTest, MAYBE_DeleteRootFromHeldMouseEvent) { |
1300 // Should be deleted by |delegate|. | 1314 // Should be deleted by |delegate|. |
1301 RootWindow* r2 = | 1315 RootWindow* r2 = |
1302 new RootWindow(RootWindow::CreateParams(gfx::Rect(0, 0, 100, 100))); | 1316 new RootWindow(RootWindow::CreateParams(gfx::Rect(0, 0, 100, 100))); |
1303 r2->Init(); | 1317 r2->Init(); |
1304 DeleteRootFromHeldMouseEventDelegate delegate(r2); | 1318 DeleteRootFromHeldMouseEventDelegate delegate(r2); |
1305 // Owned by |r2|. | 1319 // Owned by |r2|. |
1306 Window* w1 = CreateNormalWindow(1, r2->window(), &delegate); | 1320 Window* w1 = CreateNormalWindow(1, r2->window(), &delegate); |
1307 w1->SetBounds(gfx::Rect(0, 0, 40, 40)); | 1321 w1->SetBounds(gfx::Rect(0, 0, 40, 40)); |
1308 ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, | 1322 ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, |
1309 gfx::Point(10, 10), gfx::Point(10, 10), | 1323 gfx::Point(10, 10), gfx::Point(10, 10), |
1310 ui::EF_SHIFT_DOWN); | 1324 ui::EF_SHIFT_DOWN); |
1311 r2->RepostEvent(pressed); | 1325 r2->RepostEvent(pressed); |
1312 // RunAllPendingInMessageLoop() to make sure the |pressed| is run. | 1326 // RunAllPendingInMessageLoop() to make sure the |pressed| is run. |
1313 RunAllPendingInMessageLoop(); | 1327 RunAllPendingInMessageLoop(); |
1314 EXPECT_TRUE(delegate.got_mouse_event()); | 1328 EXPECT_TRUE(delegate.got_mouse_event()); |
1315 EXPECT_TRUE(delegate.got_destroy()); | 1329 EXPECT_TRUE(delegate.got_destroy()); |
1316 } | 1330 } |
1317 | 1331 |
1318 } // namespace aura | 1332 } // namespace aura |
OLD | NEW |