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

Side by Side Diff: ui/views/controls/menu/menu_controller_unittest.cc

Issue 2488393003: Changes views_aura_mus_unittests to create DesktopNativeWidgetAura (Closed)
Patch Set: remove this and fix mac Created 4 years, 1 month 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
OLDNEW
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 "ui/views/controls/menu/menu_controller.h" 5 #include "ui/views/controls/menu/menu_controller.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 MenuItemView* run_result = 1419 MenuItemView* run_result =
1420 controller->Run(nullptr, nullptr, menu_item(), gfx::Rect(), 1420 controller->Run(nullptr, nullptr, menu_item(), gfx::Rect(),
1421 MENU_ANCHOR_TOPLEFT, false, false, &mouse_event_flags); 1421 MENU_ANCHOR_TOPLEFT, false, false, &mouse_event_flags);
1422 EXPECT_EQ(run_result, nullptr); 1422 EXPECT_EQ(run_result, nullptr);
1423 } 1423 }
1424 1424
1425 // Tests that if a MenuController is destroying during drag/drop, and another 1425 // Tests that if a MenuController is destroying during drag/drop, and another
1426 // MenuController becomes active, that the exiting of drag does not cause a 1426 // MenuController becomes active, that the exiting of drag does not cause a
1427 // crash. 1427 // crash.
1428 TEST_F(MenuControllerTest, MenuControllerReplacedDuringDrag) { 1428 TEST_F(MenuControllerTest, MenuControllerReplacedDuringDrag) {
1429 // TODO: this test wedges with aura-mus-client. http://crbug.com/664280.
1430 if (IsAuraMusClient())
1431 return;
1432
1429 // This test creates two native widgets, but expects the child native widget 1433 // This test creates two native widgets, but expects the child native widget
1430 // to be able to reach up and use the parent native widget's aura 1434 // to be able to reach up and use the parent native widget's aura
1431 // objects. https://crbug.com/614037 1435 // objects. https://crbug.com/614037
1432 if (IsMus()) 1436 if (IsMus())
1433 return; 1437 return;
1434 1438
1435 TestDragDropClient drag_drop_client( 1439 TestDragDropClient drag_drop_client(
1436 base::Bind(&MenuControllerTest::TestMenuControllerReplacementDuringDrag, 1440 base::Bind(&MenuControllerTest::TestMenuControllerReplacementDuringDrag,
1437 base::Unretained(this))); 1441 base::Unretained(this)));
1438 aura::client::SetDragDropClient(owner()->GetNativeWindow()->GetRootWindow(), 1442 aura::client::SetDragDropClient(owner()->GetNativeWindow()->GetRootWindow(),
1439 &drag_drop_client); 1443 &drag_drop_client);
1440 AddButtonMenuItems(); 1444 AddButtonMenuItems();
1441 StartDrag(); 1445 StartDrag();
1442 } 1446 }
1443 1447
1444 // Tests that if a CancelAll is called during drag-and-drop that it does not 1448 // Tests that if a CancelAll is called during drag-and-drop that it does not
1445 // destroy the MenuController. On Windows and Linux this destruction also 1449 // destroy the MenuController. On Windows and Linux this destruction also
1446 // destroys the Widget used for drag-and-drop, thereby ending the drag. 1450 // destroys the Widget used for drag-and-drop, thereby ending the drag.
1447 TEST_F(MenuControllerTest, CancelAllDuringDrag) { 1451 TEST_F(MenuControllerTest, CancelAllDuringDrag) {
1452 // TODO: this test wedges with aura-mus-client. http://crbug.com/664280.
1453 if (IsAuraMusClient())
1454 return;
1455
1448 // This test creates two native widgets, but expects the child native widget 1456 // This test creates two native widgets, but expects the child native widget
1449 // to be able to reach up and use the parent native widget's aura 1457 // to be able to reach up and use the parent native widget's aura
1450 // objects. https://crbug.com/614037 1458 // objects. https://crbug.com/614037
1451 if (IsMus()) 1459 if (IsMus())
1452 return; 1460 return;
1453 1461
1454 MenuController* controller = menu_controller(); 1462 MenuController* controller = menu_controller();
1455 controller->SetAsyncRun(true); 1463 controller->SetAsyncRun(true);
1456 1464
1457 TestDragDropClient drag_drop_client(base::Bind( 1465 TestDragDropClient drag_drop_client(base::Bind(
1458 &MenuControllerTest::TestCancelAllDuringDrag, base::Unretained(this))); 1466 &MenuControllerTest::TestCancelAllDuringDrag, base::Unretained(this)));
1459 aura::client::SetDragDropClient(owner()->GetNativeWindow()->GetRootWindow(), 1467 aura::client::SetDragDropClient(owner()->GetNativeWindow()->GetRootWindow(),
1460 &drag_drop_client); 1468 &drag_drop_client);
1461 AddButtonMenuItems(); 1469 AddButtonMenuItems();
1462 StartDrag(); 1470 StartDrag();
1463 } 1471 }
1464 1472
1465 #endif // defined(USE_AURA) 1473 #endif // defined(USE_AURA)
1466 1474
1467 } // namespace test 1475 } // namespace test
1468 } // namespace views 1476 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/menu_button_unittest.cc ('k') | ui/views/controls/menu/menu_runner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698