| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "ui/base/clipboard/clipboard.h" | 10 #include "ui/base/clipboard/clipboard.h" |
| (...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 // click events are processed and the listener gets the click) | 1406 // click events are processed and the listener gets the click) |
| 1407 TEST_F(ButtonDropDownTest, RegularClickTest) { | 1407 TEST_F(ButtonDropDownTest, RegularClickTest) { |
| 1408 MouseEvent press_event(ui::ET_MOUSE_PRESSED, 1, 1, ui::EF_LEFT_BUTTON_DOWN); | 1408 MouseEvent press_event(ui::ET_MOUSE_PRESSED, 1, 1, ui::EF_LEFT_BUTTON_DOWN); |
| 1409 MouseEvent release_event(ui::ET_MOUSE_RELEASED, 1, 1, | 1409 MouseEvent release_event(ui::ET_MOUSE_RELEASED, 1, 1, |
| 1410 ui::EF_LEFT_BUTTON_DOWN); | 1410 ui::EF_LEFT_BUTTON_DOWN); |
| 1411 button_as_view_->OnMousePressed(press_event); | 1411 button_as_view_->OnMousePressed(press_event); |
| 1412 button_as_view_->OnMouseReleased(release_event); | 1412 button_as_view_->OnMouseReleased(release_event); |
| 1413 EXPECT_EQ(test_dialog_->last_pressed_button_, test_dialog_->button_drop_); | 1413 EXPECT_EQ(test_dialog_->last_pressed_button_, test_dialog_->button_drop_); |
| 1414 } | 1414 } |
| 1415 | 1415 |
| 1416 #if defined(OS_WIN) | |
| 1417 // Ensure that dragging downwards on the button shows the menu while keeping the | |
| 1418 // button depressed. | |
| 1419 TEST_F(ButtonDropDownTest, DragMenuTest) { | |
| 1420 test_dialog_->last_pressed_button_ = NULL; | |
| 1421 MouseEvent press_event(ui::ET_MOUSE_PRESSED, 1, 1, ui::EF_LEFT_BUTTON_DOWN); | |
| 1422 MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, 1, 99, ui::EF_LEFT_BUTTON_DOWN); | |
| 1423 test_dialog_->ExpectShowDropMenu(); | |
| 1424 button_as_view_->OnMousePressed(press_event); | |
| 1425 button_as_view_->OnMouseDragged(drag_event); | |
| 1426 // The button should not get a press event as a result of the drag. This would | |
| 1427 // revert the button into an unpressed state while the menu is open. | |
| 1428 EXPECT_TRUE(test_dialog_->last_pressed_button_ == NULL); | |
| 1429 } | |
| 1430 #endif | |
| 1431 | |
| 1432 //////////////////////////////////////////////////////////////////////////////// | 1416 //////////////////////////////////////////////////////////////////////////////// |
| 1433 // View hierarchy / Visibility changes | 1417 // View hierarchy / Visibility changes |
| 1434 //////////////////////////////////////////////////////////////////////////////// | 1418 //////////////////////////////////////////////////////////////////////////////// |
| 1435 /* | 1419 /* |
| 1436 TEST_F(ViewTest, ChangeVisibility) { | 1420 TEST_F(ViewTest, ChangeVisibility) { |
| 1437 #if defined(OS_LINUX) | 1421 #if defined(OS_LINUX) |
| 1438 // Make CRITICAL messages fatal | 1422 // Make CRITICAL messages fatal |
| 1439 // TODO(oshima): we probably should enable this for entire tests on linux. | 1423 // TODO(oshima): we probably should enable this for entire tests on linux. |
| 1440 g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL); | 1424 g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL); |
| 1441 #endif | 1425 #endif |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2006 EXPECT_TRUE(v2->Contains(v2)); | 1990 EXPECT_TRUE(v2->Contains(v2)); |
| 2007 EXPECT_FALSE(v2->Contains(&v1)); | 1991 EXPECT_FALSE(v2->Contains(&v1)); |
| 2008 EXPECT_TRUE(v2->Contains(v3)); | 1992 EXPECT_TRUE(v2->Contains(v3)); |
| 2009 EXPECT_FALSE(v3->Contains(NULL)); | 1993 EXPECT_FALSE(v3->Contains(NULL)); |
| 2010 EXPECT_TRUE(v3->Contains(v3)); | 1994 EXPECT_TRUE(v3->Contains(v3)); |
| 2011 EXPECT_FALSE(v3->Contains(&v1)); | 1995 EXPECT_FALSE(v3->Contains(&v1)); |
| 2012 EXPECT_FALSE(v3->Contains(v2)); | 1996 EXPECT_FALSE(v3->Contains(v2)); |
| 2013 } | 1997 } |
| 2014 | 1998 |
| 2015 } // namespace views | 1999 } // namespace views |
| OLD | NEW |